From a955f87c139bf1617cfdcc17e83cd571bccc2005 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sat, 11 Oct 2014 13:38:23 -0400 Subject: [PATCH] Fix NCIP::ILS::Evergreen->place_hold. We better take into account what open-ils.circ.holds.create returns. We check for an array of errors and use the first one. We also look up the hold for the id returned. I forgot that it only returns the id and not the whole hold object created. Signed-off-by: Jason Stephenson --- lib/NCIP/ILS/Evergreen.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index 48fbc05..7a6bff5 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -2330,8 +2330,19 @@ sub place_hold { $self->{session}->{authtoken}, $hold ); - if (ref($hold) eq 'HASH') { + if (ref($hold)) { + $hold = $hold->[0] if (ref($hold) eq 'ARRAY'); $hold = _problem_from_event('Request Not Possible', $hold); + } else { + # open-ils.circ.holds.create.override returns the id on + # success, so we retrieve the full hold object from the + # database to return it. + $hold = $U->simplereq( + 'open-ils.pcrud', + 'open-ils.pcrud.ahr.retrieve', + $self->{session}->{authtoken}, + $hold + ); } } elsif ($r->{last_event}) { $hold = _problem_from_event('Request Not Possible', $r->{last_event}); -- 2.43.2