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-19963 - Use translated processor name for Paypal in all comparisons #9779

Merged
merged 1 commit into from
Jun 11, 2017

Conversation

rthouvenin
Copy link
Contributor

@rthouvenin rthouvenin commented Feb 3, 2017

I guess a better would idea would be not to use a translatable string as identifier, but this is a bigger change and I was not sure of the consequences. This small patch makes sure PayPal works in all languages (problem noticed in German).


@civicrm-builder
Copy link

Can one of the admins verify this patch?

@eileenmcnaughton
Copy link
Contributor

This seems OK to me - but you will need to create a new PR against master. The process is that we fork for the rc & from that point on we only permit new PRs into the rc if they address a new regression in the rc. If in doubt always do your PR against master.

@eileenmcnaughton
Copy link
Contributor

NB - it seems that if we are having to consider translation we are probably comparing against the wrong field?

@rthouvenin rthouvenin changed the base branch from 4.7.16-rc to master February 6, 2017 08:49
@rthouvenin
Copy link
Contributor Author

Thanks @eileenmcnaughton .
Instead of creating a new PR, I rebased my branch and changed the target of the PR so that we keep this discussion. But now I realise the label 4.7.16-rc should be removed. Can this be done, or should I just scrap this and open a new PR?

Regarding comparing against the wrong field: I agree, this was the essence of my description of the PR, but like I said I am not familiar enough with the codebase to evaluate what are all the places where this comparison is done and needs to be changed.

@eileenmcnaughton
Copy link
Contributor

Just thinking about this - this is one of those types of fixes that could have unintended consequences and the one I'm wondering about is a translated site which has not translated the processor names. Does it make sense to be if( $name = ts($paymentProcessorName) || $paymentProcessorName)

@eileenmcnaughton
Copy link
Contributor

Just looking I think the 'right' fix would be to add a label field to the payment_processor table & make 'name' not translated

@rthouvenin
Copy link
Contributor Author

I think the case of a translated site with no translation for processor names would already have similar issues. It doesn't show on the diff of this PR, but there are other such comparisons of processor names, and they do use the translated string. For example: https://github.com/WeMoveEU/civicrm-core/blob/aef7f33ad79a6868f684fa89617d10183c090575/CRM/Core/Payment/PayPalImpl.php#L1065

See also the assignments in the constructor of the class.
Actually, maybe an easier 'right' fix would be to use the same comparison as the constructor, everywhere.

@totten
Copy link
Member

totten commented Jun 11, 2017

I had the same initial reaction as eileen ("does it make sense to be if( $name = ts($paymentProcessorName) || $paymentProcessorName"). But a quick grep confirms @rthouvenin's points. To wit, here's a grep on status-quo code:

$ rgrep _processorName CRM
...
CRM/Core/Payment/PayPalImpl.php:    if ($this->_processorName == ts('PayPal Express') || $this->_processorName == ts('PayPal Pro')) {
CRM/Core/Payment/PayPalImpl.php:    if ($this->_processorName == 'PayPal Express' || $this->_processorName == 'PayPal Pro') {

You can't serve both -- one is right, one is wrong. The ts() version looks right (based on skimming the other grep outputs), and this PR makes the two checks the same.

@totten totten merged commit 2aa6dd3 into civicrm:master Jun 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants