Bugzilla – Attachment 153772 Details for
Bug 33940
Move get_cardnumber_length and checkcardnumber to Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33940: Consider NULL as valid
Bug-33940-Consider-NULL-as-valid.patch (text/plain), 1.89 KB, created by
Jonathan Druart
on 2023-07-21 10:10:21 UTC
(
hide
)
Description:
Bug 33940: Consider NULL as valid
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-07-21 10:10:21 UTC
Size:
1.89 KB
patch
obsolete
>From 7e96274e043d02b66a3ae53099bb9974d47f7677 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 21 Jul 2023 10:46:41 +0200 >Subject: [PATCH] Bug 33940: Consider NULL as valid > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > Koha/Policy/Patrons/Cardnumber.pm | 2 +- > t/db_dependent/Koha/Policy/Patrons/Cardnumber.t | 5 ++++- > 2 files changed, 5 insertions(+), 2 deletions(-) > >diff --git a/Koha/Policy/Patrons/Cardnumber.pm b/Koha/Policy/Patrons/Cardnumber.pm >index 43eb124050f..1d3ec4cbe3f 100644 >--- a/Koha/Policy/Patrons/Cardnumber.pm >+++ b/Koha/Policy/Patrons/Cardnumber.pm >@@ -51,7 +51,7 @@ Returns whether a cardnumber is valid of not for a given I<Koha::Patron> object. > sub is_valid { > my ( $class, $cardnumber, $patron ) = @_; > >- return Koha::Result::Boolean->new(0)->add_message( { message => "is_empty" } ) >+ return Koha::Result::Boolean->new(1) > unless defined $cardnumber; > > return Koha::Result::Boolean->new(0)->add_message( { message => "already_exists" } ) >diff --git a/t/db_dependent/Koha/Policy/Patrons/Cardnumber.t b/t/db_dependent/Koha/Policy/Patrons/Cardnumber.t >index 7937cb412c7..e08ccb3976a 100755 >--- a/t/db_dependent/Koha/Policy/Patrons/Cardnumber.t >+++ b/t/db_dependent/Koha/Policy/Patrons/Cardnumber.t >@@ -31,7 +31,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'is_valid' => sub { > >- plan tests => 21; >+ plan tests => 23; > > $schema->storage->txn_begin; > >@@ -92,6 +92,9 @@ subtest 'is_valid' => sub { > ok( !$policy->is_valid( q{1234567890123456} ), "1234567890123456 is longer than $pref"); > ok( !$policy->is_valid( q{1234567890} ), "1234567890 is longer than $pref"); > >+ ok( $policy->is_valid(undef), "If cardnumber is null, we assume they're allowed") ; >+ ok( !$policy->is_valid(""), "Empty string is not correct" ); >+ > $schema->storage->txn_rollback; > }; > >-- >2.25.1
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 33940
:
152109
|
153758
|
153759
|
153763
|
153764
|
153766
|
153768
|
153769
|
153770
|
153771
|
153772
|
153773
|
155687
|
155688
|
155689