Skip to content

Commit

Permalink
Merge pull request #558 from jaapjansma/dev_555-2
Browse files Browse the repository at this point in the history
Fixed next execution time
  • Loading branch information
bjendres authored Dec 11, 2019
2 parents f4f1897 + d264789 commit be63d1c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions CRM/Sepa/Logic/Batching.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ static function updateRCUR($creditor_id, $mode, $now = 'now', $offset=NULL, $lim

$sql_query = "
SELECT
contribution.contribution_recur_id AS contribution_recur_id,
contribution.contribution_recur_id AS contribution_recur_id,
contribution.id AS contribution_id
FROM civicrm_contribution contribution
LEFT JOIN civicrm_sdd_contribution_txgroup ctxg ON ctxg.contribution_id = contribution.id
LEFT JOIN civicrm_sdd_txgroup txg ON txg.id = ctxg.txgroup_id
FROM civicrm_contribution contribution
LEFT JOIN civicrm_sdd_contribution_txgroup ctxg ON ctxg.contribution_id = contribution.id
LEFT JOIN civicrm_sdd_txgroup txg ON txg.id = ctxg.txgroup_id
WHERE contribution.contribution_recur_id IN ({$rcontrib_id_strings})
AND DATE(contribution.receive_date) = DATE('{$collection_date}')
AND (txg.type IS NULL OR txg.type IN ('RCUR', 'FRST'))
Expand Down Expand Up @@ -584,12 +584,12 @@ public static function getNextExecutionDate($rcontribution, $now, $FRST = FALSE)
$return_date = date('Y-m-d', $next_date);

// Call a hook so extensions could alter the next collection date.
CRM_Utils_SepaCustomisationHooks::alter_next_collection_date($next_date, $rcontribution);
if (!empty($rcontribution['end_date']) && strtotime($rcontribution['end_date'])<$next_date) {
CRM_Utils_SepaCustomisationHooks::alter_next_collection_date($return_date, $rcontribution);
if (!empty($rcontribution['end_date']) && strtotime($rcontribution['end_date']) < strtotime($return_date)) {
return NULL;
}
// ..or the cancel_date
if (!empty($rcontribution['cancel_date']) && strtotime($rcontribution['cancel_date'])<$next_date) {
if (!empty($rcontribution['cancel_date']) && strtotime($rcontribution['cancel_date']) < strotime($next_date)) {
return NULL;
}

Expand Down

0 comments on commit be63d1c

Please sign in to comment.