Bugzilla – Attachment 179422 Details for
Bug 32604
Patron categories upper age limit not respected when creating a patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32604: Correct boundary calculation for birthdate
Bug-32604-Correct-boundary-calculation-for-birthda.patch (text/plain), 1.65 KB, created by
Martin Renvoize (ashimema)
on 2025-03-18 09:22:46 UTC
(
hide
)
Description:
Bug 32604: Correct boundary calculation for birthdate
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-03-18 09:22:46 UTC
Size:
1.65 KB
patch
obsolete
>From 7ee177a724dad71d354e987c0889e33926c20052 Mon Sep 17 00:00:00 2001 >From: Bernard Scaife <kbwhizz1@gmail.com> >Date: Mon, 17 Mar 2025 18:07:02 +0000 >Subject: [PATCH] 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> >--- > Koha/Patrons.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 0f1dcaf8122..a0ad8a9fe0d 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -384,7 +384,9 @@ sub search_patrons_to_update_category { > $search_params->{dateofbirth}{'>'} = $dtf->format_datetime($date_after); > } > if ( $cat_from->upperagelimit && $params->{too_old} ) { >- my $date_before = dt_from_string()->subtract( years => $cat_from->upperagelimit ); >+ >+ # Must be `upperagelimit + 1` years old (e.g., if limit is 17, query for 18+) >+ my $date_before = dt_from_string()->subtract( years => $cat_from->upperagelimit + 1 ); > $search_params->{dateofbirth}{'<'} = $dtf->format_datetime($date_before); > } > } >-- >2.48.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32604
:
179417
|
179422
|
179423
|
179434
|
179435