Bug 7940 - Placing a hold on a single item from the staff cart causes errors
Summary: Placing a hold on a single item from the staff cart causes errors
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: 3.6
Hardware: All All
: P5 - low normal (vote)
Assignee: Kyle M Hall
QA Contact: Ian Walls
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-10 15:36 UTC by Kyle M Hall
Modified: 2013-12-05 19:59 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:


Attachments
Bug 7940 - Placing a hold on a single item from the staff cart causes errors (2.79 KB, patch)
2012-04-10 15:48 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 7940 - Placing a hold on a single item from the staff cart causes errors (2.78 KB, patch)
2012-04-10 15:51 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 7940 - Placing a hold on a single item from the staff cart causes errors (2.71 KB, patch)
2012-04-10 15:57 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 7940 - Placing a hold on a single item from the staff cart causes errors (2.83 KB, patch)
2012-04-10 21:23 UTC, Liz Rea
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Kyle M Hall 2012-04-10 15:36:22 UTC
When reserving from the cart in the staff catalog - you get as far as 
"Enter patron card number or partial name". Once you have entered the name - it
throws this error. 

Software error:

Can't call method "field" on an undefined value at
/home/koha/kohaclone/C4/Items.pm line 1556.
For help, please send mail to the webmaster (staff@bywatersolutions.com),
giving this error message and the time and date of the error.

This happens when you are using the cart to order 1 item. (If you place more
then 1 item in the cart, you do not get this error message)
Comment 1 Kyle M Hall 2012-04-10 15:48:04 UTC Comment hidden (obsolete)
Comment 2 Kyle M Hall 2012-04-10 15:51:24 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2012-04-10 15:57:06 UTC Comment hidden (obsolete)
Comment 4 Liz Rea 2012-04-10 21:23:25 UTC
Created attachment 9095 [details] [review]
Bug 7940 - Placing a hold on a single item from the staff cart causes errors

This is caused by the javascript function placeHold() in basket.pl
The cause of this error is thus: when a staff member uses the cart
to place holds on multiple items at once, the cart redirects to
reserver/request.pl with the params 'biblionumbers' ( a string of
biblionumbers separated by slashes ( e.g. '5/4/3/' ) and the param
multi_hold with a value of 1.

When multi_hold is enabled, request.pl splits the string 'biblionumbers'
on those slashes and works on that list.

In placeHold(), when only one item is checked, the system passes
the param biblionumbers with a single biblionumber ( e.g. '5/' )
and does *not* pass the multi_hold param. This causes request.pl
to not parse the biblionumbers param, and thus reserve.pl has
no biblionumber to work on ( hence our error here ).

There are two options to resolve this:
A) Add the multi_hold param even for a single hold from the cart.
B) In the event of a single hold being placed from the cart,
   switch to the standard single hold url ( i.e. request.pl?biblionumber=234 )

This commit resolves the situation using option B, as it seems more
logical than using the multi-holds system for a single hold.

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
passes tests, works as advertised. Good catch!
Comment 5 Ian Walls 2012-04-11 11:23:09 UTC
Javascript-level patch to use different hold placement tool if only a single bib is passed.  Looks clean.  Removes badBibs variable, but this does not appear to actually be used anywhere in placeHold(), so this is safe.

Marking Passed QA.
Comment 6 Jared Camins-Esakov 2012-05-09 20:03:41 UTC
This bug will be included in the Koha 3.6.5 release.