From 58a5a33b8b2215835c60b025db15fbee81155392 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 19 Jul 2017 15:57:52 -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. --- admin/smart-rules.pl | 3 +++ .../prog/en/modules/admin/smart-rules.tt | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/admin/smart-rules.pl b/admin/smart-rules.pl index 6a55b7b..8614f38 100755 --- a/admin/smart-rules.pl +++ b/admin/smart-rules.pl @@ -143,6 +143,7 @@ elsif ($op eq 'add') { $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_day = $input->param('holds_per_day'); my $onshelfholds = $input->param('onshelfholds') || 0; $maxissueqty =~ s/\s//g; $maxissueqty = undef if $maxissueqty !~ /^\d+/; @@ -182,6 +183,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, @@ -546,6 +548,7 @@ my @sorted_branch_cat_rules = sort { $a->{'humancategorycode'} cmp $b->{'humanca foreach my $entry (@sorted_branch_cat_rules, @sorted_row_loop) { $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->{rules_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 27fcf6e..e7d10f6 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 @@ -87,8 +87,11 @@ $(document).ready(function() { // Remove potential previous input added $(current_column).find("input").remove(); $(current_column).append(""); - } 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)) ) { @@ -188,7 +191,8 @@ $(document).ready(function() { 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 @@ -276,6 +280,12 @@ $(document).ready(function() { [% rule.no_auto_renewal_after %] [% rule.no_auto_renewal_after_hard_limit %] [% rule.reservesallowed %] + [% IF rule.unlimited_holds_per_day %] + Unlimited + [% ELSE %] + [% rule.holds_per_day %] + [% END %] + [% rule.holds_per_record %] [% IF rule.onshelfholds == 1 %] @@ -373,6 +383,7 @@ $(document).ready(function() {
[% INCLUDE 'date-format.inc' %]
+