🔧 fixing some 'unknown index' warnings
This commit is contained in:
parent
3083feae5e
commit
1e6feda923
4 changed files with 17 additions and 11 deletions
|
@ -181,10 +181,12 @@ abstract class CRM_TwingleCampaign_BAO_Campaign {
|
|||
|
||||
// Translate keys
|
||||
foreach ($field_translations as $origin => $translation) {
|
||||
if (isset($values[$origin])) {
|
||||
$values[$translation] = $values[$origin];
|
||||
unset($values[$origin]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
|||
$this->id_custom_field = Cache::getInstance()
|
||||
->getCustomFieldMapping()['twingle_event_id'];
|
||||
|
||||
if ($id) {
|
||||
try {
|
||||
$this->values['parent_id'] = $this->getParentCampaignId();
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
|
@ -34,6 +35,7 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
|
|||
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']);
|
||||
|
||||
// Cast project target to integer
|
||||
if (isset($values['project_target'])) {
|
||||
$values['project_target'] = (int) $values['project_target'];
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -99,7 +99,7 @@ function civicrm_api3_twingle_event_Sync(array $params): array {
|
|||
$twingleApi = Civi::cache()->get('twinglecampaign_twingle_api');
|
||||
if (NULL === $twingleApi || $params['twingle_api_key'] || $params['limit']) {
|
||||
try {
|
||||
if ($params['limit']) {
|
||||
if (isset($params['limit'])) {
|
||||
$twingleApi = new TwingleApiCall($apiKey, $params['limit']);
|
||||
}
|
||||
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 ($params['id'] || $params['event_id']) {
|
||||
if (isset($params['id']) || isset($params['event_id'])) {
|
||||
|
||||
// Get project from db via API
|
||||
$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 ($params['id'] || $params['project_id']) {
|
||||
if (isset($params['id']) || isset($params['project_id'])) {
|
||||
|
||||
// Get project from db via API
|
||||
$params['sequential'] = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue