-
-
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
dev/financial#109 Fix country/province assignation in the contribution invoice #15964
Conversation
(Standard links)
|
d870c86
to
5fc4ca7
Compare
@@ -495,15 +495,16 @@ public static function &getValues($entityBlock, $microformat = FALSE, $fieldName | |||
if (!empty($address->state_province_id)) { | |||
$address->state = CRM_Core_PseudoConstant::stateProvinceAbbreviation($address->state_province_id, FALSE); | |||
$address->state_name = CRM_Core_PseudoConstant::stateProvince($address->state_province_id, FALSE); | |||
$values['state_province_abbreviation'] = $address->state; |
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 which one is meant to be the abbreviation?
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.
@seamuslee001 oops, good catch, auto-complete typo (fixed). I guess that would be a good use-case for a test?
2e03af8
to
ccf3af0
Compare
@mlutfy I feel like this is stuck on not having a test |
test this please |
Betty and I are reviewing PR's and we came across this one.
@eileenmcnaughton or @mattwire is one of you able to merge this PR? |
I still need to add a test, alas. It's high on my list, and quickfix, hoping to do it soon. |
Our opinion is that this doesn't necessarily needs a test. But a test makes it a surplus |
Test cover on everything to do with invoice code is awful - so I'm loathe to let anything be changed on the invoice code without tests. Generally in an area like this with no tests I consider a 'no error' test to be enough - ie. a test that calls printPDF with no fatal errors - whether or not it tests the change being made. In this case it is progress on testing in that area |
I can confirm that this patch enables the {$country} token in the invoice template |
I added a test to check the province/abbreviation in getValues(), and I will add a test for the invoice itself in a separate PR, that will pass once #16569 is merged. |
Nice, thanks @mlutfy |
Thanks, I am using the {$country) token in the updated Contribution Invoice template (#16680) |
Overview
To reproduce:
{$country}
(other related contact tokens are called{$street_address}
,{$email}
, etc.The country will be empty.
https://lab.civicrm.org/dev/financial/issues/109
Technical Details
CRM_Contribute_Form_Task_Invoice
: I did a bit of code cleanup because the invoice code did not make a ton of sense, and presumablyCRM_Core_BAO_Address::getValues()
has changed a fair amount since this invoice code was first written. Notably the loop for finding the billing address seemed over-complex.CRM_Contribute_Form_Task_Invoice
also had an array forbillingAddress
, which hinted that there could be something more going on, but given that the variable is initialized inside the loop, I could not figure out its purpose.