Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
012f4901e4 | ||
![]() |
7415fac88d | ||
![]() |
91c70c645a | ||
![]() |
de9cd894b7 | ||
![]() |
711ccd7469 | ||
![]() |
beb9d8f170 | ||
![]() |
65c7e668b3 | ||
![]() |
93c1ab649d | ||
![]() |
ee32f19f31 | ||
![]() |
cbb148b22f | ||
![]() |
9118b622d0 | ||
![]() |
db1ab69138 | ||
![]() |
bcd2b448d2 |
7 changed files with 27 additions and 28 deletions
|
@ -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'];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* A simple custom exception that indicates a problem with the TwingleCampaign class
|
||||
* A simple custom exception that indicates a problem within the TwingleCampaign class
|
||||
*/
|
||||
class CRM_TwingleCampaign_Exceptions_TwingleCampaignException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class CRM_TwingleCampaign_Upgrader extends CRM_TwingleCampaign_Upgrader_Base {
|
|||
[1 => $e->getMessage()]
|
||||
),
|
||||
E::ts('Scheduled Job'),
|
||||
error
|
||||
'error'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
$response_copy = $response;
|
||||
|
||||
// Create soft credit for contribution
|
||||
if (array_key_exists('contribution', $response['values'])) {
|
||||
$contribution = array_shift($response_copy['values']['contribution']);
|
||||
if (array_key_exists('contribution', $response)) {
|
||||
$contribution = array_shift($response_copy['contribution']);
|
||||
if (array_key_exists('campaign_id', $contribution)) {
|
||||
try {
|
||||
$twingle_event = civicrm_api3(
|
||||
|
@ -49,7 +49,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
'getsingle',
|
||||
['id' => $contribution['campaign_id']]
|
||||
);
|
||||
$response['values']['soft_credit'] =
|
||||
$response['soft_credit'] =
|
||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||
$event->setResponse($response);
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
|
@ -58,8 +58,8 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
}
|
||||
}
|
||||
// Create soft credit for sepa mandate
|
||||
elseif (array_key_exists('sepa_mandate', $response['values'])) {
|
||||
$sepa_mandate = array_pop($response_copy['values']['sepa_mandate']);
|
||||
elseif (array_key_exists('sepa_mandate', $response)) {
|
||||
$sepa_mandate = array_pop($response_copy['sepa_mandate']);
|
||||
|
||||
try {
|
||||
$contribution = civicrm_api3(
|
||||
|
@ -84,7 +84,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
'getsingle',
|
||||
['id' => $contribution['contribution_campaign_id']]
|
||||
);
|
||||
$response['values']['soft_credit'] =
|
||||
$response['soft_credit'] =
|
||||
self::createSoftCredit($contribution, $twingle_event)['values'];
|
||||
$event->setResponse($response);
|
||||
} catch (CiviCRM_API3_Exception $e) {
|
||||
|
@ -103,12 +103,12 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
* the de.systopia.twingle extension can include the campaign into the
|
||||
* contribution which it will create.
|
||||
*
|
||||
* @param $apiRequest
|
||||
* @param $callsame
|
||||
* @param array $apiRequest
|
||||
* @param callable $callsame
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function mapDonation($apiRequest, $callsame) {
|
||||
public static function mapDonation(array $apiRequest, callable $callsame) {
|
||||
|
||||
if (array_key_exists(
|
||||
'campaign_id',
|
||||
|
@ -129,11 +129,7 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
}
|
||||
}
|
||||
}
|
||||
elseif (array_key_exists(
|
||||
'event',
|
||||
$apiRequest['params']['custom_fields']) &&
|
||||
!empty($apiRequest['params']['custom_fields']['event'])
|
||||
) {
|
||||
elseif (!empty($apiRequest['params']['custom_fields']['event'])) {
|
||||
try {
|
||||
$targetCampaign = civicrm_api3(
|
||||
'TwingleEvent',
|
||||
|
@ -204,7 +200,9 @@ class CRM_TwingleCampaign_Utils_APIWrapper {
|
|||
'contribution_id' => $contribution['id'],
|
||||
]
|
||||
);
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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']);
|
||||
|
|
7
info.xml
7
info.xml
|
@ -14,13 +14,12 @@
|
|||
<url desc="Support">https://lab.civicrm.org/Marc_Michalsky/de-forumzfd-twinglecampaign/-/issues</url>
|
||||
<url desc="Licensing">http://www.gnu.org/licenses/agpl-3.0.html</url>
|
||||
</urls>
|
||||
<releaseDate>2023-02-28</releaseDate>
|
||||
<version>1.0.5</version>
|
||||
<releaseDate>2024-06-15</releaseDate>
|
||||
<version>1.0.8</version>
|
||||
<develStage>stable</develStage>
|
||||
<compatibility>
|
||||
<ver>5.14.0</ver>
|
||||
<ver>5.74</ver>
|
||||
</compatibility>
|
||||
<comments></comments>
|
||||
<requires>
|
||||
<ext>de.systopia.xcm</ext>
|
||||
<ext>de.systopia.campaign</ext>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue