🚀 synchronize events if unknown event id is transmitted

This commit is contained in:
Marc Michalsky forumZFD 2021-03-18 13:45:30 +01:00
parent 33a733c3d2
commit ebf0e21287
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -141,7 +141,17 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
['event_id' => $apiRequest['params']['custom_fields']['event']]
);
} catch (CiviCRM_API3_Exception $e) {
// Do nothing
// If no event was found, sync all Events and try it again
try {
$test = civicrm_api3('TwingleEvent', 'sync');
$targetCampaign = civicrm_api3(
'TwingleEvent',
'getsingle',
['event_id' => $apiRequest['params']['custom_fields']['event']]
);
} catch (CiviCRM_API3_Exception $e) {
// there's nothing left to do
}
}
}
else {