From 776efbfa094235e0cd9e046836820f148c94247f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 7 Feb 2018 16:10:28 -0300 Subject: [PATCH] Bug 15486: Make circ rules UI handle holds_per_day This patch makes the staff UI correctly handle the holds_per_day configuration. Signed-off-by: Tomas Cohen Arazi --- admin/smart-rules.pl | 7 ++++-- .../prog/en/modules/admin/smart-rules.tt | 26 ++++++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 718b68235c..41e7d09a60 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -141,7 +141,8 @@ elsif ($op eq 'add') { $no_auto_renewal_after_hard_limit = eval { dt_from_string( $input->param('no_auto_renewal_after_hard_limit') ) } if ( $no_auto_renewal_after_hard_limit ); $no_auto_renewal_after_hard_limit = output_pref( { dt => $no_auto_renewal_after_hard_limit, dateonly => 1, dateformat => 'iso' } ) if ( $no_auto_renewal_after_hard_limit ); my $reservesallowed = $input->param('reservesallowed'); - my $holds_per_record = $input->param('holds_per_record'); + my $holds_per_record = $input->param('holds_per_record'); + my $holds_per_day = $input->param('holds_per_day'); my $onshelfholds = $input->param('onshelfholds') || 0; $maxissueqty =~ s/\s//g; $maxissueqty = undef if $maxissueqty !~ /^\d+/; @@ -181,6 +182,7 @@ elsif ($op eq 'add') { no_auto_renewal_after_hard_limit => $no_auto_renewal_after_hard_limit, reservesallowed => $reservesallowed, holds_per_record => $holds_per_record, + holds_per_day => $holds_per_day, issuelength => $issuelength, lengthunit => $lengthunit, hardduedate => $hardduedate, @@ -543,8 +545,9 @@ my @sorted_branch_cat_rules = sort { $a->{'humancategorycode'} cmp $b->{'humanca # note undef maxissueqty so that template can deal with them foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { - $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); + $entry->{unlimited_maxissueqty} = 1 unless defined($entry->{maxissueqty}); $entry->{unlimited_maxonsiteissueqty} = 1 unless defined($entry->{maxonsiteissueqty}); + $entry->{unlimited_holds_per_day} = 1 unless defined($entry->{holds_per_day}); } @sorted_row_loop = sort by_category_and_itemtype @row_loop; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt index e1a5839f8a..56153693f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt @@ -84,7 +84,8 @@ Automatic renewal No automatic renewal after No automatic renewal after (hard limit) - Holds allowed (count) + Holds allowed (total) + Holds allowed (daily) Holds per record (count) On shelf holds allowed Item level holds @@ -171,7 +172,13 @@ [% rule.no_auto_renewal_after %] [% rule.no_auto_renewal_after_hard_limit %] - [% rule.reservesallowed %] + [% rule.reservesallowed %] + [% IF rule.unlimited_holds_per_day %] + Unlimited + [% ELSE %] + [% rule.holds_per_day %] + [% END %] + [% rule.holds_per_record %] [% IF rule.onshelfholds == 1 %] @@ -268,7 +275,8 @@
[% INCLUDE 'date-format.inc' %]
- + + "); - } else if ( i == 3 || i == 4 ) { - // If the value is not an integer for "Current checkouts allowed" or "Current on-site checkouts allowed" + } else if ( i == 3 || i == 4 || i == 23 ) { + // If the value is not an integer for + // - "Current checkouts allowed" + // - "Current on-site checkouts allowed" + // - "Holds allowed (daily)" // The value is "Unlimited" (or an equivalent translated string) // an it should be set to an empty string if( !((parseFloat(itm) == parseInt(itm)) && !isNaN(itm)) ) { -- 2.14.1