✨️ Do not sync Twingle projects to CiviCRM which are marked as such
There is a checkbox in TwingleMANAGER that allows you to enable and disable API calls to the Twingl API (de.systopia.twingle). This commit makes the TwingleCampaign extension pay attention to this checkbox, so if it is unchecked, no campaign will be created in CiviCRM for this Twingle project.
This commit is contained in:
parent
066a0096df
commit
bbbf6e1cc6
2 changed files with 13 additions and 3 deletions
|
@ -165,6 +165,11 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign {
|
||||||
*/
|
*/
|
||||||
public function create(bool $no_hook = FALSE): bool {
|
public function create(bool $no_hook = FALSE): bool {
|
||||||
|
|
||||||
|
# If this project is not meant to be synced, do not create a campaign
|
||||||
|
if (!$this->values['project_options']['has_civi_crm_activated']) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
$result = parent::create($no_hook);
|
$result = parent::create($no_hook);
|
||||||
|
|
||||||
// Check if campaign was created successfully
|
// Check if campaign was created successfully
|
||||||
|
|
|
@ -230,9 +230,14 @@ function civicrm_api3_twingle_project_Sync(array $params): array {
|
||||||
$project->getResponse('Ready to create TwingleProject');
|
$project->getResponse('Ready to create TwingleProject');
|
||||||
}
|
}
|
||||||
|
|
||||||
$project->create(TRUE);
|
if ($project->create(TRUE)) {
|
||||||
$returnValues[$project->getId()] =
|
$returnValues[$project->getId()] =
|
||||||
$project->getResponse('TwingleProject created');
|
$project->getResponse('TwingleProject created');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$returnValues[$project->getId()] =
|
||||||
|
$project->getResponse('TwingleProject not selected for synchronization');
|
||||||
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$errors[$project_from_twingle['id']] = $e->getMessage();
|
$errors[$project_from_twingle['id']] = $e->getMessage();
|
||||||
Civi::log()->error(
|
Civi::log()->error(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue