Bug 24669: Show "Unlimited" values correctly in smart-rules.pl
authorJoonas Kylmälä <joonas.kylmala@helsinki.fi>
Mon, 17 Feb 2020 10:32:26 +0000 (10:32 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Wed, 19 Feb 2020 11:28:24 +0000 (11:28 +0000)
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>

koha-tmpl/intranet-tmpl/prog/en/modules/admin/smart-rules.tt

index ed737af..e40138b 100644 (file)
                                             <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>
                             // 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)) ) {