Skip to content

Commit

Permalink
Allow contribution search by recurring payment processor ID / Transac…
Browse files Browse the repository at this point in the history
…tion ID
  • Loading branch information
mattwire committed Oct 7, 2018
1 parent bd3a955 commit 3c10f05
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CRM/Contribute/BAO/ContributionRecur.php
Original file line number Diff line number Diff line change
Expand Up @@ -780,9 +780,17 @@ public static function recurringContribution(&$form) {
array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search', 'options' => CRM_Contribute_PseudoConstant::contributionStatus())
);

$form->addElement('text', 'contribution_recur_processor_id', ts('Processor ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'processor_id'));
$form->addElement('text', 'contribution_recur_trxn_id', ts('Transaction ID'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionRecur', 'trxn_id'));

$paymentProcessorParams = [
'return' => ["id", "name", 'is_test'],
];
$paymentProcessors = civicrm_api3('PaymentProcessor', 'get', $paymentProcessorParams);
foreach ($paymentProcessors['values'] as $key => $value) {
$paymentProcessorOpts[$key] = $value['name'] . ($value['is_test'] ? ' (Test)' : '');
}
$form->add('select', 'contribution_recur_payment_processor_id', ts('Processor ID'), $paymentProcessorOpts, FALSE, ['class' => 'crm-select2', 'multiple' => 'multiple']);

CRM_Core_BAO_Query::addCustomFormFields($form, array('ContributionRecur'));

}
Expand Down
1 change: 1 addition & 0 deletions CRM/Contribute/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ public static function whereClauseSingle(&$values, &$query) {
return;

case 'contribution_recur_processor_id':
case 'contribution_recur_payment_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}",
Expand Down
16 changes: 15 additions & 1 deletion templates/CRM/Contribute/Form/Search/ContributionRecur.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,26 @@
</td>
</tr>
<tr>
<td>{ts}Recurring Contribution Status{/ts}</td>
<td>{ts}Status{/ts}</td>
<td></td>
<td col='span2'>
{$form.contribution_recur_contribution_status_id.html|crmAddClass:twenty}
</td>
</tr>
<tr>
<td>{ts}Payment Processor{/ts}</td>
<td></td>
<td col='span2'>
{$form.contribution_recur_payment_processor_id.html}
</td>
</tr>
<tr>
<td>{ts}Transaction ID{/ts}</td>
<td></td>
<td col='span2'>
{$form.contribution_recur_trxn_id.html}
</td>
</tr>
{if $contributionRecurGroupTree}
<tr>
<td colspan="4">
Expand Down

0 comments on commit 3c10f05

Please sign in to comment.