Bug 24482 - Purchase Items broken by costs containing a comma
Summary: Purchase Items broken by costs containing a comma
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on: 23354
Blocks: 23355 24519 24540
  Show dependency treegraph
 
Reported: 2020-01-22 14:09 UTC by Andrew Fuerste-Henry
Modified: 2020-03-05 00:13 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
20.05.00


Attachments
Bug 24482: Fix for formatted price issue with value over 1000 (1.53 KB, patch)
2020-01-27 15:03 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 24482: Fix for formatted price issue with value over 1000 (1.57 KB, patch)
2020-01-29 10:23 UTC, David Nind
Details | Diff | Splinter Review
Bug 24482: Fix for formatted price issue with value over 1000 (2.59 KB, patch)
2020-01-30 08:21 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 24482: Fix for formatted price issue with value over 1000 (2.65 KB, patch)
2020-02-07 18:51 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2020-01-22 14:09:33 UTC
To test:
- enable cash registers and point of sale
- create a purchase item with a cost of $1000
- go to Point of Sale and attempt to sell one of your item
- Note that Koha inserts a comma into the price and breaks its own math in calculating the amount due
Comment 1 Martin Renvoize 2020-01-23 23:02:07 UTC
Nice catch, I never tested with such a large figure I must admit.

I'll start digging into it asap.  Thanks for testing this feature so thoroughly Andrew, it's great to be catching these things before live release.
Comment 2 Martin Renvoize 2020-01-27 15:03:49 UTC
Created attachment 97983 [details] [review]
Bug 24482: Fix for formatted price issue with value over 1000
Comment 3 Martin Renvoize 2020-01-27 15:04:27 UTC
Test plan, see first comment of bug. ;)
Comment 4 David Nind 2020-01-29 10:23:44 UTC
Created attachment 98058 [details] [review]
Bug 24482: Fix for formatted price issue with value over 1000

This patch for the point of sale feature fixes an issue where items for purchase with a value of $1,000 or more break the payment calculations. 

Test plan:
1) Enable the point of sale feature (EnablePointOfSale + UseCashRegisters system preferences)
2) Add a cash register for a library (Home > Point of sale >  Cash registers > New cash register)
3) Create a purchase item with a cost of $1000 (Home > Point of sale >  Purchase items > New debit type)
4) Go to to the point of sale page and attempt to sell one of your items (Home > Point of sale > click 'Add' next to the item to purchase)
5) Note that Koha inserts a comma into the price in the list of items for purchase
6) Note that the 'Amount being paid' changes to 0.00 instead of $1,000, which affects the other calculations
7) Apply the patch
8) Repeat step 4
9) Amount being paid and other calculations should now be correct
10) Enter an amount for 'Collected from patron' and click 'Confirm' - check that the change calculation is correct
11) Sign-off the patch!

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2020-01-29 10:32:06 UTC
I identified two other possible issues testing this bug:

1. If you press enter in the 'Collected from patron' field it adds the first item listed under the 'Items for purchase' section to 'This sale'.

2. If the amount you enter in 'Collected from patron' is less than the total amount owed and you press confirm it is accepted. For a cash payment maybe there should be a warning or error, or not let the transaction be accepted or completed.
Comment 6 Martin Renvoize 2020-01-30 08:21:48 UTC
Created attachment 98107 [details] [review]
Bug 24482: Fix for formatted price issue with value over 1000

This patch for the point of sale feature fixes an issue where items for
purchase with a value of $1,000 or more break the payment calculations.

Test plan:
1) Enable the point of sale feature
   (EnablePointOfSale + UseCashRegisters system preferences)
2) Add a cash register for a library
   (Home > Point of sale > Cash registers > New cash register)
3) Create a purchase item with a cost of $1000
   (Home > Point of sale >  Purchase items > New debit type)
4) Go to to the point of sale page and attempt to sell one of your items
   (Home > Point of sale > click 'Add' next to the item to purchase)
5) Note that Koha inserts a comma into the price in the list of items for
   purchase
6) Note that the 'Amount being paid' changes to 0.00 instead of $1,000,
   which affects the other calculations
7) Apply the patch
8) Repeat step 4
9) Amount being paid and other calculations should now be correct
10) Enter an amount for 'Collected from patron' and click 'Confirm'
    check that the change calculation is correct.
11) Sign-off the patch!

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 Martin Renvoize 2020-01-30 08:22:18 UTC
Thanks for testing, and that's a wonderfully detailed test plan, thankyou!
Comment 8 Martin Renvoize 2020-01-30 08:23:46 UTC
(In reply to David Nind from comment #5)
> I identified two other possible issues testing this bug:
> 
> 1. If you press enter in the 'Collected from patron' field it adds the first
> item listed under the 'Items for purchase' section to 'This sale'.

Oh, weird.. I'll open a new bug for that.

> 
> 2. If the amount you enter in 'Collected from patron' is less than the total
> amount owed and you press confirm it is accepted. For a cash payment maybe
> there should be a warning or error, or not let the transaction be accepted
> or completed.

I'll be submitting a fix for this one in bug 24519 ;)
Comment 9 Martin Renvoize 2020-01-31 13:40:37 UTC
Bug 24540 opened for the weird enter behaviour.
Comment 10 Nick Clemens 2020-02-07 18:51:40 UTC
Created attachment 98582 [details] [review]
Bug 24482: Fix for formatted price issue with value over 1000

This patch for the point of sale feature fixes an issue where items for
purchase with a value of $1,000 or more break the payment calculations.

Test plan:
1) Enable the point of sale feature
   (EnablePointOfSale + UseCashRegisters system preferences)
2) Add a cash register for a library
   (Home > Point of sale > Cash registers > New cash register)
3) Create a purchase item with a cost of $1000
   (Home > Point of sale >  Purchase items > New debit type)
4) Go to to the point of sale page and attempt to sell one of your items
   (Home > Point of sale > click 'Add' next to the item to purchase)
5) Note that Koha inserts a comma into the price in the list of items for
   purchase
6) Note that the 'Amount being paid' changes to 0.00 instead of $1,000,
   which affects the other calculations
7) Apply the patch
8) Repeat step 4
9) Amount being paid and other calculations should now be correct
10) Enter an amount for 'Collected from patron' and click 'Confirm'
    check that the change calculation is correct.
11) Sign-off the patch!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Martin Renvoize 2020-02-10 09:23:37 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 12 Joy Nelson 2020-03-05 00:13:11 UTC
not pushed to 19.11.x due to dependencies