From feb6d0e2c14b4679c4ad7cb9f697b3200a68e7c7 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Tue, 12 Nov 2024 21:31:02 -0800 Subject: [PATCH] Bug 29818: Cannot save subscription frequency without display order The schema says that subscription_frequencies.displayorder can be null, and everything else deals with it being null just fine, but if you try to save a new frequency without specifying display order with strict_sql_modes set, you get an error. Test plan: 1. Without the patch, Serials - Manage frequencies - New frequency 2. Description is mandatory, so fill it in, then click Save 3. Boom! Apply patch, restart_all 4. Repeat steps 1-2, and verify that no error is thrown and the new frequency shows up (at the top of the list since nothing comes before something) 5. New frequency, fill in Description, try typing something other than a number in Display order and saving. You should be told to follow the directions that only numeric characters are allowed Sponsored-by: Chetco Community Public Library Signed-off-by: David Nind Signed-off-by: Aleisha Amohia Signed-off-by: Katrin Fischer (cherry picked from commit 77c003ed544d653345acf4debe968110ea94a1fd) Signed-off-by: Lucas Gass (cherry picked from commit 20c59c0171738f162f4ff68a3febdc46596342c1) Signed-off-by: Fridolin Somers --- .../prog/en/modules/serials/subscription-frequencies.tt | 3 ++- serials/subscription-frequencies.pl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt index d386f51d6f..02a1eed177 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-frequencies.tt @@ -89,7 +89,8 @@
  • - + + Only numeric characters are allowed
  • diff --git a/serials/subscription-frequencies.pl b/serials/subscription-frequencies.pl index 86d14fccd2..1cdcd0d47e 100755 --- a/serials/subscription-frequencies.pl +++ b/serials/subscription-frequencies.pl @@ -75,7 +75,8 @@ if($op && ($op eq 'savenew' || $op eq 'savemod')) { foreach (qw/ description unit issuesperunit unitsperissue displayorder /) { $frequency->{$_} = $input->param($_); } - $frequency->{unit} = undef if $frequency->{unit} eq ''; + $frequency->{unit} = undef if $frequency->{unit} eq ''; + $frequency->{displayorder} = undef if $frequency->{displayorder} eq ''; foreach (qw/issuesperunit unitsperissue/) { $frequency->{$_} = 1 if $frequency->{$_} !~ /\d+/; } -- 2.39.5