Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/303598

Change subject: Fix recurring contribution update bugs
......................................................................

Fix recurring contribution update bugs

Don't clobber the currency on edit, look at the right data for
next_sched manipulation.

See pull request https://github.com/civicrm/civicrm-core/pull/8840

Bug: T142312
Change-Id: Iaaff16ffe7d9c8a8769661a313474b103f43850d
---
M CRM/Contribute/BAO/ContributionRecur.php
1 file changed, 4 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm 
refs/changes/98/303598/1

diff --git a/CRM/Contribute/BAO/ContributionRecur.php 
b/CRM/Contribute/BAO/ContributionRecur.php
index 42ac17c..77f841c 100644
--- a/CRM/Contribute/BAO/ContributionRecur.php
+++ b/CRM/Contribute/BAO/ContributionRecur.php
@@ -85,7 +85,7 @@
     $recurring->id = CRM_Utils_Array::value('id', $params);
 
     // set currency for CRM-1496
-    if (!isset($recurring->currency)) {
+    if (empty($params['id']) && !isset($recurring->currency)) {
       $config = CRM_Core_Config::singleton();
       $recurring->currency = $config->defaultCurrency;
     }
@@ -861,9 +861,9 @@
       $params['contribution_status_id'] = 'Completed';
     }
     else {
-      // Only update next sched date if it's empty or 'just now' because 
payment processors may be managing
-      // the scheduled date themselves as core did not previously provide any 
help.
-      if (empty($params['next_sched_contribution_date']) || 
strtotime($params['next_sched_contribution_date']) ==
+      // Only update next sched date if it's empty or not in the future 
because payment processors
+      // may be managing the scheduled date themselves as core did not 
previously provide any help.
+      if (empty($existing['next_sched_contribution_date']) || 
strtotime($existing['next_sched_contribution_date']) <=
         strtotime(date('Y-m-d'))) {
         $params['next_sched_contribution_date'] = date('Y-m-d', strtotime('+' 
. $existing['frequency_interval'] . ' ' . $existing['frequency_unit']));
       }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaff16ffe7d9c8a8769661a313474b103f43850d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to