[Koha-bugs] [Bug 26307] misc/cronjobs/update_patrons_category.pl --too_old acts a year too early

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Aug 27 16:06:18 CEST 2020


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

--- Comment #3 from Fridolin SOMERS <fridolin.somers at biblibre.com> ---
Created attachment 109230
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=109230&action=edit
Bug 26307: Fix misc/cronjobs/update_patrons_category.pl --too_old acts a year
too early

misc/cronjobs/update_patrons_category.pl --too_old must change category when
the age of the patron is greater than (exclusive) limit age of the category.
Actually it changes a year too early : he goes to a min 18 years category
having reached 17 years.

Patch also changes the compare to 'lower and equal' and uses date
without time
=> so that update occures at birthday aniversary day

See logic in previous patch.
And code in Koha::Patron : get_age() and is_valid_age.

Test plan :
1) Create a child patron category 'C' with upper limit 17 years
2) Create an adult patron category 'A'
3) Create a patron in child category with date of birth = today - 18
   years + 1 day
4) Check patron as age : 17 years 11 months
5) Without patch run :
misc/cronjobs/update_patrons_category.pl -f=ENF -t=ADULT --too_old -v
=> You see the patron
6) apply patch
7) Re-run 5)
=> You dont see the patron
8) Update database to change patron date of birth = today - 18 years
mysql > update borrowers set dateofbirth='YYYY-MM-DD' where borrowernumber=XXX;
9) Run :
misc/cronjobs/update_patrons_category.pl -f=ENF -t=ADULT --too_old -v --confirm
10) Check patron category is now 'A'
11) Check you dont see message "Patron's age is incorrect for their category"

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


More information about the Koha-bugs mailing list