bug 2000 - fix order of issuingrule lookup

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>
This commit is contained in:
Galen Charlton 2008-06-20 08:11:16 -05:00 committed by Joshua Ferraro
parent 3e9a94c546
commit 9f2c77a686
2 changed files with 25 additions and 22 deletions

View file

@ -1066,11 +1066,6 @@ sub GetLoanLength {
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
$sth->execute( $borrowertype, $itemtype, "*" );
$loanlength = $sth->fetchrow_hashref;
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
$sth->execute( $borrowertype, "*", $branchcode );
$loanlength = $sth->fetchrow_hashref;
return $loanlength->{issuelength}
@ -1081,12 +1076,17 @@ sub GetLoanLength {
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
$sth->execute( $borrowertype, "*", "*" );
$sth->execute( "*", "*", $branchcode );
$loanlength = $sth->fetchrow_hashref;
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
$sth->execute( "*", "*", $branchcode );
$sth->execute( $borrowertype, $itemtype, "*" );
$loanlength = $sth->fetchrow_hashref;
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
$sth->execute( $borrowertype, "*", "*" );
$loanlength = $sth->fetchrow_hashref;
return $loanlength->{issuelength}
if defined($loanlength) && $loanlength->{issuelength} ne 'NULL';
@ -1128,10 +1128,6 @@ sub GetIssuingRule {
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
$sth->execute( $borrowertype, $itemtype, "*" );
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
$sth->execute( $borrowertype, "*", $branchcode );
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
@ -1140,11 +1136,15 @@ sub GetIssuingRule {
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
$sth->execute( $borrowertype, "*", "*" );
$sth->execute( "*", "*", $branchcode );
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
$sth->execute( "*", "*", $branchcode );
$sth->execute( $borrowertype, $itemtype, "*" );
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;
$sth->execute( $borrowertype, "*", "*" );
$irule = $sth->fetchrow_hashref;
return $irule if defined($irule) ;

View 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 -->