Add a new rule, leave holds values empty and save. After saving, the values show in the table as 'unlimitd' Edit the rule, the editor shows the values not empty, but the string 'unlimited'. Saving the rule now without fixing this means you can no longer place holds.
Created attachment 99079 [details] [review] Bug 24669: Improve numeric input handling in smart-rules.pl This removes code duplication by introducing a new subroutine strip_non_numeric() that removes whitespace and makes the rule value '' if it is a string value instead of a digit. The call to strip_non_numeric() is now added also to all the rules it is needed in. To test: 1. Write some string like "test" to rules: - Current checkouts allowed - Current on-site checkouts allowed - Holds allowed (total) - Holds allowed (daily) - Holds per record (count) - Holds per record (count) – can be found in default policy 2. Save rules 3. Apply patch 4. Edit the rule line where you just typed all those strings and save 5. Notice how the values are now empty strings (some say "unlimited" but if you go check from DB it should show empty value there) Sponsored-by: The National Library of Finland
Created attachment 99080 [details] [review] 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
Created attachment 99171 [details] [review] Bug 24669: Improve numeric input handling in smart-rules.pl This removes code duplication by introducing a new subroutine strip_non_numeric() that removes whitespace and makes the rule value '' if it is a string value instead of a digit. The call to strip_non_numeric() is now added also to all the rules it is needed in. To test: 1. Write some string like "test" to rules: - Current checkouts allowed - Current on-site checkouts allowed - Holds allowed (total) - Holds allowed (daily) - Holds per record (count) - Holds per record (count) – can be found in default policy 2. Save rules 3. Apply patch 4. Edit the rule line where you just typed all those strings and save 5. Notice how the values are now empty strings (some say "unlimited" but if you go check from DB it should show empty value there) Sponsored-by: The National Library of Finland Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 99172 [details] [review] 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>
Created attachment 99216 [details] [review] Bug 24669: Improve numeric input handling in smart-rules.pl This removes code duplication by introducing a new subroutine strip_non_numeric() that removes whitespace and makes the rule value '' if it is a string value instead of a digit. The call to strip_non_numeric() is now added also to all the rules it is needed in. To test: 1. Write some string like "test" to rules: - Current checkouts allowed - Current on-site checkouts allowed - Holds allowed (total) - Holds allowed (daily) - Holds per record (count) - Holds per record (count) – can be found in default policy 2. Save rules 3. Apply patch 4. Edit the rule line where you just typed all those strings and save 5. Notice how the values are now empty strings (some say "unlimited" but if you go check from DB it should show empty value there) 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>
Created attachment 99217 [details] [review] 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>
Thanks for the quick followup here Joonas, Passing QA
Nice work everyone! Pushed to master for 20.05
Created attachment 99251 [details] [review] Bug 24669: Fix selenium test There is one more "Unlimited" on the circ rules now.
not backporting to 19.11.x due to missing dependencies