From 9f2c77a686c06719b2136c7be3e24c9b20ee9f10 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Fri, 20 Jun 2008 08:11:16 -0500 Subject: [PATCH] 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 same library, same patron type, default item type same library, default patron type, same item type same library, default patron type, default item type default library, same patron type, same item type default library, same patron type, default item type default library, default patron type, same item type default library, default patron type, default item type 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 --- 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 2a673f043c..eefc258d59 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 4bc47cbb41..209b0b4203 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() {

The rules are applied from most specific to less specific, using the first found in this order:

    -
  • same branch, same borrower type, same item type
  • -
  • same branch, same borrower type, default item type
  • -
  • same branch, default borrower type, same item type
  • -
  • default branch, same borrower type, same item type
  • -
  • anything else
  • +
  • same library, same patron type, same item type
  • +
  • same library, same patron type, default item type
  • +
  • same library, default patron type, same item type
  • +
  • same library, default patron type, default item type
  • +
  • default library, same patron type, same item type
  • +
  • default library, same patron type, default item type
  • +
  • default library, default patron type, same item type
  • +
  • default library, default patron type, default item type
-

To modify a rule, create a new one with the same borrower type and item type.

+

To modify a rule, create a new one with the same patron type and item type.

- Select a branch : + Select a library :