👾 bug fix: cannot set TwingleProject url via TwingleForm.create API

This commit is contained in:
Marc Michalsky forumZFD 2021-04-15 20:07:48 +02:00
parent ef74a52e9f
commit c22911e886
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
4 changed files with 66 additions and 26 deletions

View file

@ -62,26 +62,36 @@ function twinglecampaign_civicrm_postSave_civicrm_campaign($dao) {
if (empty($_SESSION['CiviCRM']['de.forumzfd.twinglecampaign']['no_hook']) ||
$_SESSION['CiviCRM']['de.forumzfd.twinglecampaign']['no_hook'] != TRUE) {
// If request is not an API-Call
if ($_GET['action'] != 'create') {
// If the db transaction is still running, add a function to it that will
// be called afterwards
if (CRM_Core_Transaction::isActive()) {
// If the db transaction is still running, add a function to it that will
// be called afterwards
if (CRM_Core_Transaction::isActive()) {
if (_validateAndSendInput($dao->id, $dao->campaign_type_id)) {
if (_validateAndSendInput($dao->id, $dao->campaign_type_id)) {
CRM_Core_Transaction::addCallback(
CRM_Core_Transaction::PHASE_POST_COMMIT,
'twinglecampaign_postSave_campaign_update_callback',
[$dao->id, $dao->campaign_type_id]
);
CRM_Core_Transaction::addCallback(
CRM_Core_Transaction::PHASE_POST_COMMIT,
'twinglecampaign_postSave_campaign_update_callback',
[$dao->id, $dao->campaign_type_id]
);
}
}
}
// If the transaction is already finished, call the function directly
// If the transaction is already finished, call the function directly
else {
twinglecampaign_postSave_campaign_update_callback($dao->id, $dao->campaign_type_id);
}
}
else {
twinglecampaign_postSave_campaign_update_callback($dao->id, $dao->campaign_type_id);
CRM_Core_Transaction::addCallback(
CRM_Core_Transaction::PHASE_POST_COMMIT,
'twinglecampaign_postSave_campaign_update_callback',
[$dao->id, $dao->campaign_type_id]
);
}
}
// Remove no hook flag
unset($_SESSION['CiviCRM']['de.forumzfd.twinglecampaign']['no_hook']);