From f5d75a8fe38a056b00e6d9acd5d9eafb4528b2fb 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 --- .../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 ed4b28816a..2e9515f956 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 @@ -117,7 +117,8 @@
  • - + + Only numeric characters are allowed
  • diff --git a/serials/subscription-frequencies.pl b/serials/subscription-frequencies.pl index 77fa4c268b..8378f3be81 100755 --- a/serials/subscription-frequencies.pl +++ b/serials/subscription-frequencies.pl @@ -75,7 +75,8 @@ if($op && ($op eq 'cud-savenew' || $op eq 'cud-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.44.0