Bug 31649

Summary: Acquisition basket CSV export fails if biblio does not exist
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: AcquisitionsAssignee: Fridolin Somers <fridolin.somers>
Status: RESOLVED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, david, lucas, wainuiwitikapark
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.08, 21.11.15
Attachments: Bug 31649: Add unit tests
Bug 31649: Fix acquisition basket CSV export if biblio does not exist
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist
Bug 31649: Add unit tests
Bug 31649: Fix acquisition basket CSV export if biblio does not exist
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist
Bug 31649: Add unit tests
Bug 31649: Fix acquisition basket CSV export if biblio does not exist
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist

Description Fridolin Somers 2022-09-29 06:31:50 UTC
In acquisition module, CSV export of a basket fails if an order is linked to a biblio that does not exist anymore.

Error :
Can't call method "biblioitem" on an undefined value at src/C4/Acquisition.pm line 323.
Comment 1 Fridolin Somers 2022-09-29 06:38:27 UTC
Maybe this comes from Bug 18262 that removed GetBiblioData()
Comment 2 Fridolin Somers 2022-09-29 08:17:40 UTC
Created attachment 141076 [details] [review]
Bug 31649: Add unit tests

Creates new test file GetBasketGroupAsCSV.t

Test with :
prove t/db_dependent/Acquisition/GetBasketAsCSV.t
prove t/db_dependent/Acquisition/GetBasketGroupAsCSV.t
Comment 3 Fridolin Somers 2022-09-29 08:17:45 UTC
Created attachment 141077 [details] [review]
Bug 31649: Fix acquisition basket CSV export if biblio does not exist
Comment 4 Fridolin Somers 2022-09-29 08:17:49 UTC
Created attachment 141078 [details] [review]
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist
Comment 5 David Nind 2022-09-29 12:27:48 UTC
Created attachment 141084 [details] [review]
Bug 31649: Add unit tests

Creates new test file GetBasketGroupAsCSV.t

Test with :
prove t/db_dependent/Acquisition/GetBasketAsCSV.t
prove t/db_dependent/Acquisition/GetBasketGroupAsCSV.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 David Nind 2022-09-29 12:27:53 UTC
Created attachment 141085 [details] [review]
Bug 31649: Fix acquisition basket CSV export if biblio does not exist

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2022-09-29 12:27:57 UTC
Created attachment 141086 [details] [review]
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2022-09-29 12:34:07 UTC
Testing notes (using KTD):

1. Add two items to a basket.
2. Deleted the items and record for one of the items.
3. Try to Export as CSV (above the basket title, not the datatable export options) - get error as described.
4. Close basket, add to a group, test Export as CSV - get erorr.
5. Repeat steps after patch applied - no error!
6. Tests pass.
Comment 9 Katrin Fischer 2022-10-08 12:41:19 UTC
Created attachment 141548 [details] [review]
Bug 31649: Add unit tests

Creates new test file GetBasketGroupAsCSV.t

Test with :
prove t/db_dependent/Acquisition/GetBasketAsCSV.t
prove t/db_dependent/Acquisition/GetBasketGroupAsCSV.t

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Katrin Fischer 2022-10-08 12:41:23 UTC
Created attachment 141549 [details] [review]
Bug 31649: Fix acquisition basket CSV export if biblio does not exist

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2022-10-08 12:41:28 UTC
Created attachment 141550 [details] [review]
Bug 31649: Fix acquisition basket group CSV export if biblio does not exist

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2022-10-08 12:43:07 UTC
This is a good immediate fix to keep libraries going, but ultimately we need to fix the 'deleted records and orders' issue properly. Libraries need to be able to account on acq and that includes being able to tell how money was spent at all times - even after they have been deleted/withdrawn from the library's holdings.
Comment 13 Tomás Cohen Arazi 2022-10-11 13:24:14 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 14 Lucas Gass 2022-12-05 18:00:52 UTC
Backported to 22.05.x for upcoming 22.05.08
Comment 15 Arthur Suzuki 2022-12-14 14:00:33 UTC
applied to 21.11 for 21.11.15.
I didn't applied the last patch though, because it modifies a file that is not even present in 21.11.
Comment 16 Arthur Suzuki 2022-12-14 14:04:31 UTC
oups, actually applied all patches fine. the patch not applied is from another bug.
Comment 17 wainuiwitikapark 2023-03-15 00:50:03 UTC
Not backported to 21.05.x