Bug 21167

Summary: Price should be correctly formatted on printed fee receipt and invoice
Product: Koha Reporter: Barton Chittenden <barton>
Component: Fines and feesAssignee: Katrin Fischer <katrin.fischer>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: bibliwho, black23, edischer, fridolin.somers, jonathan.druart, josef.moravec, martin.renvoize, nick
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21454
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Screenshot from Home › Patrons › Account
Bug 21167: Fix price formatting on printed fee invoice and receipt
Bug 21167
Bug 21167: Fix price formatting on printed fee invoice and receipt
Bug 21167: Fix price formatting on printed fee invoice and receipt
Bug 21167: Fix price formatting on printed fee invoice and receipt
Bug 21167 (QA follow-up) Fix amount formatting on invoice receipt
Bug 21167: (QA follow-up) Fix amount formatting on invoice receipt
Bug 21167: (QA follow-up) Use accounttype.inc for generating account description
Bug 21167: Fix price formatting on printed fee invoice and receipt
Bug 21167: (QA follow-up) Fix amount formatting on invoice receipt
Bug 21167: (QA follow-up) Use accounttype.inc for generating account description

Description Barton Chittenden 2018-08-06 22:40:52 UTC
To re-create:

create a fine or a fee of 5.00.

Go to Home › Patrons › Account

Click the print button.

The line that says 'Payment, thanks' has an amount of '5' rather than '5.00'
Comment 1 Barton Chittenden 2018-08-06 22:42:51 UTC
Created attachment 77518 [details]
Screenshot from Home › Patrons › Account
Comment 2 Katrin Fischer 2018-08-08 21:36:07 UTC
Created attachment 77596 [details] [review]
Bug 21167: Fix price formatting on printed fee invoice and receipt

The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown
Comment 3 Cab Vinton 2018-08-28 01:22:24 UTC
Unable to duplicate the issue in Biblibre Sandbox 7 (see attachment).
Comment 4 Cab Vinton 2018-08-28 01:29:33 UTC
Created attachment 78209 [details]
Bug 21167

Unable to duplicate. Perhaps not printing correct invoice/ receipt?
Comment 5 Katrin Fischer 2018-08-28 05:54:11 UTC
Hi Cab, you printed the account summary. Try the printing links next to payments and created fees/fines fees in the fines table.
Comment 6 Cab Vinton 2018-08-28 13:10:50 UTC
Let me know if I should be changing status (Patch doesn't apply? Failed QA?)

Tested in PTFS Sandbox 0. Biblibre sandboxes are failing silently :-(

<h1>Something went wrong !</h1>Applying: Bug 21167: Fix price formatting on printed fee invoice and receipt
error: Failed to merge in the changes.
Using index info to reconstruct a base tree...
M       koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
M       koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
Patch failed at 0001 Bug 21167: Fix price formatting on printed fee invoice and receipt
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem run git bz apply --continue.
If you would prefer to skip this patch, instead run git bz apply --skip.
To restore the original branch and stop patching run git bz apply --abort.
Bug 21167 - Correct price formatting on printed fee receipt and invoice

77596 - Bug 21167: Fix price formatting on printed fee invoice and receipt

Apply? [(y)es, (n)o, (i)nteractive] Patch left in /tmp/Bug-21167-Fix-price-formatting-on-printed-fee-invo-0XLKVz.patch .
Comment 7 Michal Denar 2018-09-14 12:36:43 UTC
Please rebase on master.

M	koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt

Thanks

Mike
Comment 8 Katrin Fischer 2018-09-16 00:45:53 UTC
Created attachment 78919 [details] [review]
Bug 21167: Fix price formatting on printed fee invoice and receipt

The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown
Comment 9 Katrin Fischer 2018-09-16 00:57:41 UTC
Rebased and back to needs sign-off!
Comment 10 Michal Denar 2018-09-16 08:55:32 UTC
Hi Katrin,

I've just etst this bug anh here some questions.

If I print one paylemt line values are with correct format except Amount, this value are without decimal part like .00
https://prnt.sc/kuyham

If decimal isn't .00 but for example 0.25, all values are formated well
http://prntscr.com/kuyhsc

Desriptions of charge are correct at Credit type except "Print Summary"
http://prntscr.com/kuyi4x 

Meybe we can fix these details befere Singned-pff. What do You think?

Thank You

Mike
Comment 11 Brendan Gallagher 2018-09-16 22:09:33 UTC
Created attachment 79020 [details] [review]
Bug 21167: Fix price formatting on printed fee invoice and receipt

The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Comment 12 Michal Denar 2018-09-17 09:00:58 UTC
Hi Brandan,
thank You for new update. I've two small things:

1. Credit description is missing on Print Summary
https://prnt.sc/kvamze

2. No decimals with zero like .00 if I print one payment
http://prntscr.com/kvanzm


Just one small step ... :-)

Thank You

Mike
Comment 13 Josef Moravec 2018-09-19 07:56:31 UTC
Created attachment 79073 [details] [review]
Bug 21167: Fix price formatting on printed fee invoice and receipt

The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 14 Josef Moravec 2018-09-19 07:56:35 UTC
Created attachment 79074 [details] [review]
Bug 21167 (QA follow-up) Fix amount formatting on invoice receipt

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 15 Josef Moravec 2018-09-19 07:58:02 UTC
Created attachment 79075 [details] [review]
Bug 21167: (QA follow-up) Fix amount formatting on invoice receipt

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 16 Josef Moravec 2018-09-19 07:59:13 UTC
(In reply to Michal Denar from comment #12)
> 1. Credit description is missing on Print Summary
> https://prnt.sc/kvamze

This is the same in master, so out of the scope of this report

> 2. No decimals with zero like .00 if I print one payment
> http://prntscr.com/kvanzm
> 

I fixed this in follow-up
Comment 17 Josef Moravec 2018-09-19 08:08:43 UTC
Created attachment 79076 [details] [review]
Bug 21167: (QA follow-up) Use accounttype.inc for generating account description
Comment 18 Josef Moravec 2018-09-19 08:09:52 UTC
Switching back to singed of - I would like to somebody from qa team look on my follow-ups..
Comment 19 Jonathan Druart 2018-09-21 17:51:18 UTC
(In reply to Katrin Fischer from comment #2)
> Created attachment 77596 [details] [review] [review]
> - Updates accounttype-to-description list to the one used
>   in other templats as a lot of values were missing (Credit etc.)

Feeling lazy to check right now but, are you sure it is needed?
IIRC I have already faced that, and the template is not used in the missing cases.
Comment 20 Martin Renvoize (ashimema) 2018-09-27 13:59:18 UTC
Created attachment 79513 [details] [review]
Bug 21167: Fix price formatting on printed fee invoice and receipt

The prices were not formatted correctly on the printed receipts
for fines and payments in the patron account.

This patch introduces the use of the Price TT plugin to those
templates.

Also:
- Fixes a few capitalization errors
- Removes spaces in front of :
- Updates accounttype-to-description list to the one used
  in other templats as a lot of values were missing (Credit etc.)

To test:
- Create several fines, use some .00 and some with other values
- Pay some fines
- Create a manual credit
- Use print button for all of those (credit, fee, payment)
- Verify that:
  - prices ending in .00 are displayed without the decimal part
  - instead of Credit only C is shown in the description
- Apply patch
- Print invoices and receipts again
- Verify that:
  - prices are now formatted according to CurrencyFormat system
    preference, decimal part always included
  - verify that correct description for Credit is shown

Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 21 Martin Renvoize (ashimema) 2018-09-27 13:59:22 UTC
Created attachment 79514 [details] [review]
Bug 21167: (QA follow-up) Fix amount formatting on invoice receipt

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 22 Martin Renvoize (ashimema) 2018-09-27 13:59:26 UTC
Created attachment 79515 [details] [review]
Bug 21167: (QA follow-up) Use accounttype.inc for generating account description

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize (ashimema) 2018-09-27 14:00:33 UTC
The patches here (and their followups) appear to be sound to me. Passing QA
Comment 24 Nick Clemens (kidclamp) 2018-09-28 19:56:57 UTC
Awesome work all!

Pushed to master for 18.11
Comment 25 Jonathan Druart 2018-09-29 15:34:18 UTC
Jenkins is not happy since these changes (xt/find-missing-filters.t). The Price filter is not correctly handled by the tests, we should not need to html escape the result. I will try and provide a global fix on a separate bug report.
Comment 26 Jonathan Druart 2018-09-29 16:14:31 UTC
(In reply to Jonathan Druart from comment #25)
> Jenkins is not happy since these changes (xt/find-missing-filters.t). The
> Price filter is not correctly handled by the tests, we should not need to
> html escape the result. I will try and provide a global fix on a separate
> bug report.

See bug 21454.
Comment 27 Martin Renvoize (ashimema) 2018-10-05 11:44:07 UTC
Pushed to 18.05.x for 18.05.05
Comment 28 Fridolin Somers 2018-10-10 11:03:23 UTC
Does not apply easy on 17.11.x. Please provide a rebased patch.