diff --git a/CRM/TwingleCampaign/BAO/TwingleEvent.php b/CRM/TwingleCampaign/BAO/TwingleEvent.php index 4248c1d..faf609b 100644 --- a/CRM/TwingleCampaign/BAO/TwingleEvent.php +++ b/CRM/TwingleCampaign/BAO/TwingleEvent.php @@ -219,13 +219,15 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign { private static function matchContact(string $names, string $email): ?int { $names = StringOps::split_names($names); // Hopefully just a temporary solution - $firstnames = $names['firstnames']; - $lastname = $names['lastname']; + $firstnames = $names['firstnames'] ?? NULL; + $lastname = $names['lastname'] ?? NULL; + $display_name = $names['display_name'] ?? NULL; try { $contact = civicrm_api3('Contact', 'getorcreate', [ 'xcm_profile' => Civi::settings()->get('twinglecampaign_xcm_profile'), 'first_name' => $firstnames, 'last_name' => $lastname, + 'display_name' => $display_name, 'email' => $email, ]); return (int) $contact['id']; diff --git a/CRM/TwingleCampaign/Utils/StringOperations.php b/CRM/TwingleCampaign/Utils/StringOperations.php index 19c0fd3..98e6657 100644 --- a/CRM/TwingleCampaign/Utils/StringOperations.php +++ b/CRM/TwingleCampaign/Utils/StringOperations.php @@ -49,7 +49,7 @@ class CRM_TwingleCampaign_Utils_StringOperations { $firstnames = implode(" ", $names); return ['firstnames' => $firstnames, 'lastname' => $lastname]; } - return $string; + return ['display_name' => $string]; } /** @@ -71,4 +71,4 @@ class CRM_TwingleCampaign_Utils_StringOperations { public static function startsWith($haystack, $needle): bool { return substr_compare($haystack, $needle, 0, strlen($needle)) === 0; } -} \ No newline at end of file +} diff --git a/api/v3/TwingleProject/Sync.php b/api/v3/TwingleProject/Sync.php index aed3d2a..ca72d0e 100644 --- a/api/v3/TwingleProject/Sync.php +++ b/api/v3/TwingleProject/Sync.php @@ -193,8 +193,8 @@ function civicrm_api3_twingle_project_Sync(array $params): array { foreach ($projects_from_civicrm['values'] as $project_from_civicrm) { if ( !in_array($project_from_civicrm['project_id'], - array_column($projects_from_twingle, 'id') - )) { + array_column($projects_from_twingle, 'id'), + ) && $project_from_civicrm['is_active'] == 1) { // store campaign id in $id $id = $project_from_civicrm['id']; unset($project_from_civicrm['id']); diff --git a/info.xml b/info.xml index af3474b..7971b85 100644 --- a/info.xml +++ b/info.xml @@ -14,13 +14,12 @@ https://lab.civicrm.org/Marc_Michalsky/de-forumzfd-twinglecampaign/-/issues http://www.gnu.org/licenses/agpl-3.0.html - 2023-02-28 - 1.0.5 + 2024-06-15 + 1.0.8 stable - 5.14.0 + 5.74 - de.systopia.xcm de.systopia.campaign