Bug 10169

Summary: Software error if one of multiple titles selected for hold in the OPAC has no items
Product: Koha Reporter: Owen Leonard <oleonard>
Component: Hold requestsAssignee: Bugs List <koha-bugs>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P5 - low CC: gmcharlt, jonathan.druart, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10169 [Incomplete] Software error if one of multiple titles selected for hold in the OPAC has no items

Description Owen Leonard 2013-05-01 19:03:20 UTC
If you select multiple titles to place on hold in the OPAC and at least one of them has no items you will get a nasty error:

Can't call method "field" on an undefined value at C4/Items.pm line 1398.
Comment 1 Owen Leonard 2013-05-01 19:50:19 UTC
Created attachment 17874 [details] [review]
Bug 10169 [Incomplete] Software error if one of multiple titles selected for hold in the OPAC has no items

This patch contains changes suggested by Jared on IRC. This eliminates
the ugly error but raises a new problem: The 'Place hold' screen is now
blank except for a warning: "ERROR: No biblio record found for
biblionumber 5638."

The warning is triggered by the variable "bad_biblionumber," set here
(opac-reserve.pl lines 362+):

    # Get relevant biblio data.
    my $biblioData = $biblioDataHash{$biblioNum};
    if (! $biblioData) {
        $template->param(message=>1, bad_biblionumber=>$biblioNum);
        &get_out($query, $cookie, $template->output);
    }

I assume this is proper error-handling in the case of placing a single
hold, but has never been revised to accommodate multiple holds? Not sure
where to go next with it.
Comment 2 Marc Véron 2014-12-19 16:14:18 UTC
I can not reproduce on current master 3.19.00.000

How I tested:

- Log in to Opac
- Do a search that has  biblios with an dwihtout items as result
- Select one with items and two without items and place hold.

Result (OK):
--------------
Confirm holds for: xxxxx (x)

Faust — Part 1 , by Goethe, Johann Wolfgang von, 1749-1832
No available items.

Place a hold on The German Classics of the Nineteenth and Twentieth Centuries, Volume 01 Masterpieces of German Literature Translated into English.

    Holds and priority: 1
    Pick up location:

Show more options

West-östlicher Divan , by Goethe, Johann Wolfgang von, 1749-1832
No available items.
---------------
Comment 3 Jonathan Druart 2015-04-15 10:56:30 UTC
Confirmed, this is fixed.