Compare commits

...

3 commits
1.0.7 ... main

Author SHA1 Message Date
Marc Michalsky
012f4901e4
🔖 bump version to 1.0.8 2024-07-18 15:38:42 +02:00
Marc Michalsky
7415fac88d
Cover the case where an event creator passes only one name part 2024-07-18 15:37:30 +02:00
Marc Michalsky
91c70c645a
Push only active campaigns to Twingle 2024-07-18 15:35:31 +02:00
4 changed files with 9 additions and 7 deletions

View file

@ -219,13 +219,15 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign {
private private
static function matchContact(string $names, string $email): ?int { static function matchContact(string $names, string $email): ?int {
$names = StringOps::split_names($names); // Hopefully just a temporary solution $names = StringOps::split_names($names); // Hopefully just a temporary solution
$firstnames = $names['firstnames']; $firstnames = $names['firstnames'] ?? NULL;
$lastname = $names['lastname']; $lastname = $names['lastname'] ?? NULL;
$display_name = $names['display_name'] ?? NULL;
try { try {
$contact = civicrm_api3('Contact', 'getorcreate', [ $contact = civicrm_api3('Contact', 'getorcreate', [
'xcm_profile' => Civi::settings()->get('twinglecampaign_xcm_profile'), 'xcm_profile' => Civi::settings()->get('twinglecampaign_xcm_profile'),
'first_name' => $firstnames, 'first_name' => $firstnames,
'last_name' => $lastname, 'last_name' => $lastname,
'display_name' => $display_name,
'email' => $email, 'email' => $email,
]); ]);
return (int) $contact['id']; return (int) $contact['id'];

View file

@ -49,7 +49,7 @@ class CRM_TwingleCampaign_Utils_StringOperations {
$firstnames = implode(" ", $names); $firstnames = implode(" ", $names);
return ['firstnames' => $firstnames, 'lastname' => $lastname]; return ['firstnames' => $firstnames, 'lastname' => $lastname];
} }
return $string; return ['display_name' => $string];
} }
/** /**

View file

@ -193,8 +193,8 @@ function civicrm_api3_twingle_project_Sync(array $params): array {
foreach ($projects_from_civicrm['values'] as $project_from_civicrm) { foreach ($projects_from_civicrm['values'] as $project_from_civicrm) {
if ( if (
!in_array($project_from_civicrm['project_id'], !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 // store campaign id in $id
$id = $project_from_civicrm['id']; $id = $project_from_civicrm['id'];
unset($project_from_civicrm['id']); unset($project_from_civicrm['id']);

View file

@ -15,7 +15,7 @@
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url> <url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
</urls> </urls>
<releaseDate>2024-06-15</releaseDate> <releaseDate>2024-06-15</releaseDate>
<version>1.0.7</version> <version>1.0.8</version>
<develStage>stable</develStage> <develStage>stable</develStage>
<compatibility> <compatibility>
<ver>5.74</ver> <ver>5.74</ver>