Bug 24669: Show "Unlimited" values correctly in smart-rules.pl

The rules "Holds allowed (total)", "Holds allowed (daily)", "Holds per
record (count)" were not set empty when in rule editing. Also, the
text "Unlimited" was not shown for rule "Holds per record (count)"
even though it should have been since empty value means unlimited
holds per record.

To test:
1. Apply patch
2. Edit the rules "Holds allowed (total)", "Holds allowed (daily)", "Holds per
record (count)" to be empty and save
3. Make sure all of the above rules now say Unlimited
4. Edit the rules again and make sure the above rules are now in the
rule editing empty.

Sponsored-by: The National Library of Finland
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Joonas Kylmälä 2020-02-17 10:32:26 +00:00 committed by Martin Renvoize
parent 4a9330df40
commit 38b95b5122
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -262,7 +262,13 @@
<span>Unlimited</span>
[% END %]
</td>
<td>[% holds_per_record | html %]</td>
<td>
[% IF holds_per_record.defined && holds_per_record != '' %]
[% holds_per_record | html %]
[% ELSE %]
<span>Unlimited</span>
[% END %]
</td>
<td>
[% IF onshelfholds == 1 %]
<span>Yes</span>
@ -1016,11 +1022,13 @@
// Remove potential previous input added
$(current_column).find("input").remove();
$(current_column).append("<input type='hidden' name='"+name+"' value='"+val+"' />");
} else if ( i == 4 || i == 5 || i == 25 ) {
} else if ( i == 4 || i == 5 || i == 24 || i == 25 || i == 26 ) {
// If the value is not an integer for
// - "Current checkouts allowed"
// - "Current on-site checkouts allowed"
// - "Holds allowed (total)"
// - "Holds allowed (daily)"
// - "Holds per record (count)"
// 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)) ) {