Bug 3873 - Gracefully handle errors when item in staff client cart has been deleted
Summary: Gracefully handle errors when item in staff client cart has been deleted
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-08 03:48 UTC by Owen Leonard
Modified: 2015-12-03 22:03 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 3873: Avoid software error if the cart contains a deleted record (1.16 KB, patch)
2015-03-25 08:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
[Signed-off] Bug 3873: Avoid software error if the cart contains a deleted record (1.32 KB, patch)
2015-03-25 10:40 UTC, Marc Véron
Details | Diff | Splinter Review
Bug 3873: follow-up for all other pages (2.44 KB, patch)
2015-03-25 14:58 UTC, Jonathan Druart
Details | Diff | Splinter Review
[Signed-off] Bug 3873: follow-up for all other pages (2.66 KB, patch)
2015-03-25 15:07 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 3873: Avoid software error if the cart contains a deleted record (1.30 KB, patch)
2015-03-27 14:35 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 3873: follow-up for all other pages (2.64 KB, patch)
2015-03-27 14:36 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Cormack 2010-05-21 01:16:00 UTC


---- Reported by oleonard@myacpl.org 2009-12-08 15:48:44 ----

If you happen to delete something that has been placed in your cart, viewing the contents of your cart will generate an error:

Can't call method "field" on an undefined value at kohaclone/C4/Biblio.pm line 1336.

The user then has no way of removing the offending item from the cart.

Perhaps the cart should simply ignore biblionumbers which are not found?



--- Bug imported by chris@bigballofwax.co.nz 2010-05-21 01:16 UTC  ---

This bug was previously known as _bug_ 3873 at http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3873

Actual time not defined. Setting to 0.0

Comment 1 Paul Poulain 2011-08-02 14:25:57 UTC
lowering the severity, the use case is pretty rare. But keeping it open, as it's still relevant
Comment 2 Colin Campbell 2013-10-10 10:42:58 UTC
I've added a bug 11032 to address the susceptability of Biblio.pm to abort in such cases leaving the calling routines unable to clean up sensibly
Comment 3 Jonathan Druart 2015-03-25 08:43:11 UTC Comment hidden (obsolete)
Comment 4 Marc Véron 2015-03-25 10:40:18 UTC Comment hidden (obsolete)
Comment 5 Marc Véron 2015-03-25 14:36:09 UTC
Oh, there are more Softwre errors if you 

- try to send the basket:
Can't use an undefined value as an ARRAY reference at /usr/share/kohaclone/basket/sendbasket.pl line 83.

- try to download as ISO2709:
Can't call method "as_usmarc" on an undefined value at /usr/share/kohaclone/basket/downloadcart.pl line 71.

- try to download as RIS:
An error has occurred!
Error 500

- try to download as Bibtex
Can't call method "subfield" on an undefined value at /usr/share/kohaclone/C4/Record.pm line 658.
Comment 6 Jonathan Druart 2015-03-25 14:58:01 UTC Comment hidden (obsolete)
Comment 7 Marc Véron 2015-03-25 15:07:05 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall 2015-03-27 14:35:22 UTC
Created attachment 37322 [details] [review]
[PASSED QA] Bug 3873: Avoid software error if the cart contains a deleted record

If a record is placed in the basket and deleted, the basket view
exploded with:
Can't use an undefined value as an ARRAY reference at
/home/koha/src/basket/basket.pl line 73.

Test plan:
1/ Add some records to the basket
2/ Delete one of them
3/ Look at your basket
It should not exploded

Note that the number of items in the basket is now wrong.

Works as expected.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 9 Kyle M Hall 2015-03-27 14:36:01 UTC
Created attachment 37323 [details] [review]
[PASSED QA] Bug 3873: follow-up for all other pages

This should fix the issue on other pages.

Test plan:
Try to download and export the basket (intranet+opac sides).

Re-tested for errors in comment #5, they do not longer appear.
Signed-off-by: Marc Veron <veron@veron.ch>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Tomás Cohen Arazi 2015-03-31 14:03:26 UTC
Patches pushed to master.

Thanks Jonathan!
Comment 11 Chris Cormack 2015-04-02 20:48:14 UTC
Pushed to 3.18.x will be in 3.18.6