diff --git a/CRM/TwingleCampaign/BAO/TwingleEvent.php b/CRM/TwingleCampaign/BAO/TwingleEvent.php index 04ecb04..2adc38c 100644 --- a/CRM/TwingleCampaign/BAO/TwingleEvent.php +++ b/CRM/TwingleCampaign/BAO/TwingleEvent.php @@ -27,11 +27,13 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign { $this->id_custom_field = Cache::getInstance() ->getCustomFieldMapping()['twingle_event_id']; - try { - $this->values['parent_id'] = $this->getParentCampaignId(); - } catch (CiviCRM_API3_Exception $e) { - $errorMessage = $e->getMessage(); - throw new Exception("Could not identify parent Campaign: $errorMessage"); + if (isset($this->values['parent_id'])) { + try { + $this->values['parent_id'] = $this->getParentCampaignId(); + } catch (CiviCRM_API3_Exception $e) { + $errorMessage = $e->getMessage(); + throw new Exception("Could not identify parent Campaign: $errorMessage"); + } } } diff --git a/api/v3/TwingleEvent/Sync.php b/api/v3/TwingleEvent/Sync.php index 1797b4e..9de54cb 100644 --- a/api/v3/TwingleEvent/Sync.php +++ b/api/v3/TwingleEvent/Sync.php @@ -238,7 +238,7 @@ function civicrm_api3_twingle_event_Sync(array $params): array { } // If this is a test, do not make db changes - if ($params['is_test']) { + if (isset($params['is_test']) && $params['is_test']) { $result_values[$event->getId()] = $event->getResponse('Ready to create TwingleEvent'); } diff --git a/api/v3/TwingleProject/Sync.php b/api/v3/TwingleProject/Sync.php index 40c070b..db1ebb2 100644 --- a/api/v3/TwingleProject/Sync.php +++ b/api/v3/TwingleProject/Sync.php @@ -195,7 +195,7 @@ function civicrm_api3_twingle_project_Sync(array $params): array { ); // If this is a test, do not make db changes - if ($params['is_test']) { + if (isset($params['is_test']) && $params['is_test']) { $returnValues[$project->getId()] = $project->getResponse('Ready to create TwingleProject'); }