@@ -, +, @@ item type or branch. --- a/Koha/CirculationRules.pm +++ a/Koha/CirculationRules.pm @@ -177,6 +177,9 @@ our $RULE_KINDS = { decreaseloanholds => { scope => [ 'branchcode', 'categorycode', 'itemtype' ], }, + holds_pickup_period => { + scope => [ 'branchcode', 'categorycode', 'itemtype' ], + }, # Not included (deprecated?): # * accountsent # * reservecharge --- a/Koha/Hold.pm +++ a/Koha/Hold.pm @@ -191,6 +191,17 @@ sub set_waiting { my $new_expiration_date = $today->clone->add(days => $max_pickup_delay); + my $rule = Koha::CirculationRules->get_effective_rule({ + categorycode => $self->borrower->categorycode, + itemtype => $self->item->effective_itemtype, + branchcode => $self->branchcode, + rule_name => 'holds_pickup_period', + }); + if ( defined($rule) and $rule->rule_value ne '' ){ + # circulation rule overrides ReservesMaxPickUpDelay + $max_pickup_delay = $rule->rule_value; + } + if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) { my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype; my $daysmode = Koha::CirculationRules->get_effective_daysmode( --- a/admin/smart-rules.pl +++ a/admin/smart-rules.pl @@ -287,6 +287,7 @@ elsif ($op eq 'add') { my $cap_fine_to_replacement_price = ($input->param('cap_fine_to_replacement_price') || '') eq 'on'; my $note = $input->param('note'); my $decreaseloanholds = $input->param('decreaseloanholds') || undef; + my $holds_pickup_period = strip_non_numeric($input->param('holds_pickup_period')); my $rules = { maxissueqty => $maxissueqty, @@ -321,6 +322,7 @@ elsif ($op eq 'add') { article_requests => $article_requests, note => $note, decreaseloanholds => $decreaseloanholds, + holds_pickup_period => $holds_pickup_period, }; Koha::CirculationRules->set_rules( --- a/installer/data/mysql/atomicupdate/bug_8367-add_holds_pickup_period_circrule.perl +++ a/installer/data/mysql/atomicupdate/bug_8367-add_holds_pickup_period_circrule.perl @@ -0,0 +1,6 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{INSERT IGNORE INTO circulation_rules (branchcode, categorycode, itemtype, rule_name, rule_value) VALUES (NULL, NULL, NULL, 'holds_pickup_period', NULL) }); + + NewVersion( $DBversion, 8367, "Add holds_pickup_period circulation rule" ); +} --- a/installer/onboarding.pl +++ a/installer/onboarding.pl @@ -288,6 +288,7 @@ if ( $step == 5 ) { reservesallowed => $reservesallowed, suspension_chargeperiod => undef, decreaseloanholds => undef, + holds_pickup_period => undef, } }; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -140,6 +140,7 @@
When your item is ready for pickup, you will have days to pick it up from this library.