Awight has uploaded a new change for review.

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

Change subject: Fix timezone bug in next_sched search
......................................................................

Fix timezone bug in next_sched search

This bug would prevent any self-recurrence for <tzoffset> hours
per day, by scanning a next_sched range which did not include the
current day.

Change-Id: Ib17a8383ca7e3824e1f051f56be1237756cabd55
---
M sites/all/modules/wmf_civicrm/recurring.inc
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/65/150165/1

diff --git a/sites/all/modules/wmf_civicrm/recurring.inc 
b/sites/all/modules/wmf_civicrm/recurring.inc
index f8d6e5b..e5a6eec 100644
--- a/sites/all/modules/wmf_civicrm/recurring.inc
+++ b/sites/all/modules/wmf_civicrm/recurring.inc
@@ -176,6 +176,7 @@
  * - date           string    Uses strtotime() to parse the date
  * - $limit         integer   Number of records to pull. Default is 1.
  * 
+ * TODO: other gateways than GC
  * @todo The field `civicrm_payment_processor`.`payment_processor_type` should 
be set.
  * @todo Implement $contributionStatus = 
CRM_Contribute_PseudoConstant::contributionStatus( null, 'name' );
  * 
@@ -183,6 +184,9 @@
  */
 function wmf_civicrm_get_next_sched_contribution($limit = 1, $date = 'now', 
$run_missed_days = 0)
 {
+    $oldTimezone = date_default_timezone_get();
+    date_default_timezone_set( "UTC" );
+
     $date = date('Y-m-d', strtotime($date));
     
     $start_day = $date . ' 00:00:00';
@@ -197,6 +201,8 @@
         
         $start_day = date('Y-m-d 00:00:00', strtotime($decrement_date, 
$start_day_stamp));
     }
+
+    date_default_timezone_set( $oldTimezone );
     
     $contribution_status_id = civicrm_api_contribution_status('Completed');
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib17a8383ca7e3824e1f051f56be1237756cabd55
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <awi...@wikimedia.org>

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

Reply via email to