Fixed issue with max_failure calculation
authorRuben Rodriguez <ruben@fsf.org>
Mon, 20 Mar 2017 19:36:48 +0000 (15:36 -0400)
committerRuben Rodriguez <ruben@fsf.org>
Mon, 20 Mar 2017 19:36:48 +0000 (15:36 -0400)
trustcommerceIPN.php

index 4f92bc65bad62d63906b74a92e8d607620a599e2..639a3a7387905a479733daa62a814477b07dbffa 100644 (file)
@@ -183,6 +183,7 @@ class CRM_Core_Payment_trustcommerce_IPN extends CRM_Core_Payment_BaseIPN {
     return $id;
   }
   protected function processRecur($input, $ids, $objects, $first) {
+    $lastfailures = $this->getLastFailures($ids['contributionRecur']);
     $recur = &$objects['contributionRecur'];
     $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
 
@@ -285,7 +286,7 @@ class CRM_Core_Payment_trustcommerce_IPN extends CRM_Core_Payment_BaseIPN {
       $input['skipComponentSync'] = 1;
 
       /* Action for repeated failures */
-      if(MAX_FAILURES <= $this->getLastFailures($ids['contributionRecur'])) {
+      if(MAX_FAILURES <= $lastfailures) {
        //$this->disableAutoRenew(($ids['contributionRecur']));
        $this->disableAutorenew($ids['processor_id']);
       }