-
-
Notifications
You must be signed in to change notification settings - Fork 824
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-21478 Using contribution status id instead of label in if statement #11323
Conversation
@@ -65,7 +65,7 @@ | |||
<a class="button no-popup nowrap" | |||
href="{crmURL p='civicrm/contribute/invoice' q=$urlParams}"> | |||
<i class="crm-i fa-print"></i> | |||
{if $row.contribution_status != 'Refunded' && $row.contribution_status != 'Cancelled' } | |||
{if $row.contribution_status_id != 7 && $row.contribution_status_id != 3 } |
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.
I think the normal syntax would be neq
instead of !=
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.
Hmm - it always used to be that smarty writers used that format - then we discovered 'normal php' format worked & now it's pretty mixed. My preference is to migrate to this format on the basis it's more familiar to php / js writers and the smarty format is not really familiar to anyone
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.
Grepping *.tpl for contribution_status also found: https://github.com/civicrm/civicrm-core/blob/master/templates/CRM/Contribute/Form/ContributionView.tpl#L58
Can you update that too? And check if there is anywhere else.
@@ -74,7 +74,7 @@ | |||
{/if} | |||
</td> | |||
{/if} | |||
{if $defaultInvoicePage && $row.contribution_status == 'Pending (Pay Later)'} | |||
{if $defaultInvoicePage && $row.contribution_status_id == 2} |
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.
eq
instead of ==
@samuelsov this isn't the right fix - we are hard-coding statuses. I think the right fix is to ensure that the contribution_status.name field is assigned to the template & we check against that. My understanding is that only the label field is translated. If I'm wrong about that we have to resort to assigning $refundStatusId & $cancelledStatusID to the template. |
@eileenmcnaughton @samuelsov I was going to make the same comment about hardcoding status IDs, but then I grepped and saw that there were quite a few "contribution_status_id" hardcoded and wasn't sure if it was in scope for this PR. |
There is some risk if we merge this we fix it for some & break if for others. I know of one site off the top of my head that has a number other then 7 for refunded. I don't think we need to increase scope to fix all the hard-coded places though - although ideally we would at least add TODO comments into those locations |
@eileenmcnaughton Ok, i though IDs were the same on any CiviCRM instance but name is much better of course if it's available in this context. @mattwire ok for templates/CRM/Contribute/Form/ContributionView.tpl |
@eileenmcnaughton @mattwire ok, i have fixed the id vs name problem in the user dashboard but i'm not so keen on expanding the scope of this issue as i find more and more problems as i dig. I'd rather document what i see in a new issue and commit this one. |
I have opened a new issue for the remaining : https://issues.civicrm.org/jira/browse/CRM-21496 |
@samuelsov I haven't tested the patch but assuming contribution_status_name is set then it looks correct to me. And agree with raising a separate issue for the (similar) issues elsewhere. |
I just tested on local & this does not regress on a site in English so the name value is working. Merging |
CRM-21478 Using contribution status id instead of label in if statement
Overview
On localized site with payment status translated, the dashboard fail to display some useful information.
Before
After
Comments
Really minor changes that only impact this screen.