Adamw has submitted this change and it was merged.

Change subject: ThankYou Date is Optional
......................................................................


ThankYou Date is Optional

If thankyou_date is already set in a contribution ThankYou_send will not
send an email. In some cases we do not want to send an email, e.g. we got
a check; so we have to set this to something. This allows both cases.

Change-Id: Ie21bd84b1373836277046d8b6e2cdd74cad5125a
---
M .gitignore
M sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
2 files changed, 6 insertions(+), 1 deletion(-)

Approvals:
  Adamw: Verified; Looks good to me, approved



diff --git a/.gitignore b/.gitignore
index f1bc2fb..4302da2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 sites/default/civicrm.settings.php
 sites/default/settings.php
 sites/default/files
+.idea
diff --git a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
index 6264268..b853b81 100644
--- a/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_common/wmf_civicrm/wmf_civicrm.module
@@ -275,12 +275,16 @@
         'contribution_recur_id' => $recur_id,
         'check_number' => $msg['check_number'],
         'letter_code' => $msg['letter_code'],
-        'thankyou_date' => date( 'Y-m-d H:i:s', $msg['thankyou_date'] ),
 
         // API required fields
         'version' => '3'
     );
 
+    // Add the thank you date when it exists and is not null (e.g.: we're 
importing from a check)
+    if ( array_key_exists( 'thankyou_date', $msg ) && $msg[ 'thankyou_date' ] 
) {
+        $contribution[ 'thankyou_date' ] = date( 'Y-m-d H:i:s', 
$msg['thankyou_date'] );
+    }
+
     watchdog( 'wmf_civicrm', 'Contribution array for 
civicrm_contribution_add(): ' . print_r($contribution, TRUE), NULL, 
WATCHDOG_DEBUG);
 
     $contribution_result = civicrm_api( "Contribution", "Create", 
$contribution );

-- 
To view, visit https://gerrit.wikimedia.org/r/60354
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie21bd84b1373836277046d8b6e2cdd74cad5125a
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Mwalker <mwal...@wikimedia.org>
Gerrit-Reviewer: Adamw <awi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to