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.
---
 C4/Circulation.pm                                  |   20 +++++++++---------
 .../prog/en/modules/admin/smart-rules.tmpl         |   21 +++++++++++--------
 2 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 2a673f0..eefc258 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -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) ;
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl 
b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
index 4bc47cb..209b0b4 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tmpl
@@ -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 -->
-- 
1.5.5.GIT

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to