-
-
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-21343: Add cancel filters for Contribution search #11189
Conversation
Can one of the admins verify this patch? |
Jenkins ok to test |
@monishdeb regarding UT, the issue is that the demo database doesn't have any Canceled Contribution. |
@sluc23 true. You might have noticed that in order to write UT for card-type filter, first a dummy contribution is created using card type - see https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/CRM/Contribute/Form/SearchTest.php#L218 So, in this case, you need to create a dummy canceled contribution(s) using Contribution.create API. Hint: public function testCancelReasonFilter() {
$contactID = $this->individualCreate();
$this->contributionCreate(array( // this is a helper fn provided by Civi UT to create dummy contribution or if you don't like it use civicrm_api3('contribution', 'create', $params) instead
'contact_id' => $contactID,
'contribution_status_id' => 'Cancelled',
'cancel_reason' => 'oops transaction failed',
'cancel_date' => date('YmdHis'),
));
...
} Hope this helps :) |
@monishdeb regarding your 1. before doing the commits, you think this looks better? At the right of Currency field there is a conditional Batch field which is not always shown (like in my screenshot), so it is not easy to move both fields at the right column, at the same level of Currency |
@sluc23 sorry for late reply. Can you bring 'Personal Campaign Page' in right and below of 'Personal Campaign Page Honor Roll?' field. In that the 2 PCP fields will be rendered jointly and this will adjust the space well. What you say? |
@monishdeb like this? Anyway the layout of this form is not very user friendly, many controls/labels are not aligned, not very intuitive to find fields.. I think some cosmetic adjustments would be nice to have to make this form look better, what do you think? |
I agree, but I'ld prefer to create a separate issue for that because I think the required change in tpl will be big and doesn't fit in the purpose of this issue. Back to the screenshot, I like the view now, but will it be a simple fix to remove space above currency field? |
@monishdeb @sluc23 while we are at moving around stuf, we should move the currency all the way up next to Contribution Amounts since it belongs there IMO. What do you guys think? |
@yashodha @monishdeb something like this? |
Yeah, it looks good now. :) |
CRM/Contribute/BAO/Query.php
Outdated
case 'contribution_cancel_date_high_time': | ||
// process to / from date | ||
$query->dateQueryBuilder($values, | ||
'civicrm_contribution', 'contribution_cancel_date', 'cancel_date', 'Contribution Cancel Date' |
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 wrap "Contribution Cancel Date" in ts()
? -- and also the 2-3 other occurrences of dateQueryBuilder()
which should have been wrapped as well.
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.
.. and possibly use the same label as "Cancelled / Refunded Date"? (This is shown in the search results, I think?)
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.
@mlutfy sure.. what do you think about here (line 1066):
// we only have recurring dates using this ATM so lets' short cut to find the table name
$table = 'contribution_recur';
$fieldName = explode($table . '_', $field);
$query->dateQueryBuilder($values,
'civicrm_' . $table, $field, $fieldName[1], $title
);
return TRUE;
}
should I wrap it as
$query->dateQueryBuilder($values,
'civicrm_' . $table, $field, $fieldName[1], ts($title)
);
?
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.
@sluc23 No, because gettext/civistrings uses the ts()
function to detect which strings to extract (to send to Transifex). So while ts($title)
would send the text through gettext, the actual string would not be present in the translation dictionary.
In other words, ts()
means:
- "lookup this string in the translation dictionary (civicrm.mo)"
- "and send this string to Transifex".
Hence a string must not include a variable, since we do not know what the value of the variable is during extraction time (which is done as a c-i process outside program execution).
@monishdeb looks like you have mostly reviewed this? |
@eileenmcnaughton yes and I am happy with the patch. @sluc23 did really good job in addressing all the additional issues raised during QA. Only thing remaining to get this PR merged is adding new/extended-existing UT on those two new search filters. @sluc23 are you going to add UT? Please ping me on mattermost (alias @Monish) if you need my help :) |
CRM-21478 Using contribution status id instead of label in if statement
Changed direct access to $currentOption array by using the CRM_Utils_Array::value() wrapper, so no notices are issued.
…-empty-visibility CRM-21328: Remove '-select-' Option From Visibility
CRM-21342 - Contribution note is not wiped if the value is removed
CRM-21471 remove unused core function CRM_Core_Pseudoconstant::greeti…
CRM-21433: Optimize dupe checking in Recent Items stack
…n_recurring_detail CRM-21504 Add membership to recurring contribution detail
---------------------------------------- * CRM-21050: credit card invoice: receive time set to 12:00 https://issues.civicrm.org/jira/browse/CRM-21050
CRM-21050: Use datepicker for all date fields used in contribution backoffice form
Fix unit test failure
CRM-21554 Offline Credit Card Membership Renewal not showing any error message on failure
…tus-of-linked-cases CRM-21498: Implement Option to Change Status of Linked Cases
…ages was not set.
…t doesn't match the initial contribution
…ages was not set (adds unit-test fix by Monish Deb)
CRM-21609 - Correctly handle PayPalPro recurring payments whose amoun…
---------------------------------------- * CRM-21644: Preferred Communication Method is not set to default for contact https://issues.civicrm.org/jira/browse/CRM-21644
CRM-21627: makeMultilingual: update dbLocale to avoid fatal if lcMessages was not set
CRM-21644, Fixed set default for Preferred Communication Method
@monishdeb I've added unit test, and rebased into master. any clue? |
@sluc23 you might have git pull in an attempt to doing rebase, reason why you lots of false commits in your PR. Can you create a new PR and close this one? |
In general to rebase I do git pull --rebase origin master & then I do a second one git pull -i origin/master (the second one allows for squashing of commits & tweaking commit messages) You need to use the -f switch when you push git push -f myrepo CRM-21343 |
New PR created --> #11638 |
Overview
Add cancel reason and cancel date filters in Contribution search form
https://issues.civicrm.org/jira/browse/CRM-21343
Before
No cancel reason or cancel date fields in the form to be used as contribution filters
After