toevoegen lidnummer custom veld
This commit is contained in:
parent
ee603ed72b
commit
93da6a863d
|
@ -23,10 +23,14 @@ class CRM_Bij1algemeen_Bij1AlgemeenService {
|
|||
private $_standaardLedenGroepId = NULL;
|
||||
private $_airtableDataCustomGroupId = NULL;
|
||||
private $_airtableDataTableName = NULL;
|
||||
private $_lidDataCustomGroupId = NULL;
|
||||
private $_lidDataTableName = NULL;
|
||||
private $_mollieBetalingDataCustomGroupId = NULL;
|
||||
private $_mollieBetalingDataTableName = NULL;
|
||||
private $_inschrijvingsdatumCustomFieldId = NULL;
|
||||
private $_inschrijvingsdatumColumnName = NULL;
|
||||
private $_airtableLidnummerCustomFieldId = NULL;
|
||||
private $_airtableLidnummerColumnName = NULL;
|
||||
private $_lidnummerCustomFieldId = NULL;
|
||||
private $_lidnummerColumnName = NULL;
|
||||
private $_klantnaamCustomFieldId = NULL;
|
||||
|
@ -271,6 +275,34 @@ class CRM_Bij1algemeen_Bij1AlgemeenService {
|
|||
return $this->_mollieCustomerIdIdentityType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
*/
|
||||
public function setAirtableLidnummerCustomFieldId(int $id) {
|
||||
$this->_airtableLidnummerCustomFieldId = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getAirtableLidnummerCustomFieldId() {
|
||||
return $this->_airtableLidnummerCustomFieldId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
public function setAirtableLidnummerColumnName(string $name) {
|
||||
$this->_airtableLidnummerColumnName = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getAirtableLidnummerColumnName() {
|
||||
return $this->_airtableLidnummerColumnName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
*/
|
||||
|
|
|
@ -10,6 +10,32 @@ use CRM_Bij1algemeen_ExtensionUtil as E;
|
|||
*/
|
||||
class CRM_Bij1algemeen_CustomData {
|
||||
|
||||
/**
|
||||
* Set the custom data for airtable data
|
||||
*
|
||||
* @return array[]
|
||||
*/
|
||||
public function getLidData() {
|
||||
return [
|
||||
'lid_data' => [
|
||||
'title' => "Lidmaatschapsgegevens",
|
||||
'extends' => "Contact",
|
||||
'style' => "Inline",
|
||||
'table_name' => "civicrm_value_lid_data",
|
||||
'is_multiple' => FALSE,
|
||||
'custom_field' => [
|
||||
[
|
||||
'name' => "lidnummer",
|
||||
'label' => "Lidnummer",
|
||||
'data_type' => "String",
|
||||
'html_type' => "Text",
|
||||
'text_length' => "32",
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the custom data for airtable data
|
||||
*
|
||||
|
@ -25,8 +51,8 @@ class CRM_Bij1algemeen_CustomData {
|
|||
'is_multiple' => FALSE,
|
||||
'custom_field' => [
|
||||
[
|
||||
'name' => "lidnummer",
|
||||
'label' => "Lidnummer",
|
||||
'name' => "lidnummer_airtable",
|
||||
'label' => "Lidnummer Airtable",
|
||||
'data_type' => "String",
|
||||
'html_type' => "Text",
|
||||
'text_length' => "32",
|
||||
|
|
|
@ -20,6 +20,7 @@ class CRM_Bij1algemeen_Upgrader extends CRM_Bij1algemeen_Upgrader_Base {
|
|||
$keuzeWaarde->maak($betaalMethode);
|
||||
}
|
||||
$customData = new CRM_Bij1algemeen_CustomData();
|
||||
$customData->maak($customData->getLidData());
|
||||
$customData->maak($customData->getAirtableData());
|
||||
$customData->maak($customData->getMollieBetalingData());
|
||||
$customData->maak($customData->getLidmaatschapsaanvraagData());
|
||||
|
@ -31,6 +32,7 @@ class CRM_Bij1algemeen_Upgrader extends CRM_Bij1algemeen_Upgrader_Base {
|
|||
Civi::settings()->set('bij1_basisbedrag', 30);
|
||||
Civi::settings()->set('bij1_sociaaltariefbedrag', 15);
|
||||
Civi::settings()->set('bij1_betalinggemist', 3);
|
||||
Civi::settings()->set('bij1_laatste_lidnummer', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +142,34 @@ class CRM_Bij1algemeen_Upgrader extends CRM_Bij1algemeen_Upgrader_Base {
|
|||
$keuzeWaarde->maak($betaalMethode);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade 1070: lidnummer custom veld (en groep) toevoegen + hernoem lidnummer airtable custom veld
|
||||
*
|
||||
* @return TRUE on success
|
||||
* @throws Exception
|
||||
*/
|
||||
public function upgrade_1070() {
|
||||
$this->ctx->log->info('Applying update 1070 - lidnummer custom veld (en groep) toevoegen');
|
||||
$customData = new CRM_Bij1algemeen_CustomData();
|
||||
$customData->maak($customData->getLidData());
|
||||
if (CRM_Core_BAO_SchemaHandler::checkIfFieldExists('civicrm_value_airtable_data', 'lidnummer')) {
|
||||
CRM_Core_DAO::executeQuery("ALTER TABLE `civicrm_value_airtable_data` CHANGE `lidnummer` `lidnummer_airtable` VARCHAR(32)");
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade 1080: introduceer setting voor laatst uitgegeven lidnummer
|
||||
*
|
||||
* @return TRUE on success
|
||||
* @throws Exception
|
||||
*/
|
||||
public function upgrade_1080() {
|
||||
$this->ctx->log->info('Applying update 1080 - introduceer setting voor laatst uitgegeven lidnummer');
|
||||
Civi::settings()->set('bij1_laatste_lidnummer', 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -85,11 +85,12 @@ class Bij1AlgemeenContainer implements CompilerPassInterface {
|
|||
* @param $definition
|
||||
*/
|
||||
private function setCustomData(&$definition) {
|
||||
$cgQuery = "SELECT id, name, table_name FROM civicrm_custom_group WHERE extends = %1 AND name IN (%2, %3)";
|
||||
$cgQuery = "SELECT id, name, table_name FROM civicrm_custom_group WHERE extends = %1 AND name IN (%2, %3, %4)";
|
||||
$customGroup = \CRM_Core_DAO::executeQuery($cgQuery, [
|
||||
1 => ["Contact", "String"],
|
||||
2 => ["airtable_data", "String"],
|
||||
3 => ["mollie_betaling_data", "String"],
|
||||
3 => ["lid_data", "String"],
|
||||
4 => ["mollie_betaling_data", "String"],
|
||||
]);
|
||||
while ($customGroup->fetch()) {
|
||||
switch ($customGroup->name) {
|
||||
|
@ -109,12 +110,25 @@ class Bij1AlgemeenContainer implements CompilerPassInterface {
|
|||
$definition->addMethodCall('setInschrijvingsdatumColumnName', [$customField->column_name]);
|
||||
break;
|
||||
case "lidnummer":
|
||||
$definition->addMethodCall('setLidnummerCustomFieldId', [(int) $customField->id]);
|
||||
$definition->addMethodCall('setLidnummerColumnName', [$customField->column_name]);
|
||||
$definition->addMethodCall('setAirtableLidnummerCustomFieldId', [(int) $customField->id]);
|
||||
$definition->addMethodCall('setAirtableLidnummerColumnName', [$customField->column_name]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "lid_data":
|
||||
$definition->addMethodCall('setLidDataCustomGroupId', [(int) $customGroup->id]);
|
||||
$definition->addMethodCall('setLidDataTableName', [$customGroup->table_name]);
|
||||
$cfQuery = "SELECT id, column_name FROM civicrm_custom_field WHERE custom_group_id = %1 AND name = %2";
|
||||
$customField = \CRM_Core_DAO::executeQuery($cfQuery, [
|
||||
1 => [(int) $customGroup->id, "Integer"],
|
||||
2 => ["lidnummer", "String"],
|
||||
]);
|
||||
if ($customField->fetch()) {
|
||||
$definition->addMethodCall('setLidnummerCustomFieldId', [(int) $customField->id]);
|
||||
$definition->addMethodCall('setLidnummerColumnName', [$customField->column_name]);
|
||||
}
|
||||
break;
|
||||
case "mollie_betaling_data":
|
||||
$definition->addMethodCall('setMollieBetalingDataCustomGroupId', [(int) $customGroup->id]);
|
||||
$definition->addMethodCall('setMollieBetalingDataTableName', [$customGroup->table_name]);
|
||||
|
|
4
info.xml
4
info.xml
|
@ -14,8 +14,8 @@
|
|||
<url desc="Support">https://civicoop.org</url>
|
||||
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
|
||||
</urls>
|
||||
<releaseDate>2022-01-06</releaseDate>
|
||||
<version>1.1</version>
|
||||
<releaseDate>2022-01-27</releaseDate>
|
||||
<version>1.3</version>
|
||||
<develStage>beta</develStage>
|
||||
<compatibility>
|
||||
<ver>5.0</ver>
|
||||
|
|
Loading…
Reference in New Issue