Bug 29599 - addorderiso2709.pl - Discount is stored as value below 1 instead of actual percentage
Summary: addorderiso2709.pl - Discount is stored as value below 1 instead of actual pe...
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: 20.11
Hardware: All All
: P5 - low minor (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-30 13:59 UTC by Christophe TORIN
Modified: 2022-12-12 21:24 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christophe TORIN 2021-11-30 13:59:34 UTC
When adding an order from a staged file, the discount amount is stored as the value below 1 instead of the actual percentage.
e.g. if you enter a disount of 25%, the stored value is 0.25 instead of 25.

The percentage is currently stored as is everywhere else (when you add from suggestions, or the discount amount stored in the bookseller info)

The discounted price is correctly calculated at first, but if the order is modified afterwards, the wrong discount is used, and the resulting prices are false.

This was seen on version 20.11, but is still relevant on the latest versions.

In the code, it is because of the way the value is handled :
in addorderiso2709.pl, lines 166, 279 & 340 , the discount value is divided by 100 and later it is stored like this.

The value should be used as is, then when calculating the prices, divide it by 100 if necessary.
Comment 1 Katrin Fischer 2021-12-05 23:55:50 UTC
Hi Christophe, if this is the same as Bug 29607 - addorderiso2709: The stored discount when importing an order from a file is invalid, you could also use the "Mark as duplicate" option, then both bugs will be linked which might help someone stumbling on this bug to make the connection.