CRM-15920 - CiviReport - Correctly suppress a value in the case of > 2 repeating...
authorJon goldberg <jon@palantetech.coop>
Fri, 6 Feb 2015 02:17:23 +0000 (21:17 -0500)
committerJon goldberg <jon@palantetech.coop>
Fri, 6 Feb 2015 02:17:23 +0000 (21:17 -0500)
CRM/Report/Form/Member/Detail.php

index 4fbe191e848e8a14c2ffc71981e3dc7411daefc0..f71767a3e05fb101bafedcff97e4b7c9190485f6 100644 (file)
@@ -402,18 +402,20 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
     $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument();
 
     CRM_Core_Error::debug('noRepeats',$this->_noRepeats);
+    $repeatFound = FALSE;
     foreach ($rows as $rowNum => $row) {
-
+      CRM_Core_Error::debug('repeatFound',$repeatFound . " " . $rowNum);
+      if ($repeatFound == FALSE ||
+        $repeatFound < $rowNum - 1
+      ) {
+        unset($checkList);
+        $checkList = array();
+      }
       if (!empty($this->_noRepeats) && $this->_outputMode != 'csv') {
         // not repeat contact display names if it matches with the one
         // in previous row
-        $repeatFound = FALSE;
         CRM_Core_Error::debug('checklist',$checkList);
         foreach ($row as $colName => $colVal) {
-          if ($repeatFound == FALSE) {
-            unset($checkList);
-            $checkList = array();
-          }
           if (in_array($colName, $this->_noRepeats) &&
             $rowNum > 0
           ) {
@@ -426,7 +428,7 @@ class CRM_Report_Form_Member_Detail extends CRM_Report_Form {
               if($colName == 'civicrm_contact_exposed_id') {
                 $rows[$rowNum]['civicrm_contact_sort_name'] = "";
               }
-              $repeatFound = TRUE;
+              $repeatFound = $rowNum;
             }
           }
           if (in_array($colName, $this->_noRepeats)) {