Bug 108661: (follow-up) enshrine letting CardnumberLength specify just a maximum
authorGalen Charlton <gmc@esilibrary.com>
Wed, 12 Mar 2014 03:33:50 +0000 (03:33 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 12 Mar 2014 04:07:03 +0000 (04:07 +0000)
commit556eb677186b738c036fd13a7cc3461c3f8c3d48
tree7da5932d1e9315252d415f3457091788cc722df0
parent22593e2e9b613bd03fd42100e60f9a1da53476d9
Bug 108661: (follow-up) enshrine letting CardnumberLength specify just a maximum

This patch finishes the work started in one of the previous
follow-ups and allows CardnumberLength to be set to a value
like ',5'.  In conjunction with not including cardnumber in
BorrowerMandatoryField, this allows a cardnumber to not be
required but, if present, to not exceed the specified length.

This patch also updates t/db_dependent/Members.t so that
it runs in a transaction, tests the new return value
of checkcardnumber, and manages the CardnumberLength syspref.

To test:

[1] Verify that prove -v t/db_dependent/Members.t and
    prove -v t/Members/cardnumber.t pass.
[2] Set CardnumberLength to ",5" and take cardnubmer out of
    the BorrowerMandatoryField list.
[3] Verify that you can save a patron record without a cardnumber,
    but if you supply one, that it can be at most 5 characters long.
[4] Add cardnumber back to BorrowerMandatoryField.  This time, the
    minimum length is 1 even though CardnumberLength is ",5".

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Members.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
t/Members/cardnumber.t
t/db_dependent/Members.t