diff --git a/CRM/TwingleCampaign/BAO/TwingleEvent.php b/CRM/TwingleCampaign/BAO/TwingleEvent.php index 633f86b..3758821 100644 --- a/CRM/TwingleCampaign/BAO/TwingleEvent.php +++ b/CRM/TwingleCampaign/BAO/TwingleEvent.php @@ -1,6 +1,7 @@ $formattedValues['contact_id'], + 'contact_id' => $formattedValues['contact_id'], 'case_type_id' => Configuration::get('twinglecampaign_start_case'), - 'subject' => $formattedValues['title'], - 'start_date' => $formattedValues['created_at'], - 'status_id' => "Open", + 'subject' => $formattedValues['title'], + 'start_date' => $formattedValues['created_at'], + 'status_id' => "Open", ]); } @@ -322,9 +323,6 @@ class CRM_TwingleCampaign_BAO_TwingleEvent extends Campaign { * Matches a single string that should contain first and lastname to match a * contact or create a new one if it does not exist yet. * - * TODO: The logic of this method should instead be handled in the XCM - * extension. This ist only a temporary solution. - * * @param string $names * @param string $email * diff --git a/CRM/TwingleCampaign/BAO/TwingleProject.php b/CRM/TwingleCampaign/BAO/TwingleProject.php index 5c3f2d4..228e39f 100644 --- a/CRM/TwingleCampaign/BAO/TwingleProject.php +++ b/CRM/TwingleCampaign/BAO/TwingleProject.php @@ -49,9 +49,9 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign { */ public static function sync( array $values, - TwingleApiCall &$twingleApi, + TwingleApiCall $twingleApi, bool $is_test = FALSE - ) { + ): ?array { // If $values is an array if (is_array($values)) { @@ -180,7 +180,7 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign { } } - // Return a response of the synchronization + // Return the result of the synchronization return $result; } else { @@ -198,13 +198,13 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign { * * @throws Exception */ - public function export() { + public function export(): array { $values = $this->values; self::formatValues($values, self::OUT); // Get template for project - $project = Cache::getInstance()->getTemplates()['project']; + $project = Cache::getInstance()->getTemplates()['TwingleProject']; // Replace array items which the Twingle API does not expect foreach ($values as $key => $value) { @@ -229,7 +229,7 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign { * @throws CiviCRM_API3_Exception * @throws Exception */ - public function create(bool $is_test = FALSE) { + public function create(bool $is_test = FALSE): array { // Create campaign only if this is not a test if (!$is_test) { @@ -345,7 +345,7 @@ class CRM_TwingleCampaign_BAO_TwingleProject extends Campaign { $this->values[$key] = $embedData[$key]; } } - + /** * Deactivate this TwingleProject campaign diff --git a/CRM/TwingleCampaign/Utils/ExtensionCache.php b/CRM/TwingleCampaign/Utils/ExtensionCache.php index dc2e7f8..ebcd978 100644 --- a/CRM/TwingleCampaign/Utils/ExtensionCache.php +++ b/CRM/TwingleCampaign/Utils/ExtensionCache.php @@ -74,6 +74,7 @@ class CRM_TwingleCampaign_Utils_ExtensionCache { protected function __clone() {} /** + * Returns a mapping of all custom field of the TwingleCampaign extension * @return array */ public function getCustomFieldMapping(): array {