Further tweaks to contribution search recurring fields (@kirk-jackson)
authorMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Mon, 29 Oct 2018 21:34:10 +0000 (21:34 +0000)
committerMatthew Wire (MJW Consulting) <mjw@mjwconsult.co.uk>
Mon, 29 Oct 2018 21:34:10 +0000 (21:34 +0000)
CRM/Contribute/BAO/ContributionRecur.php
CRM/Contribute/BAO/Query.php
templates/CRM/Contact/Form/Search/Advanced.hlp
templates/CRM/Contribute/Form/Search/ContributionRecur.tpl

index 5c2e19ca8d01c04ac1ed3b4db827cef04be38cb0..f718538df26143a3ce787d203b061e02accc50c3 100644 (file)
@@ -762,6 +762,14 @@ INNER JOIN civicrm_contribution       con ON ( con.id = mp.contribution_id )
       }
     }
 
+    // If values have been supplied for recurring contribution fields, open the recurring contributions pane.
+    foreach (array('contribution_status_id', 'payment_processor_id', 'processor_id', 'trxn_id') as $fieldName) {
+      if (!empty($form->_formValues['contribution_recur_' . $fieldName])) {
+        $form->assign('contribution_recur_pane_open', TRUE);
+        break;
+      }
+    }
+
     // Add field to check if payment is made for recurring contribution
     $recurringPaymentOptions = array(
       1 => ts('All recurring contributions'),
index d07fea52ba7d57e2088b63cc044b46e16cf91f7e..abf05f7e7151b8f3e2a7018aab47d34487259fc6 100644 (file)
@@ -375,13 +375,25 @@ class CRM_Contribute_BAO_Query extends CRM_Core_BAO_Query {
         $query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
         return;
 
-      case 'contribution_recur_processor_id':
       case 'contribution_recur_payment_processor_id':
+        $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.payment_processor_id", $op, $value, "String");
+        $paymentProcessors = civicrm_api3('PaymentProcessor', 'get', array());
+        $paymentProcessorNames = array();
+        foreach ($value as $paymentProcessorId) {
+          $paymentProcessorNames[] = $paymentProcessors['values'][$paymentProcessorId]['name'];
+        }
+        $query->_qill[$grouping][] = ts("Recurring Contribution Payment Processor %1 %2", array(1 => $op, 2 => implode(', ', $paymentProcessorNames)));
+        $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
+        return;
+
+      case 'contribution_recur_processor_id':
       case 'contribution_recur_trxn_id':
         $fieldName = str_replace('contribution_recur_', '', $name);
         $query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.{$fieldName}",
           $op, $value, "String"
         );
+        $recurFields = CRM_Contribute_DAO_ContributionRecur::fields();
+        $query->_qill[$grouping][] = ts("Recurring Contribution %1 %2 '%3'", array(1 => $recurFields[$fieldName]['title'], 2 => $op, 3 => $value));
         $query->_tables['civicrm_contribution_recur'] = $query->_whereTables['civicrm_contribution_recur'] = 1;
         return;
 
index 153b8b05342fd961787544ad8ba1234f03e116b9..22e35e135337f2a6d0bb0e068748a6c8104b8fc0 100644 (file)
     <p>{ts}In the process of setting up CiviCRM components or configuring pages and profiles, you might have created test contributions, activities, participants, pledges, etc.{/ts}</p>
     <p>{ts}Once you have finished your testing, it is a good idea to clean up by finding your test records and deleting them.{/ts}</p>
 {/htxt}
+
+{htxt id="processor-id-title"}
+{ts}Processor ID{/ts}
+{/htxt}
+{htxt id="processor-id"}
+    <p>{ts}This is the payment processor's own ID for the recurring contribution. Ideally it should be unique, but in practice may not be.{/ts}</p>
+{/htxt}
+
+{htxt id="transaction-id-title"}
+{ts}Transaction ID{/ts}
+{/htxt}
+{htxt id="transaction-id"}
+    <p>{ts}Unique reference for the recurring contribution. May be made up of other fields, e.g. bank ID, account number, etc.{/ts}</p>
+{/htxt}
index 50f038c5c23ab5465daaab14a8904a5130293a72..921e40227cdecdd7b9e8bb169c8fc68156d4c431 100644 (file)
         </td>
       </tr>
       <tr>
-        <td>{ts}Transaction ID{/ts}</td>
+        <td>{ts}Processor ID{/ts} {help id="processor-id" file="CRM/Contact/Form/Search/Advanced"}</td>
         <td></td>
         <td col='span2'>
-          {$form.contribution_recur_trxn_id.html}
+          {$form.contribution_recur_processor_id.html}
         </td>
       </tr>
       <tr>
-        <td>{ts}Processor ID{/ts}</td>
+        <td>{ts}Transaction ID{/ts} {help id="transaction-id" file="CRM/Contact/Form/Search/Advanced"}</td>
         <td></td>
         <td col='span2'>
-          {$form.contribution_recur_processor_id.html}
+          {$form.contribution_recur_trxn_id.html}
         </td>
       </tr>
       {if $contributionRecurGroupTree}