Bug 34305

Summary: If actual cost is negative, wrong price will display in the acq details tab
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: AcquisitionsAssignee: Katrin Fischer <katrin.fischer>
Status: RESOLVED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: caroline.cyr-la-rose, fridolin.somers, m.de.rooy, michaela.sieber
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=34170
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.03,22.11.09
Circulation function:
Attachments: Bug 34305: Account for negative prices on acq details tab
Bug 34305: Account for negative prices on acq details tab
Bug 34305: Account for negative prices on acq details tab

Description Katrin Fischer 2023-07-18 14:30:01 UTC
The acq detail tab shows either the unitprice (actual price) or the ecost (estimated price) depending on if one or the other is set. The check for this is wrong when the actual price is a negative value (see bug 34170).
Comment 1 Katrin Fischer 2023-07-18 14:52:27 UTC
Created attachment 153610 [details] [review]
Bug 34305: Account for negative prices on acq details tab

The acquisition detail tab shows the estimated cost while
the order is still pending and the actual price, once received.
At least the tool tip on the table header row says so. This
was not working correctly.

To test:
* Create a basket
* Create a new order line with a negative list price (credit)
* Close the basket
* Verify that the price shows correctly in the acquisition details
  tab on the record
* Receive the order and enter a different negative actual price.
* Reload detail view, verify it still shows the estimcated price
* Apply patch, restart_all
* Verify now the correct actual price displays
* Create another basket and order line
* Verify while not yet received, it still shows the estimaed price
Comment 2 Caroline Cyr La Rose 2023-07-18 19:12:20 UTC
Created attachment 153621 [details] [review]
Bug 34305: Account for negative prices on acq details tab

The acquisition detail tab shows the estimated cost while
the order is still pending and the actual price, once received.
At least the tool tip on the table header row says so. This
was not working correctly.

To test:
* Create a basket
* Create a new order line with a negative list price (credit)
* Close the basket
* Verify that the price shows correctly in the acquisition details
  tab on the record
* Receive the order and enter a different negative actual price.
* Reload detail view, verify it still shows the estimated price
* Apply patch, restart_all
* Verify now the correct actual price displays
* Create another basket and order line
* Verify while not yet received, it still shows the estimated price

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Comment 3 Caroline Cyr La Rose 2023-07-18 19:14:23 UTC
For testing, it's easier if either the AcqCreateItem is on cataloguing the record, or when creating the basket, you choose to create items when cataloguing the record... It's just easier not to have to create the item at all for credits :)
Comment 4 Marcel de Rooy 2023-08-04 09:57:38 UTC
Created attachment 154257 [details] [review]
Bug 34305: Account for negative prices on acq details tab

The acquisition detail tab shows the estimated cost while
the order is still pending and the actual price, once received.
At least the tool tip on the table header row says so. This
was not working correctly.

To test:
* Create a basket
* Create a new order line with a negative list price (credit)
* Close the basket
* Verify that the price shows correctly in the acquisition details
  tab on the record
* Receive the order and enter a different negative actual price.
* Reload detail view, verify it still shows the estimated price
* Apply patch, restart_all
* Verify now the correct actual price displays
* Create another basket and order line
* Verify while not yet received, it still shows the estimated price

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Tomás Cohen Arazi (tcohen) 2023-08-15 12:20:10 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 6 Fridolin Somers 2023-08-17 20:17:48 UTC
Pushed to 23.05.x for 23.05.03
Comment 7 Pedro Amorim 2023-08-18 13:51:07 UTC
Nice work everyone!

Pushed to 22.11.x for next release