When an invoice has shipping costs included in it, the totals are displayed inconsistently in Koha Acquisitions. If looking at the acqui-home.pl, the shipping costs are included in the total, however, clicking on the link to see the ordered totals (ordered.pl), shipping costs are not included in this view, causing the totals to not be consistent.
Created attachment 119466 [details] [review] Bug 23195: Unit tests
Created attachment 119467 [details] [review] Bug 23195: Always count shipping costs as 'spent' As shipping costs are created when an invoice is created, and creation of an invoice implies that items have been received, the shipment costs are always assumed to be 'spent' This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy treats open invoices shipping costs as 'ordered' and closed invoice shipping costs as 'spent' This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl To test: 1 - Find a vendor 2 - Click 'Receive shipments' 3 - Create a new invoice with a shipping cost on budget A 4 - Repeate and create a new invoice with a shipping cost on budget B 5 - Close the second invoice 6 - View acquisitions ome 7 - Note budget A includes the shipping under ordered 8 - Note budget B includes the shipping under spent 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page 10 - Click the spent column on budget A - the shipping is listed here 11 - Apply patch 12 - Both budgets list the shipping as 'spent' 13 - Both 'spent' pages include the shipping 14 - Neither 'ordered' page includes shipping
Created attachment 119542 [details] [review] Bug 23195: Unit tests Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Created attachment 119543 [details] [review] Bug 23195: Always count shipping costs as 'spent' As shipping costs are created when an invoice is created, and creation of an invoice implies that items have been received, the shipment costs are always assumed to be 'spent' This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy treats open invoices shipping costs as 'ordered' and closed invoice shipping costs as 'spent' This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl To test: 1 - Find a vendor 2 - Click 'Receive shipments' 3 - Create a new invoice with a shipping cost on budget A 4 - Repeate and create a new invoice with a shipping cost on budget B 5 - Close the second invoice 6 - View acquisitions ome 7 - Note budget A includes the shipping under ordered 8 - Note budget B includes the shipping under spent 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page 10 - Click the spent column on budget A - the shipping is listed here 11 - Apply patch 12 - Both budgets list the shipping as 'spent' 13 - Both 'spent' pages include the shipping 14 - Neither 'ordered' page includes shipping Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
I never noticed that problem, very nice catch ! Thanks Nick for the good fix !
Pondering this: If I am reading this correctly, than shipping costs will always seen as "spent" immediately, independent of the invoice status. ... and after testing I realize that this is exactly how the costs from the order lines work as well. So this really makes sense. We had to "hunt" down for shipping costs on non-closed invoices in the past, as they remained as 'encumbered' when the budget was closed. So quite happy about this change.
Created attachment 119797 [details] [review] Bug 23195: Unit tests Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 119798 [details] [review] Bug 23195: Always count shipping costs as 'spent' As shipping costs are created when an invoice is created, and creation of an invoice implies that items have been received, the shipment costs are always assumed to be 'spent' This logic is true in GetBudgetSpent/GetBudgetOrdered, however, GetBudgetHierarchy treats open invoices shipping costs as 'ordered' and closed invoice shipping costs as 'spent' This leads to inconsistencies in acqui-home vs spent.pl and ordered.pl To test: 1 - Find a vendor 2 - Click 'Receive shipments' 3 - Create a new invoice with a shipping cost on budget A 4 - Repeate and create a new invoice with a shipping cost on budget B 5 - Close the second invoice 6 - View acquisitions ome 7 - Note budget A includes the shipping under ordered 8 - Note budget B includes the shipping under spent 9 - Click the 'ordered' column on budget A - no shipping is listed on ordered page 10 - Click the spent column on budget A - the shipping is listed here 11 - Apply patch 12 - Both budgets list the shipping as 'spent' 13 - Both 'spent' pages include the shipping 14 - Neither 'ordered' page includes shipping Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
The tests are passing without the patch.
Created attachment 119941 [details] [review] Bug 23195: (follow-up) One text invoice should be open
Pushed to master for 21.05, thanks to everybody involved!
Pushed to 20.11.x for 20.11.06
Pushed to 20.05.x for 20.05.12
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.