️ automatically add new case types to custom field options

This commit is contained in:
Marc Michalsky forumZFD 2021-05-28 23:05:11 +02:00
parent cef8c31f31
commit dcae7c6a69
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
6 changed files with 184 additions and 33 deletions

View file

@ -4,6 +4,7 @@ use CRM_TwingleCampaign_Utils_ExtensionCache as ExtensionCache;
use CRM_TwingleCampaign_BAO_TwingleProject as TwingleProject;
use CRM_TwingleCampaign_BAO_TwingleApiCall as TwingleApiCall;
use CRM_TwingleCampaign_ExtensionUtil as E;
use CRM_TwingleCampaign_BAO_CustomField as CustomField;
require_once 'twinglecampaign.civix.php';
@ -46,6 +47,14 @@ function twinglecampaign_civicrm_config(&$config) {
}
}
function twinglecampaign_civicrm_postSave_civicrm_case_type() {
$twingle_project_case_custom_field =
CustomField::fetch('twingle_project_case');
$newCaseType = json_decode($_POST['json'], True);
$twingle_project_case_custom_field->addOptions(
[$newCaseType['name'] => $newCaseType['title']]
);
}
/**
* Implements hook_civicrm_postSave_Campaign().