From: Matthew Wire (MJW Consulting) Date: Mon, 29 Oct 2018 21:34:10 +0000 (+0000) Subject: Further tweaks to contribution search recurring fields (@kirk-jackson) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=64127e0339f60318cf21424cbdd2a912310d36e4;p=civicrm-core.git Further tweaks to contribution search recurring fields (@kirk-jackson) --- diff --git a/CRM/Contribute/BAO/ContributionRecur.php b/CRM/Contribute/BAO/ContributionRecur.php index 5c2e19ca8d..f718538df2 100644 --- a/CRM/Contribute/BAO/ContributionRecur.php +++ b/CRM/Contribute/BAO/ContributionRecur.php @@ -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'), diff --git a/CRM/Contribute/BAO/Query.php b/CRM/Contribute/BAO/Query.php index d07fea52ba..abf05f7e71 100644 --- a/CRM/Contribute/BAO/Query.php +++ b/CRM/Contribute/BAO/Query.php @@ -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; diff --git a/templates/CRM/Contact/Form/Search/Advanced.hlp b/templates/CRM/Contact/Form/Search/Advanced.hlp index 153b8b0534..22e35e1353 100644 --- a/templates/CRM/Contact/Form/Search/Advanced.hlp +++ b/templates/CRM/Contact/Form/Search/Advanced.hlp @@ -111,3 +111,17 @@

{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}

{ts}Once you have finished your testing, it is a good idea to clean up by finding your test records and deleting them.{/ts}

{/htxt} + +{htxt id="processor-id-title"} +{ts}Processor ID{/ts} +{/htxt} +{htxt id="processor-id"} +

{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}

+{/htxt} + +{htxt id="transaction-id-title"} +{ts}Transaction ID{/ts} +{/htxt} +{htxt id="transaction-id"} +

{ts}Unique reference for the recurring contribution. May be made up of other fields, e.g. bank ID, account number, etc.{/ts}

+{/htxt} diff --git a/templates/CRM/Contribute/Form/Search/ContributionRecur.tpl b/templates/CRM/Contribute/Form/Search/ContributionRecur.tpl index 50f038c5c2..921e40227c 100644 --- a/templates/CRM/Contribute/Form/Search/ContributionRecur.tpl +++ b/templates/CRM/Contribute/Form/Search/ContributionRecur.tpl @@ -85,17 +85,17 @@ - {ts}Transaction ID{/ts} + {ts}Processor ID{/ts} {help id="processor-id" file="CRM/Contact/Form/Search/Advanced"} - {$form.contribution_recur_trxn_id.html} + {$form.contribution_recur_processor_id.html} - {ts}Processor ID{/ts} + {ts}Transaction ID{/ts} {help id="transaction-id" file="CRM/Contact/Form/Search/Advanced"} - {$form.contribution_recur_processor_id.html} + {$form.contribution_recur_trxn_id.html} {if $contributionRecurGroupTree}