Bugzilla – Attachment 160248 Details for
Bug 28012
Error on saving new numbering pattern
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28012: Use definedness test instead of bool when checking whether to null fields
Bug-28012-Use-definedness-test-instead-of-bool-whe.patch (text/plain), 2.95 KB, created by
Nick Clemens (kidclamp)
on 2023-12-22 15:34:42 UTC
(
hide
)
Description:
Bug 28012: Use definedness test instead of bool when checking whether to null fields
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-12-22 15:34:42 UTC
Size:
2.95 KB
patch
obsolete
>From ab6b61fa734355ea1a759d9ec2949efd347e8095 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= <joonas.kylmala@iki.fi> >Date: Sat, 3 Sep 2022 13:37:31 +0300 >Subject: [PATCH] Bug 28012: Use definedness test instead of bool when checking > whether to null fields > >Saving a new numbering pattern didn't work without having to fill all >the fields, even those that are not mandatory. > >To test: > 1) Go to /cgi-bin/koha/serials/subscription-numberpatterns.pl > and try creating a new pattern, notice that only Name and > Description are mandatory after applying this patch > 2) Make sure editing existing numbering patterns still works > >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > serials/subscription-numberpatterns.pl | 21 ++++++++++++--------- > 1 file changed, 12 insertions(+), 9 deletions(-) > >diff --git a/serials/subscription-numberpatterns.pl b/serials/subscription-numberpatterns.pl >index a9bc998835b..1669b4d66fd 100755 >--- a/serials/subscription-numberpatterns.pl >+++ b/serials/subscription-numberpatterns.pl >@@ -43,6 +43,12 @@ use C4::Serials::Numberpattern qw( > ); > use C4::Serials::Frequency qw( GetSubscriptionFrequencies ); > >+my @NUMBERPATTERN_FIELDS = qw/ >+ label description numberingmethod displayorder >+ label1 label2 label3 add1 add2 add3 every1 every2 every3 >+ setto1 setto2 setto3 whenmorethan1 whenmorethan2 whenmorethan3 >+ numbering1 numbering2 numbering3 /; >+ > my $input = CGI->new; > my ($template, $loggedinuser, $cookie, $flags) = get_template_and_user( { > template_name => 'serials/subscription-numberpatterns.tt', >@@ -56,12 +62,9 @@ my $op = $input->param('op'); > if($op && $op eq 'savenew') { > my $label = $input->param('label'); > my $numberpattern; >- foreach(qw/ label description numberingmethod displayorder >- label1 label2 label3 add1 add2 add3 every1 every2 every3 >- setto1 setto2 setto3 whenmorethan1 whenmorethan2 whenmorethan3 >- numbering1 numbering2 numbering3 /) { >+ foreach(@NUMBERPATTERN_FIELDS) { > $numberpattern->{$_} = $input->param($_); >- if($numberpattern->{$_} and $numberpattern->{$_} eq '') { >+ if(defined $numberpattern->{$_} and $numberpattern->{$_} eq '') { > $numberpattern->{$_} = undef; > } > } >@@ -86,11 +89,11 @@ if($op && $op eq 'savenew') { > } > } > if($mod_ok) { >- foreach(qw/ id label description numberingmethod displayorder >- label1 label2 label3 add1 add2 add3 every1 every2 every3 >- setto1 setto2 setto3 whenmorethan1 whenmorethan2 whenmorethan3 >- numbering1 numbering2 numbering3 /) { >+ foreach(@NUMBERPATTERN_FIELDS) { > $numberpattern->{$_} = $input->param($_) || undef; >+ if(defined $numberpattern->{$_} and $numberpattern->{$_} eq '') { >+ $numberpattern->{$_} = undef; >+ } > } > ModSubscriptionNumberpattern($numberpattern); > } else { >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28012
:
140196
|
140197
|
140322
|
140337
|
141947
|
141948
| 160248 |
160249
|
160250