From b256b59fe5106b6dede6d12b3d7ef1ff2938556a Mon Sep 17 00:00:00 2001 From: "B. Endres" Date: Thu, 4 Jun 2020 10:48:56 +0200 Subject: [PATCH 1/2] [#27] added contact option --- CRM/Twingle/Form/Profile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/CRM/Twingle/Form/Profile.php b/CRM/Twingle/Form/Profile.php index 57bfa17..a38dc7e 100644 --- a/CRM/Twingle/Form/Profile.php +++ b/CRM/Twingle/Form/Profile.php @@ -372,6 +372,7 @@ class CRM_Twingle_Form_Profile extends CRM_Core_Form { 'recurring' => E::ts("Recurring Contribution"), 'membership' => E::ts("Membership"), 'mandate' => E::ts("SEPA Mandate"), + 'contact' => E::ts("Contacts (XCM)"), ], FALSE, // is not required ['class' => 'crm-select2 huge', 'multiple' => 'multiple'] From 1d2c66b375206c5ea3419d0350f54ed6ced1c4db Mon Sep 17 00:00:00 2001 From: "B. Endres" Date: Thu, 4 Jun 2020 10:52:11 +0200 Subject: [PATCH 2/2] [#27] remove campaign if it somehow got it before --- CRM/Twingle/Submission.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Twingle/Submission.php b/CRM/Twingle/Submission.php index 281545c..0daee20 100644 --- a/CRM/Twingle/Submission.php +++ b/CRM/Twingle/Submission.php @@ -369,13 +369,15 @@ class CRM_Twingle_Submission { * the twingle profile used */ public static function setCampaign(&$entity_data, $context, $submission, $profile) { + // first: make sure it's not set from other workflows + unset($entity_data['campaign_id']); + + // then: check if campaign should be set it this context $enabled_contexts = $profile->getAttribute('campaign_targets'); if ($enabled_contexts === null || !is_array($enabled_contexts)) { // backward compatibility: $enabled_contexts = ['contribution', 'contact']; } - - // check if campaign should be set it this context if (in_array($context, $enabled_contexts)) { // use the submitted campaign if set if (!empty($submission['campaign_id'])) {