paycollect.pl 100 error => sprintf( 'You must pay a value less than or equal to %f.2', $total_due ) Message is shown when you pay a fine and enter a value that is bigger than the totel due: You must pay a value less than or equal to 5.000000.2 Message is not translatable. Also the fine amount is formatted incorrectly.
Created attachment 13665 [details] [review] [PATCH] Bug 9141 - Untranslatable strings on "pay an amount..." page Moving text of an error message from the script into the template. To test, submit an amount which is greater than the amount due. You should see an error message displayed correctly with a properly-formatted currency amount.
Created attachment 13857 [details] [review] [SIGNED-OFF] Bug 9141 - Untranslatable strings on "pay an amount..." page Moving text of an error message from the script into the template. To test, submit an amount which is greater than the amount due. You should see an error message displayed correctly with a properly-formatted currency amount. Signed-off-by: Marc Veron <veron@veron.ch> Patch behaves as expected.
QA comment: tiny patch, but I think it could be even simpler. Instead of using a error_over => 1, why not use total_due = -[% IF ( error ) %] +[% IF (total_due > 0 ) %] should achieve the same result, isn't it ? In this case the patch would just be: -[% IF ( error ) %] +[% IF (total_due > 0 ) %] - [% error %] + You must pay a value less than or equal to [% total_due | format('%.2f') %]. - error => sprintf( 'You must pay a value less than or equal to %f.2', - $total_due ) + total_due => $total_due Your opinion ?
(In reply to comment #3) > Your opinion ? ping...
(In reply to comment #3) > Your opinion ? Your version is simpler, but I think what we lose is the readability of the template. Seeing that an error message is displayed if total_due > 0 doesn't mean anything unless you examine the script and see under what condition the variable is being set. The more verbose version makes it clear that the script sets an error variable. I don't think it's a big deal, but I prefer my version.
I agree with Owen.
QA Comments: With the agreement of Paul, I pass qa on this patch. Works as expected.
Created attachment 14418 [details] [review] Bug 9141 - Untranslatable strings on "pay an amount..." page Moving text of an error message from the script into the template. To test, submit an amount which is greater than the amount due. You should see an error message displayed correctly with a properly-formatted currency amount. Signed-off-by: Marc Veron <veron@veron.ch> Patch behaves as expected. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch has been pushed to master.
Pushed to 3.10.x and 3.8.x