-
-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-21354 : Allow "Advanced Search" to search for recurring contribution status. #11080
CRM-21354 : Allow "Advanced Search" to search for recurring contribution status. #11080
Conversation
Can one of the admins verify this patch? |
Jenkins ok to test |
Jenkins ok to retest |
// Add field for contribution status | ||
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); | ||
$form->addSelect('contribution_recur_contribution_status_id', | ||
array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search', 'options' => $contributionStatus) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you directly use the function in options
i.e.
..., 'options' => CRM_Contribute_PseudoConstant::contributionStatus()
because $contributionStatus isn't used anywhere else.
CRM/Contribute/BAO/Query.php
Outdated
case 'contribution_recur_contribution_status_id': | ||
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.contribution_status_id", $op, $value, 'String'); | ||
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionRecur', 'contribution_status_id', $value, $op, $pseudoExtraParam); | ||
$query->_qill[$grouping][] = ts('%1 %2 %3', array(1 => 'Recurring Contribution Status', 2 => $op, 3 => $value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @waddyvic 👍 Apart from the two changes I have mentioned in the patch, I need point out some general issue with this PR:
|
Hey @monishdeb thx for reviewing my PR. To respond to your previous comments:
|
|
||
// Add field for contribution status | ||
$form->addSelect('contribution_recur_contribution_status_id', | ||
array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search', 'options' => CRM_Contribute_PseudoConstant::contributionStatus() ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the related test build failure https://test.civicrm.org/job/CiviCRM-Core-PR/17604/checkstyleResult/new/
It says There should be no white space before a closing ")"
so I would say that's a style error. As per coding standard there shouldn't be any trailing space before/after parenthesis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOL my supervisor had his own coding guidelines which goes against the community. It's fixed now.
|
||
// Add field for contribution status | ||
$form->addSelect('contribution_recur_contribution_status_id', | ||
array('entity' => 'contribution', 'multiple' => 'multiple', 'context' => 'search', 'options' => CRM_Contribute_PseudoConstant::contributionStatus()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops you left a comma ...CRM_Contribute_PseudoConstant::contributionStatus()),
at then end. Causes test failure again :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like I need to install PHP code sniffer after all
Hi @monishdeb, I've added a unit test for the recurring contribution status search field. I'm still waiting for my account on issues.civicrm.org approved, so couldn't create an issue on there yet. I couldn't find how to contact the site's admin to approve my registration. Do you have any lead on this? |
@waddyvic any luck? Or can you ask in mattermost dev-channel https://chat.civicrm.org/civicrm/channels/dev to approve your JIRA account |
@monishdeb Still waiting. I've joined mattermost to ask for help. |
@monishdeb OK got it sorted out. issue number is CRM-21354 |
CRM/Contribute/BAO/Query.php
Outdated
case 'contribution_recur_contribution_status_id': | ||
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution_recur.contribution_status_id", $op, $value, 'String'); | ||
list($op, $value) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contribute_DAO_ContributionRecur', 'contribution_status_id', $value, $op, $pseudoExtraParam); | ||
$query->_qill[$grouping][] = ts("%1 %2 '%3'", array(1 => 'Recurring Contribution Status', 2 => $op, 3 => $value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change it to
$query->_qill[$grouping][] = ts("Recurring Contribution Status %1 '%2'", array(1 => $op, 2 => $value));
Great.. one last change. Can you squash your 8 commits into 1? Here's the steps:
|
…ecurring contribution status(es). CRM_Contribute_BAO_ContributionRecur: add multi-select dropdown field to select recurring contribution status. CRM_Contribute_BAO_Query: add case to construct where clause for recurring contribution status. templates/CRM/Contribute/Form/Search/ContributionRecur.tpl: add recurring contribution status field in template. #11080 Add quotes around recurring contribution status qill. #11080 Directly use CRM_Contribute_PseudoConstant::contributionStatus() instead of creating variable that is not used anywhere else. Remove space after closing ) to comply with coding standard Remove comma after closing ) to comply with coding standard Add unit test for recurring contribution status filter Fix coding style error: The closing brace for the class must have an empty line before it Do not use variable replacement in qill for static text "Recurring Contribution Status".
Hi @monishdeb , I did what you requested and it's pushed now. |
Perfect 👍 Tested the latest patch and it worked for me. Happy with the final patch. Hence merging. |
Congrats @waddyvic .. Keep up the good work :D |
Thx for all your help on this @monishdeb |
…status CRM-21354 : Allow "Advanced Search" to search for recurring contribution status.
Overview
Advanced search wasn't capable of searching for contacts with a specific recurring contribution status. I've added this field in Advanced Search to find people that are currently a monthly donors (status In Progress) or has been a monthly donors before (status "Cancelled" or "Completed").