Bug 8367: (follow-up) Fix pickup delay text on OPAC and other bits

Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Kelly <kelly@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Aleisha Amohia 2022-03-03 10:03:28 +13:00 committed by Tomas Cohen Arazi
parent 015fb672c5
commit ffde32e0d7
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
4 changed files with 23 additions and 15 deletions

View File

@ -231,8 +231,6 @@ sub set_waiting {
my $max_pickup_delay = C4::Context->preference("ReservesMaxPickUpDelay");
my $cancel_on_holidays = C4::Context->preference('ExpireReservesOnHolidays');
my $new_expiration_date = dt_from_string($self->waitingdate)->clone->add( days => $max_pickup_delay );
my $rule = Koha::CirculationRules->get_effective_rule({
categorycode => $self->borrower->categorycode,
itemtype => $self->item->effective_itemtype,
@ -244,6 +242,8 @@ sub set_waiting {
$max_pickup_delay = $rule->rule_value;
}
my $new_expiration_date = dt_from_string($self->waitingdate)->clone->add( days => $max_pickup_delay );
if ( C4::Context->preference("ExcludeHolidaysFromMaxPickUpDelay") ) {
my $itemtype = $self->item ? $self->item->effective_itemtype : $self->biblio->itemtype;
my $daysmode = Koha::CirculationRules->get_effective_daysmode(

View File

@ -298,7 +298,7 @@ elsif ($op eq 'add') {
my $recall_due_date_interval = $input->param('recall_due_date_interval');
my $recall_overdue_fine = $input->param('recall_overdue_fine');
my $recall_shelf_time = $input->param('recall_shelf_time');
my $holds_pickup_period = strip_non_numeric($input->param('holds_pickup_period'));
my $holds_pickup_period = strip_non_numeric( scalar $input->param('holds_pickup_period') );
my $rules = {
maxissueqty => $maxissueqty,

View File

@ -284,7 +284,7 @@
</ul>
[% IF pickup_delays %]
<p id="pickup_delay" style="display:none;">When your item is ready for pickup, you will have <span id="pickup_delay_days"></span> days to pick it up from this library.</p>
<p class="pickup_delay" style="display:none;">When your item is ready for pickup, you will have <span id="pickup_delay_days_[% bibitemloo.biblionumber | html %]"></span> days to pick it up from this library.</p>
[% END %]
<a class="toggle-hold-options" id="toggle-hold-options-[% bibitemloo.biblionumber | html %]" style="display:none;" href="#">Show more options</a>
@ -511,13 +511,17 @@
var MSG_EMPTY_END_DATE = _("Hold expiration date should be filled.");
function calculate_delay_days(){
var selected_branch = $("#branch_1").val();
[% FOREACH branchcode IN pickup_delays.keys %]
var branchcode = "[% branchcode | html %]";
if ( branchcode == selected_branch ) {
$("#pickup_delay_days").text([% pickup_delays.$branchcode | html %]);
}
[% END %]
$(".branch > select").each(function(){
var selected_branch = $(this).val();
var branch_biblionumber = $(this).attr('id');
var biblionumber = branch_biblionumber.slice( branch_biblionumber.indexOf('_')+1 );
[% FOREACH branchcode IN pickup_delays.keys %]
var branchcode = "[% branchcode | html %]";
if ( branchcode == selected_branch ) {
$("#pickup_delay_days_" + biblionumber).text([% pickup_delays.$branchcode | html %]);
}
[% END %]
});
}
$(document).ready(function() {
@ -528,8 +532,8 @@
});
calculate_delay_days();
$("#pickup_delay").show();
$("#branch_1").change(function(){
$(".pickup_delay").show();
$(".branch > select").change(function(){
calculate_delay_days();
});

View File

@ -626,7 +626,7 @@ if (
);
}
my @branches = Koha::Libraries->search();
my @branches = Koha::Libraries->search->as_list;
my %hold_pickup_delay_by_branch = ();
foreach my $branch ( @branches ) {
@ -636,7 +636,11 @@ foreach my $branch ( @branches ) {
itemtype => undef,
rule_name => 'holds_pickup_period',
});
$hold_pickup_delay_by_branch{$branch->branchcode} = $rule->rule_value if ( $rule and $rule->rule_value );
if ( $rule and $rule->rule_value ) {
$hold_pickup_delay_by_branch{$branch->branchcode} = $rule->rule_value;
} else {
$hold_pickup_delay_by_branch{$branch->branchcode} = C4::Context->preference('ReservesMaxPickUpDelay');
}
}
$template->param( pickup_delays => \%hold_pickup_delay_by_branch );