-
-
Notifications
You must be signed in to change notification settings - Fork 163
Fix overpayments 1.12 #8901
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
base: 1.12
Are you sure you want to change the base?
Fix overpayments 1.12 #8901
Conversation
This mostly changes the way that certain data structures are interacted with, avoiding long calls when shorter refereces are possible. This commit does not yet fix any bugs and behaves identical to the code before this commit. However, it ensures that bugs can be fixed after.
The code is extremely complex for what it does. PLEASE NOTE: this does mess with localization with two strings in warnings in the use overpayment workflow. However not only was this workflow broken but the use of the translation API was also broken and therefore I do not believe this should prevent backporting.
Prior to this, the repeatedly updating the overpayment screen would eventually pass in an array as invoice date, and the amount due would be lost.
This fixes an unexpected blank line in the invoice search workflow.
This involved some further simplifying of the code in areas where there were some past bugs. Not sure exactly what the problem was, but it is now fixed. Now Cucumber tests are needed.
| $Payment->{"amount_$count"}; | ||
| if($invoice_id_amount_to_pay{qq|$Payment->{"invoice_id_$count"}|} | ||
| > $applied_due) { | ||
| $warning .= $locale->text('The amount of the invoice number').qq| $Payment->{"invnumber_$count"} |.$locale->text('is lesser than the amount to be paid').qq|\n|; |
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.
This use of $locale->text is so fundamentally broken I don't see a problem with introducing a new untranslated string in its place.
| # ojo no me gusta como esta implementado | ||
| ################################################################### | ||
| if($Payment->{"amount_$count"} < 0){ | ||
| $warning .= $locale->text('The amount of the invoice number').qq| $Payment->{"invnumber_$count"} |.$locale->text('is lesser than 0').qq|\n|; |
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.
Also fundamentally broken.....
| $amount_to_be_used{$ovp_selected_accno} += $Payment->{"amount_$count"}; | ||
|
|
||
| if($Payment->{"amount_$count"} > $applied_due) { | ||
| $warning .= $locale->text('The amount of the invoice number [_1] is less than the amount to be paid.', $Payment->{"invnumber_$count"}); |
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.
This is the first replacement which is untranslated
| } | ||
|
|
||
| if($Payment->{"amount_$count"} < 0){ | ||
| $warning .= $locale->text('The amount of the invoice number [_1] is less than 0', $Payment->{"invnumber_$count"}); |
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.
This is the second replacement which is untranslated.
This fixes all immediately known bugs with using overpayments/prepayments.
Please note -- there are two cases where current translation of strings is broken by this patch. This is because there were two uses of translation which concatenated variables and then concatenated further translated strings. This is fundamentally incorrect and leads to broken translations even without these changes. I am adding comments in line to point these out. If the consensus is better not to backport these, I will revert those lines specifically.