Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t
authorFridolin Somers <fridolin.somers@biblibre.com>
Tue, 17 Aug 2021 20:19:29 +0000 (10:19 -1000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 18 Aug 2021 12:40:51 +0000 (12:40 +0000)
commit508aa6837cfb2a5c0600e6f51b66c92870d58763
tree316e5619713c9e019912daf91be87054162a4961
parent17f4de73a422b60122dcc00d129ba647c537c68b
Bug 28873: Fix age displayed in db_dependent/Koha/Patrons.t

In test suite db_dependent/Koha/Patrons.t actually shows :

    1..10
    ok 1 - Patron with no dateofbirth is always valid for any category
    ok 2 - Today=2020-02-28, dob=2015-03-01, is 5, should be valid=0
    ok 3 - Today=2020-02-28, dob=2015-02-27, is 5, should be valid=1
    ok 4 - Today=2020-02-28, dob=2009-02-28, is 11, should be valid=0
    ok 5 - Today=2020-02-28, dob=2015-02-28, is 7, should be valid=1
    ok 6 - Today=2020-02-28, dob=2009-02-27, is 11, should be valid=0
    ok 7 - Today=2020-02-28, dob=2016-08-27, is 3, should be valid=0
    ok 8 - Today=2020-02-28, dob=2009-03-01, is 11, should be valid=1
    ok 9 - Today=2020-02-28, dob=2007-08-27, is 12, should be valid=0
    ok 10 - Today=2020-02-28, dob=2015-02-28, is 5, should be valid=1

Some ages are incorrect :

1) dob=2009-03-01, is 11
=> it is age 10
so valid=1 in category 5 to 10

2) dob=2015-03-01, is 5
=> it is age 4
so valid=0 in category 5 to 10

3) dob=2015-02-28, is 7
=> this date of birth is already tested
I suppose here dob is wrong, age wanted is 7 in the middle of age restrictions.
so dob=2013-02-28

This patch fixes ages.
Also adds the category code 'AGE_5_10' in messages to display age limits

Test plan :
Run prove -v t/db_dependent/Koha/Patrons.t without and with patch

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha/Patrons.t