@@ -, +, @@
interface
rules.
---
admin/smart-rules.pl | 237 +++++++++++++++---
.../prog/en/modules/admin/smart-rules.tt | 83 +++---
2 files changed, 256 insertions(+), 64 deletions(-)
--- a/admin/smart-rules.pl
+++ a/admin/smart-rules.pl
@@ -73,6 +73,8 @@ $cache->clear_from_cache( Koha::CirculationRules::GUESSED_ITEMTYPES_KEY );
if ($op eq 'delete') {
my $itemtype = $input->param('itemtype');
my $categorycode = $input->param('categorycode');
+ my $onsite_checkout = $input->param('onsite_checkout') eq '' ? undef : $input->param('onsite_checkout');
+
$debug and warn "deleting $1 $2 $branch";
Koha::CirculationRules->set_rules(
@@ -80,9 +82,24 @@ if ($op eq 'delete') {
categorycode => $categorycode eq '*' ? undef : $categorycode,
branchcode => $branch eq '*' ? undef : $branch,
itemtype => $itemtype eq '*' ? undef : $itemtype,
+ rules => {
+ reservesallowed => undef,
+ holds_per_record => undef,
+ holds_per_day => undef,
+ onshelfholds => undef,
+ opacitemholds => undef,
+ article_requests => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode eq '*' ? undef : $categorycode,
+ branchcode => $branch eq '*' ? undef : $branch,
+ itemtype => $itemtype eq '*' ? undef : $itemtype,
+ onsite_checkout => $onsite_checkout eq '*' ? undef : $onsite_checkout,
rules => {
maxissueqty => undef,
- maxonsiteissueqty => undef,
rentaldiscount => undef,
fine => undef,
finedays => undef,
@@ -102,14 +119,8 @@ if ($op eq 'delete') {
auto_renew => undef,
no_auto_renewal_after => undef,
no_auto_renewal_after_hard_limit => undef,
- reservesallowed => undef,
- holds_per_record => undef,
- holds_per_day => undef,
- onshelfholds => undef,
- opacitemholds => undef,
overduefinescap => undef,
cap_fine_to_replacement_price => undef,
- article_requests => undef,
note => undef,
}
}
@@ -125,8 +136,26 @@ elsif ($op eq 'delete-branch-cat') {
categorycode => undef,
rules => {
max_holds => undef,
- patron_maxissueqty => undef,
- patron_maxonsiteissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ branchcode => undef,
+ categorycode => undef,
+ onsite_checkout => 0,
+ rules => {
+ patron_maxissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ branchcode => undef,
+ categorycode => undef,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => undef,
}
}
);
@@ -148,8 +177,26 @@ elsif ($op eq 'delete-branch-cat') {
branchcode => undef,
rules => {
max_holds => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => undef,
+ onsite_checkout => 0,
+ rules => {
+ patron_maxissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => undef,
+ onsite_checkout => 1,
+ rules => {
patron_maxissueqty => undef,
- patron_maxonsiteissueqty => undef,
}
}
);
@@ -159,10 +206,20 @@ elsif ($op eq 'delete-branch-cat') {
{
branchcode => $branch,
categorycode => undef,
+ onsite_checkout => 0,
+ rules => {
+ patron_maxissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ branchcode => $branch,
+ categorycode => undef,
+ onsite_checkout => 1,
rules => {
max_holds => undef,
patron_maxissueqty => undef,
- patron_maxonsiteissueqty => undef,
}
}
);
@@ -184,8 +241,26 @@ elsif ($op eq 'delete-branch-cat') {
branchcode => $branch,
rules => {
max_holds => undef,
- patron_maxissueqty => undef,
- patron_maxonsiteissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => $branch,
+ onsite_checkout => 0,
+ rules => {
+ patron_maxissueqty => undef,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => $branch,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => undef,
}
}
);
@@ -250,6 +325,7 @@ elsif ($op eq 'add') {
my $br = $branch; # branch
my $bor = $input->param('categorycode'); # borrower category
my $itemtype = $input->param('itemtype'); # item type
+ my $onsite_checkout = $input->param('onsite_checkout');
my $fine = $input->param('fine');
my $finedays = $input->param('finedays');
my $maxsuspensiondays = $input->param('maxsuspensiondays') || '';
@@ -258,7 +334,6 @@ elsif ($op eq 'add') {
my $chargeperiod = $input->param('chargeperiod');
my $chargeperiod_charge_at = $input->param('chargeperiod_charge_at');
my $maxissueqty = strip_non_numeric( scalar $input->param('maxissueqty') );
- my $maxonsiteissueqty = strip_non_numeric( scalar $input->param('maxonsiteissueqty') );
my $renewalsallowed = $input->param('renewalsallowed');
my $renewalperiod = $input->param('renewalperiod');
my $norenewalbefore = $input->param('norenewalbefore');
@@ -287,11 +362,10 @@ elsif ($op eq 'add') {
my $overduefinescap = $input->param('overduefinescap') || '';
my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on';
my $note = $input->param('note');
- $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $maxonsiteissueqty, $cap_fine_to_replacement_price";
+ $debug and warn "Adding $br, $bor, $itemtype, $fine, $maxissueqty, $cap_fine_to_replacement_price";
my $rules = {
maxissueqty => $maxissueqty,
- maxonsiteissueqty => $maxonsiteissueqty,
rentaldiscount => $rentaldiscount,
fine => $fine,
finedays => $finedays,
@@ -311,15 +385,28 @@ elsif ($op eq 'add') {
auto_renew => $auto_renew,
no_auto_renewal_after => $no_auto_renewal_after,
no_auto_renewal_after_hard_limit => $no_auto_renewal_after_hard_limit,
+ overduefinescap => $overduefinescap,
+ cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
+ note => $note,
+ };
+
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $bor eq '*' ? undef : $bor,
+ itemtype => $itemtype eq '*' ? undef : $itemtype,
+ branchcode => $br eq '*' ? undef : $br,
+ onsite_checkout => $onsite_checkout eq '*' ? undef : $onsite_checkout,
+ rules => $rules,
+ }
+ );
+
+ $rules = {
reservesallowed => $reservesallowed,
holds_per_record => $holds_per_record,
holds_per_day => $holds_per_day,
onshelfholds => $onshelfholds,
opacitemholds => $opacitemholds,
- overduefinescap => $overduefinescap,
- cap_fine_to_replacement_price => $cap_fine_to_replacement_price,
article_requests => $article_requests,
- note => $note,
};
Koha::CirculationRules->set_rules(
@@ -335,8 +422,7 @@ elsif ($op eq 'add') {
elsif ($op eq "set-branch-defaults") {
my $categorycode = $input->param('categorycode');
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
- my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
- $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
+ my $patron_maxonsiteissueqty = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') );
my $holdallowed = $input->param('holdallowed');
my $hold_fulfillment_policy = $input->param('hold_fulfillment_policy');
my $returnbranch = $input->param('returnbranch');
@@ -358,9 +444,19 @@ elsif ($op eq "set-branch-defaults") {
{
categorycode => undef,
branchcode => undef,
+ onsite_checkout => 0,
rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => undef,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -380,9 +476,19 @@ elsif ($op eq "set-branch-defaults") {
{
categorycode => undef,
branchcode => $branch,
+ onsite_checkout => 0,
rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => $branch,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -399,8 +505,7 @@ elsif ($op eq "set-branch-defaults") {
elsif ($op eq "add-branch-cat") {
my $categorycode = $input->param('categorycode');
my $patron_maxissueqty = strip_non_numeric( scalar $input->param('patron_maxissueqty') );
- my $patron_maxonsiteissueqty = $input->param('patron_maxonsiteissueqty');
- $patron_maxonsiteissueqty = strip_non_numeric($patron_maxonsiteissueqty);
+ my $patron_maxonsiteissueqty = strip_non_numeric( scalar $input->param('patron_maxonsiteissueqty') );
my $max_holds = $input->param('max_holds');
$max_holds =~ s/\s//g;
$max_holds = undef if $max_holds !~ /^\d+/;
@@ -413,8 +518,26 @@ elsif ($op eq "add-branch-cat") {
branchcode => undef,
rules => {
max_holds => $max_holds,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => undef,
+ onsite_checkout => 0,
+ rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => undef,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -425,8 +548,26 @@ elsif ($op eq "add-branch-cat") {
branchcode => undef,
rules => {
max_holds => $max_holds,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => undef,
+ onsite_checkout => 0,
+ rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => undef,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -438,8 +579,26 @@ elsif ($op eq "add-branch-cat") {
branchcode => $branch,
rules => {
max_holds => $max_holds,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => $branch,
+ onsite_checkout => 0,
+ rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => undef,
+ branchcode => $branch,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -450,8 +609,26 @@ elsif ($op eq "add-branch-cat") {
branchcode => $branch,
rules => {
max_holds => $max_holds,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => $branch,
+ onsite_checkout => 0,
+ rules => {
patron_maxissueqty => $patron_maxissueqty,
- patron_maxonsiteissueqty => $patron_maxonsiteissueqty,
+ }
+ }
+ );
+ Koha::CirculationRules->set_rules(
+ {
+ categorycode => $categorycode,
+ branchcode => $branch,
+ onsite_checkout => 1,
+ rules => {
+ patron_maxissueqty => $patron_maxonsiteissueqty,
}
}
);
@@ -562,7 +739,7 @@ my $definedbranch = $all_rules->count ? 1 : 0;
my $rules = {};
while ( my $r = $all_rules->next ) {
$r = $r->unblessed;
- $rules->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value};
+ $rules->{ $r->{onsite_checkout} // '' }->{ $r->{categorycode} // '' }->{ $r->{itemtype} // '' }->{ $r->{rule_name} } = $r->{rule_value};
}
$template->param(show_branch_cat_rule_form => 1);
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt
@@ -91,13 +91,13 @@
+ On-site checkout
Patron category
Item type
Actions
Note
Current checkouts allowed
- Current on-site checkouts allowed
Loan period
Days mode
Unit
@@ -129,13 +129,14 @@