@@ -, +, @@ priority. - Create a rule with 4 checkouts allowed in default checkout limit table for a patron category and make it has priority, - create more permissive rules for all other branches (at least 5 checkouts allowed), - Checkout items of different branches for a patron with the same category, - Patron should be limited to 4 checkouts --- admin/smart-rules.pl | 6 + .../Bug_8137-add-column-has_priority.sql | 5 + .../prog/en/modules/admin/smart-rules.tt | 129 ++++++++++++++++++ t/db_dependent/Circulation/Branch.t | 24 ++++ 4 files changed, 164 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql --- a/admin/smart-rules.pl +++ a/admin/smart-rules.pl @@ -417,6 +417,8 @@ elsif ($op eq "add-branch-cat") { $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty); my $max_holds = $input->param('max_holds'); $max_holds = strip_non_numeric($max_holds); + my $has_priority = $input->param('has_priority'); + $has_priority = $has_priority ? 1 : 0; if ($branch eq "*") { if ($categorycode eq "*") { @@ -432,6 +434,7 @@ elsif ($op eq "add-branch-cat") { } ); } else { + Koha::CirculationRules->set_rules( { categorycode => $categorycode, @@ -440,6 +443,7 @@ elsif ($op eq "add-branch-cat") { max_holds => $max_holds, patron_maxissueqty => $patron_maxissueqty, patron_maxonsiteissueqty => $patron_maxonsiteissueqty, + has_priority => $has_priority, } } ); @@ -453,6 +457,7 @@ elsif ($op eq "add-branch-cat") { max_holds => $max_holds, patron_maxissueqty => $patron_maxissueqty, patron_maxonsiteissueqty => $patron_maxonsiteissueqty, + has_priority => $has_priority, } } ); @@ -465,6 +470,7 @@ elsif ($op eq "add-branch-cat") { max_holds => $max_holds, patron_maxissueqty => $patron_maxissueqty, patron_maxonsiteissueqty => $patron_maxonsiteissueqty, + has_priority => $has_priority, } } ); --- a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql +++ a/installer/data/mysql/atomicupdate/Bug_8137-add-column-has_priority.sql @@ -0,0 +1,5 @@ +ALTER TABLE default_borrower_circ_rules ADD has_priority INT(1) DEFAULT 0; +ALTER TABLE default_borrower_circ_rules DROP foreign key borrower_borrower_circ_rules_ibfk_1; +ALTER TABLE default_borrower_circ_rules DROP primary key; +ALTER TABLE default_borrower_circ_rules ADD primary key(categorycode, has_priority); +ALTER TABLE default_borrower_circ_rules ADD CONSTRAINT borrower_borrower_circ_rules_ibfk_1 FOREIGN KEY (categorycode) REFERENCES categories (categorycode) ON DELETE CASCADE ON UPDATE CASCADE; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -1288,6 +1288,135 @@ [% SET holdallowed = CirculationRules.Search( branchcode, undef, i.itemtype, 'holdallowed' ) %] [% SET hold_fulfillment_policy = CirculationRules.Search( branchcode, undef, i.itemtype, 'hold_fulfillment_policy' ) %] [% SET returnbranch = CirculationRules.Search( branchcode, undef, i.itemtype, 'returnbranch' ) %] +
For this library, you can specify the maximum number of loans that + a patron of a given category can make, regardless of the item type. +
+If the total amount loanable for a given patron category is left blank, + no limit applies, except possibly for a limit you define for a specific item type. +
++ Has priority: If checked, the rule will override those for all branches. Else + it behaves like a default one: used if no rule existe for the coresponding branch. +
+ +