Bug 24672 - Error on receiving orders when there is an order with a deleted record
Summary: Error on receiving orders when there is an order with a deleted record
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Tomás Cohen Arazi
URL:
Keywords:
Depends on: 24430
Blocks:
  Show dependency treegraph
 
Reported: 2020-02-14 23:05 UTC by Katrin Fischer
Modified: 2020-11-30 21:48 UTC (History)
3 users (show)

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


Attachments
Bug 24672: (bug 24430 follow-up) Do not get active orders on deleted biblio record (1.51 KB, patch)
2020-02-17 14:01 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 24672: (bug 24430 follow-up) Do not get active orders on deleted biblio record (1.56 KB, patch)
2020-03-24 05:02 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2020-02-14 23:05:02 UTC
When trying to receive orders after entering the invoice id this error is displayed:

Can't call method "active_orders" on an undefined value at /home/vagrant/kohaclone/acqui/parcel.pl line 244
Comment 1 Katrin Fischer 2020-02-14 23:08:14 UTC
Not sure if it's related, but I have a basket with 2 unreceived deleted records (it's not good, but can happen)
Comment 2 Katrin Fischer 2020-02-14 23:10:35 UTC
It appears to be related - reopening the closed basket (taking the orders out of the list of orders to receive that way) makes the error go away.
Comment 3 Jonathan Druart 2020-02-17 13:57:54 UTC
Caused by
  commit f31993d126ed97fdc80605931f41ed29b1dac5d1
  Bug 24430: Remove CountBiblioInOrders and its traces
Comment 4 Jonathan Druart 2020-02-17 14:01:03 UTC
Created attachment 99090 [details] [review]
Bug 24672: (bug 24430 follow-up) Do not get active orders on deleted biblio record

On bug 24430 we replaced the call to CountBiblioInOrders with
Koha::Biblio->active_orders
In case the bibliographic record is deleted, the count must be set to 0.

This prevent the app to crash with:
Can't call method "active_orders" on an undefined value at
/home/vagrant/kohaclone/acqui/parcel.pl line 244

Test plan:
Create 2+ orders
Receive one, delete it, delete the bibliographic record
Receive the order one
=> Without this patch, on the parcel page you should get the error
=> With this patch applied you must be allowed to finish the receive
Comment 5 Tomás Cohen Arazi 2020-03-24 05:02:20 UTC
Created attachment 101502 [details] [review]
Bug 24672: (bug 24430 follow-up) Do not get active orders on deleted biblio record

On bug 24430 we replaced the call to CountBiblioInOrders with
Koha::Biblio->active_orders
In case the bibliographic record is deleted, the count must be set to 0.

This prevent the app to crash with:
Can't call method "active_orders" on an undefined value at
/home/vagrant/kohaclone/acqui/parcel.pl line 244

Test plan:
Create 2+ orders
Receive one, delete it, delete the bibliographic record
Receive the order one
=> Without this patch, on the parcel page you should get the error
=> With this patch applied you must be allowed to finish the receive

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Tomás Cohen Arazi 2020-03-24 05:03:11 UTC
I was about to submit the same patch and found you filed it, Katrin. Thanks for the patch Jonathan.
Comment 7 Martin Renvoize 2020-03-24 09:30:14 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Joy Nelson 2020-04-03 21:35:14 UTC
not backported to 19.11.x due to dependencies