Koha treats patron categories upper age limit inconsistently. E.g. if child patron category's upper age limit is 18, one is still able to add child patron who is 18 years old. However, when cronjob update_patrons_category.pl is run, patrons over and exactly aged 18 are considered overaged and their categorycode is updated. We should either fix patron creation or cronjob to avoid confusion. To test: 1. Add upper age limit as 18 for child patron category. 2. Create a child patron whose age is 18. 3. Save. => Patron is saved successfully. 4. Run cronjob update_patrons_category.pl with verbose option. perl update_patrons_category.pl --too_old --from CHILD --to ADULT -v => Note that patron is reported as updated (or would have updated) as an adult patron.
We need this functionality. We had this in our previous library system so moving to Koha and this not working correctly is a problem for us as it has created a manual task for system admins.
This is because the calculation of whether a user is over the upperagelimit or not in Patrons.pm is incorrect. For example, a user is not over the age of 11 until their 12th birthday. See this url for a patch that I think would resolve this which I've tested on 24.11: https://github.com/kbwhizz/kohafixes/commit/087ca86dc12d6d42242732dce86bd6a34d685a07
Created attachment 179417 [details] [review] Bug 32604: Correct boundary calculation for birthdate Add 1 to upperagelimit to make it calculate birthday boundaries correctly for patrons_to_update_category search To test: 1. Add upper age limit as 18 for child patron category. 2. Create a child patron whose age is 18. 3. Save. => Patron is saved successfully. 4. Run cronjob update_patrons_category.pl with verbose option. perl update_patrons_category.pl --too_old --from CHILD --to ADULT -v => Note that patron is reported as updated (or would have updated) as an adult patron. 5. Apply patch 6. Re-run steps 1 to 5 and note we no long update the 18 year olds. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 179422 [details] [review] Bug 32604: Correct boundary calculation for birthdate Add 1 to upperagelimit to make it calculate birthday boundaries correctly for patrons_to_update_category search To test: 1. Add upper age limit as 18 for child patron category. 2. Create a child patron whose age is 18. 3. Save. => Patron is saved successfully. 4. Run cronjob update_patrons_category.pl with verbose option. perl update_patrons_category.pl --too_old --from CHILD --to ADULT -v => Note that patron is reported as updated (or would have updated) as an adult patron. 5. Apply patch 6. Re-run steps 1 to 5 and note we no long update the 18 year olds. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 179423 [details] [review] Bug 32604: Unit tests Add unit tests to more thoroughly and specifically cover the search_patrons_to_update_category method including specific date handling tests. We also add some notes to the POD that were highlighted by writing comprehensive tests. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Bernard wrote the original work here, I just tidied it up for submission and then added unit tests. Leaving it as assigned (and committed) by him so he gets the recognition and adding my own signoff as I've thoroughly tested it.
Created attachment 179434 [details] [review] Bug 32604: Correct boundary calculation for birthdate Add 1 to upperagelimit to make it calculate birthday boundaries correctly for patrons_to_update_category search To test: 1. Add upper age limit as 18 for child patron category. 2. Create a child patron whose age is 18. 3. Save. => Patron is saved successfully. 4. Run cronjob update_patrons_category.pl with verbose option. perl update_patrons_category.pl --too_old --from CHILD --to ADULT -v => Note that patron is reported as updated (or would have updated) as an adult patron. 5. Apply patch 6. Re-run steps 1 to 5 and note we no long update the 18 year olds. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Created attachment 179435 [details] [review] Bug 32604: Unit tests Add unit tests to more thoroughly and specifically cover the search_patrons_to_update_category method including specific date handling tests. We also add some notes to the POD that were highlighted by writing comprehensive tests. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Emmi Takkinen <emmi.takkinen@koha-suomi.fi>
Tested and everything works as expected.
Promoting Emmi's Signoff to a PQA.. two solid sets of eyes on this :)
FAIL Koha/Patrons.pm FAIL spelling precidence ==> precedence Fixed inline.
Pushed for 25.05! Well done everyone, thank you!