Bug 10859: (follow-up) clarify logic on multiple loans on same bib
authorGalen Charlton <gmc@esilibrary.com>
Mon, 21 Apr 2014 05:51:58 +0000 (05:51 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 21 Apr 2014 05:51:58 +0000 (05:51 +0000)
This patch clarifies the logic for determining if a given item to be
checked out would be the second (or third, etc.) loan on the same bib.

As a conseqence, if the item is already on loan to the patron, the
circ staffer won't see the multiple-loans-on-a-bib warning, just
the confirmation to renew the loan or the warning that no more
renewals are lest.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Circulation.pm

index b660950..bd9e1cc 100644 (file)
@@ -1015,7 +1015,13 @@ sub CanBookBeIssued {
         }
     }
 
-    if (not C4::Context->preference('AllowMultipleIssuesOnABiblio')) {
+    if (
+        !C4::Context->preference('AllowMultipleIssuesOnABiblio') &&
+        # don't do the multiple loans per bib check if we've
+        # already determined that we've got a loan on the same item
+        !$issuingimpossible{NO_MORE_RENEWALS} &&
+        !$needsconfirmation{RENEW_ISSUE}
+    ) {
         # Check if borrower has already issued an item from the same biblio
         # Only if it's not a subscription
         my $biblionumber = $item->{biblionumber};
@@ -1027,8 +1033,9 @@ sub CanBookBeIssued {
                 biblionumber   => $biblionumber,
             } );
             my @issues = $issues ? @$issues : ();
-            # If there is at least one issue on another item than the item we want to checkout
-            if (scalar @issues > 0 and $issues[0]->{itemnumber} != $item->{itemnumber}) {
+            # if we get here, we don't already have a loan on this item,
+            # so if there are any loans on this bib, ask for confirmation
+            if (scalar @issues > 0) {
                 $needsconfirmation{BIBLIO_ALREADY_ISSUED} = 1;
             }
         }