fix various bugs

This commit is contained in:
Marc Michalsky forumZFD 2021-01-18 17:07:07 +01:00
parent 71eb428bb8
commit 05d8941e8a
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
3 changed files with 5 additions and 4 deletions

View file

@ -80,8 +80,9 @@ function civicrm_api3_twingle_sync_Sync($params) {
// Try to retrieve twingleApi from cache
$twingleApi = Civi::cache()->get('twinglecampaign_twingle_api');
if (NULL === $twingleApi) {
if (NULL === $twingleApi || $params['twingle_api_key']) {
$twingleApi = new TwingleApiCall($apiKey, $limit);
Civi::cache('long')->set('twinglecampaign_twingle_api', $twingleApi);
}
if ($params['id'] && !$params['project_id']) {
@ -116,7 +117,7 @@ function civicrm_api3_twingle_sync_Sync($params) {
$i = 0;
// Push missing projects to Twingle
foreach ($projects_from_civicrm as $project_from_civicrm) {
foreach ($projects_from_civicrm['values'] as $project_from_civicrm) {
if (!in_array($project_from_civicrm['project_id'],
array_column($projects_from_twingle, 'id'))) {
// store campaign id in $id