Skip to content

Conversation

@einhverfr
Copy link
Member

@einhverfr einhverfr commented Jun 14, 2025

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.

einhverfr added 13 commits June 14, 2025 21:26
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.
@einhverfr einhverfr changed the base branch from master to 1.12 June 14, 2025 14:30
$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|;
Copy link
Member Author

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|;
Copy link
Member Author

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"});
Copy link
Member Author

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"});
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants