View | Details | Raw Unified | Return to bug 15690
Collapse All | Expand All

(-)a/C4/Members.pm (+1 lines)
Lines 1156-1161 sub get_cardnumber_length { Link Here
1156
        }
1156
        }
1157
1157
1158
    }
1158
    }
1159
    $min = 16 if $min > 16;
1159
    return ( $min, $max );
1160
    return ( $min, $max );
1160
}
1161
}
1161
1162
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 160-166 Patrons: Link Here
160
         - Card numbers for patrons must be
160
         - Card numbers for patrons must be
161
         - pref: CardnumberLength
161
         - pref: CardnumberLength
162
         - "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')."
162
         - "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')."
163
         - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one."
163
         - "If 'cardnumber' is included in the BorrowerMandatoryField list, the minimum length, if not specified here, defaults to one. Maximum cannot be bigger than 16."
164
     -
164
     -
165
         - pref: useDischarge
165
         - pref: useDischarge
166
           choices:
166
           choices:
(-)a/t/Members/cardnumber.t (-2 / +9 lines)
Lines 1-7 Link Here
1
#!/usr/bin/env perl
1
#!/usr/bin/env perl
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use Test::More tests => 23;
4
use Test::More tests => 25;
5
5
6
use t::lib::Mocks;
6
use t::lib::Mocks;
7
7
Lines 67-71 is( C4::Members::checkcardnumber( q{1234567890123456} ), 2, "1234567890123456 is Link Here
67
$dbh->{mock_add_resultset} = $rs;
67
$dbh->{mock_add_resultset} = $rs;
68
is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref");
68
is( C4::Members::checkcardnumber( q{1234567890} ), 2, "1234567890 is longer than $pref");
69
69
70
$pref = q|,40|; # max 40 chars, not allowed
71
t::lib::Mocks::mock_preference('CardnumberLength', $pref);
72
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 0, 16 ], ',40 => min=0 and max=16');
73
$dbh->{mock_add_resultset} = $rs;
74
is( C4::Members::checkcardnumber( q{12345678901234567890} ), 2, "12345678901234567890 is longer than $pref => 16 is max!");
75
76
$pref = q|,8|; # max 8 chars
77
t::lib::Mocks::mock_preference('CardnumberLength', $pref);
70
t::lib::Mocks::mock_preference('BorrowerMandatoryField', 'cardnumber');
78
t::lib::Mocks::mock_preference('BorrowerMandatoryField', 'cardnumber');
71
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8 if cardnumber is mandatory');
79
is_deeply( [ C4::Members::get_cardnumber_length() ], [ 1, 8 ], ',8 => min=1 and max=8 if cardnumber is mandatory');
72
- 

Return to bug 15690