Bugzilla – Attachment 57462 Details for
Bug 15690
Unconstrained CardnumberLength preference conflicts with table column limit of 16
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15690: CardnumberLength should not be bigger than 16
Bug-15690-CardnumberLength-should-not-be-bigger-th.patch (text/plain), 3.25 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-11-12 03:23:18 UTC
(
hide
)
Description:
Bug 15690: CardnumberLength should not be bigger than 16
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-11-12 03:23:18 UTC
Size:
3.25 KB
patch
obsolete
>From 60a57b0657f0071abec09530f9e0b066e92eb434 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 13 Sep 2016 15:43:50 +0100 >Subject: [PATCH] Bug 15690: CardnumberLength should not be bigger than 16 > >borrowers.cardnumber is a varchar(16), so CardnumberLength should not >have a max > 16 > >Test plan: >Test different value in CardnumberLength ("20", "20,30", "40,") >Edit a patron a make sure the text display under the cardnumber input is >correct > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >Signed-off-by: Marc <veron@veron.ch> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > C4/Members.pm | 1 + > .../prog/en/modules/admin/preferences/patrons.pref | 2 +- > t/Members/cardnumber.t | 10 +++++++++- > 3 files changed, 11 insertions(+), 2 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index eecb653..287a270 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1102,6 +1102,7 @@ sub get_cardnumber_length { > } > > } >+ $min = 16 if $min > 16; > return ( $min, $max ); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 62a42c7..d2eb139 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >@@ -165,7 +165,7 @@ Patrons: > - Card numbers for patrons must be > - pref: CardnumberLength > - "characters long. The length can be a single number to specify an exact length, a range separated by a comma (i.e., 'Min,Max'), or a maximum with no minimum (i.e., ',Max')." >- - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one." >+ - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one. Maximum cannot be bigger than 16." > - > - pref: useDischarge > choices: >diff --git a/t/Members/cardnumber.t b/t/Members/cardnumber.t >index b2ec79f..deb76de 100644 >--- a/t/Members/cardnumber.t >+++ b/t/Members/cardnumber.t >@@ -1,7 +1,7 @@ > #!/usr/bin/env perl > > use Modern::Perl; >-use Test::More tests => 23; >+use Test::More tests => 25; > > use t::lib::Mocks; > >@@ -67,5 +67,13 @@ is( C4::Members::checkcardnumber( q{1234567890123456} ), 2, "1234567890123456 is > $dbh->{mock_add_resultset} = $rs; > is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref"); > >+$pref = q|,40|; # max 40 chars, not allowed >+t::lib::Mocks::mock_preference('CardnumberLength', $pref); >+is_deeply( [ C4::Members::get_cardnumber_length() ], [ 0, 16 ], ',40 => min=0 and max=16'); >+$dbh->{mock_add_resultset} = $rs; >+is( C4::Members::checkcardnumber( q{12345678901234567890} ), 2, "12345678901234567890 is longer than $pref => 16 is max!"); >+ >+$pref = q|,8|; # max 8 chars >+t::lib::Mocks::mock_preference('CardnumberLength', $pref); > t::lib::Mocks::mock_preference('BorrowerMandatoryField', 'cardnumber'); > is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8 if cardnumber is mandatory'); >-- >2.10.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 15690
:
55540
|
55573
|
55575
|
55576
|
55620
|
55621
| 57462 |
57463