bug 2000 - fix order of issuingrule lookup
authorGalen Charlton <galen.charlton@liblime.com>
Fri, 20 Jun 2008 13:11:16 +0000 (08:11 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Fri, 20 Jun 2008 13:19:03 +0000 (08:19 -0500)
Extended help on the alternate circulation rules
form to list the order of issuingrules lookup as
follows:

same library, same patron type, same item type</li>
same library, same patron type, default item type</li>
same library, default patron type, same item type</li>
same library, default patron type, default item type</li>
default library, same patron type, same item type</li>
default library, same patron type, default item type</li>
default library, default patron type, same item type</li>
default library, default patron type, default item type</li>

This includes modifying two routines in C4::Circulation to
follow this order: GetLoanLength() and GetIssuingRule().

The reason for this change is to have Koha exhaust all issuingrules
possibilities for a branch before checking the rules for
the default branch - this is consistent with what an admin
might expect from looking at the issuingrules forms, which display
settings a branch at a time, and is more consistent with how
circulation rules should work for indepdendent branches.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Circulation.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl

index 2a673f0..eefc258 100644 (file)
@@ -1066,27 +1066,27 @@ sub GetLoanLength {
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
 
-    $sth->execute( $borrowertype, $itemtype, "*" );
+    $sth->execute( $borrowertype, "*", $branchcode );
     $loanlength = $sth->fetchrow_hashref;
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
 
-    $sth->execute( $borrowertype, "*", $branchcode );
+    $sth->execute( "*", $itemtype, $branchcode );
     $loanlength = $sth->fetchrow_hashref;
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
 
-    $sth->execute( "*", $itemtype, $branchcode );
+    $sth->execute( "*", "*", $branchcode );
     $loanlength = $sth->fetchrow_hashref;
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
 
-    $sth->execute( $borrowertype, "*", "*" );
+    $sth->execute( $borrowertype, $itemtype, "*" );
     $loanlength = $sth->fetchrow_hashref;
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
 
-    $sth->execute( "*", "*", $branchcode );
+    $sth->execute( $borrowertype, "*", "*" );
     $loanlength = $sth->fetchrow_hashref;
     return $loanlength->{issuelength}
       if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
@@ -1128,23 +1128,23 @@ sub GetIssuingRule {
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
-    $sth->execute( $borrowertype, $itemtype, "*" );
+    $sth->execute( $borrowertype, "*", $branchcode );
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
-    $sth->execute( $borrowertype, "*", $branchcode );
+    $sth->execute( "*", $itemtype, $branchcode );
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
-    $sth->execute( "*", $itemtype, $branchcode );
+    $sth->execute( "*", "*", $branchcode );
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
-    $sth->execute( $borrowertype, "*", "*" );
+    $sth->execute( $borrowertype, $itemtype, "*" );
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
-    $sth->execute( "*", "*", $branchcode );
+    $sth->execute( $borrowertype, "*", "*" );
     $irule = $sth->fetchrow_hashref;
     return $irule if defined($irule) ;
 
index 4bc47cb..209b0b4 100644 (file)
@@ -35,17 +35,20 @@ $(document).ready(function() {
     <div class="help">
         <p>The rules are applied from most specific to less specific, using the first found in this order:</p>
         <ul>
-            <li>same branch, same borrower type, same item type</li>
-            <li>same branch, same borrower type, default item type</li>
-            <li>same branch, default borrower type, same item type</li>
-            <li>default branch, same borrower type, same item type</li>
-            <li>anything else</li>
+            <li>same library, same patron type, same item type</li>
+            <li>same library, same patron type, default item type</li>
+            <li>same library, default patron type, same item type</li>
+            <li>same library, default patron type, default item type</li>
+            <li>default library, same patron type, same item type</li>
+            <li>default library, same patron type, default item type</li>
+            <li>default library, default patron type, same item type</li>
+            <li>default library, default patron type, default item type</li>
         </ul>
-        <p>To modify a rule, create a new one with the same borrower type and item type.</p>
+        <p>To modify a rule, create a new one with the same patron type and item type.</p>
     </div>
     <div id="bloc100">
         <form method="get" action="/cgi-bin/koha/admin/smart-rules.pl" id="selectlibrary">
-        Select a branch :
+        Select a library :
             <select name="branch" id="branch" style="width:20em;">
                 <option value="*">Default</option>
             <!-- TMPL_LOOP NAME="branchloop" -->
@@ -70,13 +73,13 @@ $(document).ready(function() {
             <!-- TMPL_LOOP NAME="rules" -->
                 <tr>
                     <td><!-- TMPL_IF NAME="default_humancategorycode" -->
-                            Any
+                            <em>Default</em>
                         <!-- TMPL_ELSE -->
                             <!-- TMPL_VAR NAME="humancategorycode" -->
                         <!-- /TMPL_IF -->
                     </td>
                     <td><!-- TMPL_IF NAME="default_humanitemtype" -->
-                            Any
+                            <em>Default</em>
                         <!-- TMPL_ELSE -->
                             <!-- TMPL_VAR NAME="humanitemtype" -->
                         <!-- /TMPL_IF -->