Bug 20499: Fix the Internal Server Error
authorMark Tompsett <mtompset@hotmail.com>
Thu, 29 Mar 2018 18:47:25 +0000 (18:47 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 13 Apr 2018 14:49:13 +0000 (11:49 -0300)
TEST PLAN
---------
See comment #1

Applying the test without the patch: messy.
Applyin both patches: smooth.
Run koha qa test tools

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Circulation.pm

index 67ee4e5..369d4a2 100644 (file)
@@ -669,6 +669,12 @@ sub CanBookBeIssued {
     my $override_high_holds = $params->{override_high_holds} || 0;
 
     my $item = GetItem(undef, $barcode );
+    # MANDATORY CHECKS - unless item exists, nothing else matters
+    unless ( $item->{barcode} ) {
+        $issuingimpossible{UNKNOWN_BARCODE} = 1;
+    }
+    return ( \%issuingimpossible, \%needsconfirmation ) if %issuingimpossible;
+
     my $issue = Koha::Checkouts->find( { itemnumber => $item->{itemnumber} } );
     my $biblio = Koha::Biblios->find( $item->{biblionumber} );
     my $biblioitem = $biblio->biblioitem;
@@ -676,12 +682,6 @@ sub CanBookBeIssued {
     my $dbh             = C4::Context->dbh;
     my $patron_unblessed = $patron->unblessed;
 
-    # MANDATORY CHECKS - unless item exists, nothing else matters
-    unless ( $item->{barcode} ) {
-        $issuingimpossible{UNKNOWN_BARCODE} = 1;
-    }
-       return ( \%issuingimpossible, \%needsconfirmation ) if %issuingimpossible;
-
     #
     # DUE DATE is OK ? -- should already have checked.
     #