[Koha-bugs] [Bug 33940] Move get_cardnumber_length and checkcardnumber to Koha

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 21 10:30:50 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=33940

--- Comment #8 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to Marcel de Rooy from comment #6)
> -    # If cardnumber is null, we assume they're allowed.
> -    return 0 unless defined $cardnumber;
> 
> +    return Koha::Result::Boolean->new(0)->add_message( { message =>
> "is_empty" } )
> +        unless defined $cardnumber;
> 
> The former routine returned 0 meaning OK.
> The new routine returns 0 meaning false.
> You are changing behavior. Mabye I just dont wanna use cardnumber.

I don't understand the problem. I am also changing if with unless...

-        if ( my $error_code = checkcardnumber($cardnumber) ) {
+        unless ( $is_cardnumber_valid ) {

> Not sure if it is needed to make a distinction here btw between null and
> empty string.
> Currently, message => "is_empty" should read is_undefined.
> 
> We miss tests for this situation.

empty string will be caught by invalid_length
unless defined (returning is_empty)

Rereading the code:
-    # If cardnumber is null, we assume they're allowed.
-    return 0 unless defined $cardnumber;

+    return Koha::Result::Boolean->new(0)->add_message( { message => "is_empty"
} )
+        unless defined $cardnumber;

So there might be a change in behaviour here.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list