Bug 22891: (bug 21206 follow-up) Fix RenewHold (ILS-DI)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sun, 12 May 2019 16:51:28 +0000 (11:51 -0500)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 14 May 2019 19:37:00 +0000 (19:37 +0000)
From
  commit 31c29fd31f557306233e6a2936148a5bb10b89a1
  Bug 21206: Replace C4::Items::GetItem

A missing 'unless' test made RenewHold return prematurely:
  return $issue;
should have been
  return unless $issue;

Test plan:
Hit /cgi-bin/koha/ilsdi.pl?service=RenewLoan&patron_id=51&item_id=756

With different situations:
1. Item is checked out to the patron
2. Item is not checked out to the patron
3. Item does not exist
4. Patron does not exist

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/ILSDI/Services.pm

index 8833094..f6591eb 100644 (file)
@@ -631,10 +631,8 @@ sub RenewLoan {
     my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
     if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
 
-    return unless $item; # FIXME should be handled
-
     my $issue = $item->checkout;
-    return $issue; # FIXME should be handled
+    return unless $issue; # FIXME should be handled
 
     # Hashref building
     my $out;