Bugzilla – Attachment 109230 Details for
Bug 26307
Changing patron category should check age limits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26307: Fix misc/cronjobs/update_patrons_category.pl --too_old acts a year too early
Bug-26307-Fix-misccronjobsupdatepatronscategorypl-.patch (text/plain), 2.34 KB, created by
Fridolin Somers
on 2020-08-27 14:06:18 UTC
(
hide
)
Description:
Bug 26307: Fix misc/cronjobs/update_patrons_category.pl --too_old acts a year too early
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2020-08-27 14:06:18 UTC
Size:
2.34 KB
patch
obsolete
>From 0022de248a7b3d9e0cfbe30b94f5b3e18e4c639a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Thu, 27 Aug 2020 14:28:02 +0200 >Subject: [PATCH] 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" >--- > Koha/Patrons.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/Koha/Patrons.pm b/Koha/Patrons.pm >index 3b3b4b1cb6..22e957ad54 100644 >--- a/Koha/Patrons.pm >+++ b/Koha/Patrons.pm >@@ -391,8 +391,8 @@ 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); >- $search_params->{dateofbirth}{'<'} = $dtf->format_datetime( $date_before ); >+ my $date_before = dt_from_string()->subtract( years => ( $cat_from->upperagelimit + 1 ) ); >+ $search_params->{dateofbirth}{'<='} = $date_before->strftime("%Y-%m-%d"); > } > } > if ($params->{fine_min} || $params->{fine_max}) { >-- >2.27.0
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 26307
:
109229
|
109230
|
109231
|
109232