🔧 fixing some 'unknown index' warnings
This commit is contained in:
parent
3083feae5e
commit
1e6feda923
4 changed files with 17 additions and 11 deletions
|
@ -181,8 +181,10 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
|
||||||
|
|
||||||
// Translate keys
|
// Translate keys
|
||||||
foreach ($field_translations as $origin => $translation) {
|
foreach ($field_translations as $origin => $translation) {
|
||||||
$values[$translation] = $values[$origin];
|
if (isset($values[$origin])) {
|
||||||
unset($values[$origin]);
|
$values[$translation] = $values[$origin];
|
||||||
|
unset($values[$origin]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,11 +27,13 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
$this->id_custom_field = Cache::getInstance()
|
$this->id_custom_field = Cache::getInstance()
|
||||||
->getCustomFieldMapping()['twingle_event_id'];
|
->getCustomFieldMapping()['twingle_event_id'];
|
||||||
|
|
||||||
try {
|
if ($id) {
|
||||||
$this->values['parent_id'] = $this->getParentCampaignId();
|
try {
|
||||||
} catch (CiviCRM_API3_Exception $e) {
|
$this->values['parent_id'] = $this->getParentCampaignId();
|
||||||
$errorMessage = $e->getMessage();
|
} catch (CiviCRM_API3_Exception $e) {
|
||||||
throw new Exception("Could not identify parent Campaign: $errorMessage");
|
$errorMessage = $e->getMessage();
|
||||||
|
throw new Exception("Could not identify parent Campaign: $errorMessage");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +154,9 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
||||||
self::getTimestamp($values['created_at']);
|
self::getTimestamp($values['created_at']);
|
||||||
|
|
||||||
// Cast project target to integer
|
// Cast project target to integer
|
||||||
$values['project_target'] = (int) $values['project_target'];
|
if (isset($values['project_target'])) {
|
||||||
|
$values['project_target'] = (int) $values['project_target'];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -99,7 +99,7 @@ function civicrm_api3_twingle_event_Sync(array $params): array {
|
||||||
$twingleApi = Civi::cache()->get('twinglecampaign_twingle_api');
|
$twingleApi = Civi::cache()->get('twinglecampaign_twingle_api');
|
||||||
if (NULL === $twingleApi || $params['twingle_api_key'] || $params['limit']) {
|
if (NULL === $twingleApi || $params['twingle_api_key'] || $params['limit']) {
|
||||||
try {
|
try {
|
||||||
if ($params['limit']) {
|
if (isset($params['limit'])) {
|
||||||
$twingleApi = new TwingleApiCall($apiKey, $params['limit']);
|
$twingleApi = new TwingleApiCall($apiKey, $params['limit']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -112,7 +112,7 @@ function civicrm_api3_twingle_event_Sync(array $params): array {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an id or a event_id is provided, synchronize only this one campaign
|
// If an id or a event_id is provided, synchronize only this one campaign
|
||||||
if ($params['id'] || $params['event_id']) {
|
if (isset($params['id']) || isset($params['event_id'])) {
|
||||||
|
|
||||||
// Get project from db via API
|
// Get project from db via API
|
||||||
$params['sequential'] = 1;
|
$params['sequential'] = 1;
|
||||||
|
|
|
@ -91,7 +91,7 @@ function civicrm_api3_twingle_project_Sync(array $params): array {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If an id or a project_id is given, synchronize only this one campaign
|
// If an id or a project_id is given, synchronize only this one campaign
|
||||||
if ($params['id'] || $params['project_id']) {
|
if (isset($params['id']) || isset($params['project_id'])) {
|
||||||
|
|
||||||
// Get project from db via API
|
// Get project from db via API
|
||||||
$params['sequential'] = 1;
|
$params['sequential'] = 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue