Skip to content
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-19621 fix address field to show country & state. #9466

Merged
merged 2 commits into from
Nov 30, 2016

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Nov 29, 2016

@jitendrapurohit what about this - it reverses the form changes & moves all the handling to the format function (which we would ideally add a unit test for since that one is unit-testable)


@seamuslee001
Copy link
Contributor

@eileenmcnaughton this produces the following output on the confirm page

Seamus lee
xxxxx
Artarmon 1640 2064

@eileenmcnaughton
Copy link
Contributor Author

@seamuslee001 can you tell why - it is converting for me ... although on the last page I am getting abbreviations rather than full

$addressFields[$name] = CRM_Core_PseudoConstant::stateProvince($value);
}
if ($name == 'country') {
$addressFields[$name] = CRM_Core_PseudoConstant::country($value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This displays name instead of abbreviations for me too, maybe it should be stateProvinceAbbreviation() and countryIsoCode() call ?

Copy link
Contributor

@jitendrapurohit jitendrapurohit Nov 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test fail relates to the same behavour as I and @seamuslee001 are encountering?

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Nov 29, 2016

@eileenmcnaughton While working on QA, I see that names don't get displayed on the Confirm page if Paypal Express processor is being used. It is displayed if I keep #9399 in place. I thought of this approach while fixing the original issue, but felt that this would make the code redundant as this conversion is already happening in mapParams() function. So proceeded with making changes in Confirm.php.

Anyway, I agree with the concern that this may be more safer than the original PR as it works for Seamus too. If the above can be considered as trivial to be ignored, we can go ahead in merging this PR :-)

@eileenmcnaughton eileenmcnaughton force-pushed the address branch 2 times, most recently from 3e91c07 to 3986ed4 Compare November 30, 2016 05:20
@seamuslee001
Copy link
Contributor

Tested latest update from Eileen and fixes my issue with address state not being converted to abbreviation :-)

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@@ -360,6 +360,15 @@ public static function validateCreditCard($values, &$errors, $processorID = NULL
* @param bool $reverse
*/
public static function mapParams($id, $src, &$dst, $reverse = FALSE) {
// Set text version of state & country if present.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 can you check if it still works if I remove these lines again - my theory is they can go again now...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirm that works

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm now I'm a bit torn - do I introduce more risk if I remove them now? Probably not since @jitendrapurohit was ready to remove them before. Will wait on Jitendra's opinion

Copy link
Contributor

@jitendrapurohit jitendrapurohit Nov 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton Per my comments on #9399 (comment), I don't really think that removing this part will introduce any risk as it was moved from Confirm.php to here fixing some e-notices for country and state.

What makes me think is it has also been removed from Confirm.php now. But I've tested on the confirm and thankyou page and I didn't notice any errors. Also it has been tested by @seamuslee001, so I think we are good to go with the removal.

@eileenmcnaughton
Copy link
Contributor Author

@jitendrapurohit can you confirm whether my latest still fixes "Most things but not Payment Express". Depending on how thoroughly you test you might be able to confirm my theory that we no longer need those lines in the mapParams function.

There is a general need to keep testing different scenarios in 4.7 due to the changes in #9390 - I'm about to work on a bug in the receipt Karin identified. I think maybe variants on recurring membership & separate payment probably still need testing. Just mentioning all of this in case you can tie it into working on related issues....

Also, do you think we should put that price set js fix you did for Karin into the rc?

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Nov 30, 2016

@eileenmcnaughton I've tested this using the latest changes and it seems to be working fine except PayPal Express.

As we see the mapParams() function actually introduces a key of billing_state_province-$id and $alternateName holds a key check of 'billing_' . $name . '_id-' . $billingLocationTypeID seems to be the reason for Paypal Express not showing the names.

This can be fixed in mapParams(which seems to be riskier as it gets called on multiple places), can we add an extra check of 'billing_' . $name . '-' . $billingLocationTypeID (i.e without string _id) here in getFormattedBillingAddressFieldsFromParameters() function ?

@eileenmcnaughton
Copy link
Contributor Author

@jitendrapurohit I have altered the patch per your previous suggestion - I also removed the lines from mapParams - but maybe they DO need to be there?

@jitendrapurohit
Copy link
Contributor

jitendrapurohit commented Nov 30, 2016

@eileenmcnaughton I think this condition should be enclosed within brackets as it always evaluates to TRUE for $name='country' even when $value isn't numeric. This inturn doesn't display the country for paypal.

I've updated the PR with the commit. Can you please verify if it seems fine to you ?

Copy link
Contributor

@jitendrapurohit jitendrapurohit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this and all seems fine to me after the latest changes.

@eileenmcnaughton
Copy link
Contributor Author

test this please

@@ -359,7 +359,7 @@ public static function getFormattedBillingAddressFieldsFromParameters($params, $
$value = $params[$alternateName];
}
}
if (is_numeric($value) && $name == 'state_province' || $name == 'country') {
if (is_numeric($value) && ($name == 'state_province' || $name == 'country')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes! My bad

@seamuslee001
Copy link
Contributor

Jenkins re test this please

@eileenmcnaughton
Copy link
Contributor Author

Unrelated fail

@eileenmcnaughton eileenmcnaughton merged commit 091ad57 into civicrm:4.7.14-rc Nov 30, 2016
@eileenmcnaughton eileenmcnaughton deleted the address branch June 6, 2018 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants