bug fix: get all events of all projects

This commit is contained in:
Marc Michalsky forumZFD 2020-11-02 17:40:34 +01:00
parent 3554f958d2
commit 50a63ee860
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9

View file

@ -74,20 +74,20 @@ function civicrm_api3_twingle_sync_Post(array $params) {
} }
} }
// Get all events from projects of event type // Get all events from projects of type "event" and create them as campaigns
// if they do not exist yet
$j = 0;
foreach ($result_values['sync']['projects'] as $project) { foreach ($result_values['sync']['projects'] as $project) {
if ($project['project_type'] == 'event') { if ($project['project_type'] == 'event') {
$events = $twingleApi->getEvent($project['project_id']); $events = $twingleApi->getEvent($project['project_id']);
} if (is_array($events)) {
} foreach ($events as $event) {
if ($event) {
// Create events them as campaigns if they do not exist and store results in $result_values['sync']['events'][$j++] =
// $result_values TwingleEvent::sync($event, $twingleApi, $is_test);
$j = 0; }
if ($events) { }
foreach ($events as $event) { }
$result_values['sync']['events'][$j++] =
TwingleEvent::sync($event, $twingleApi, $is_test);
} }
} }