Bugzilla – Attachment 128237 Details for
Bug 26311
Add patron invalid age to search_for_data_inconsistencies.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits
Bug-26311-follow-up-loop-through-the-patron-with-d.patch (text/plain), 2.86 KB, created by
Fridolin Somers
on 2021-12-03 21:14:08 UTC
(
hide
)
Description:
Bug 26311: (follow-up) loop through the patron with date of birth and in categories having age limits
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2021-12-03 21:14:08 UTC
Size:
2.86 KB
patch
obsolete
>From eb006489aad327212e7dbbd2023661e95bde7f4d Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Wed, 30 Sep 2020 11:51:22 +0200 >Subject: [PATCH] Bug 26311: (follow-up) loop through the patron with date of > birth and in categories having age limits > >Also added category limits in message, for example (12-18) > >Check patron : >- with no date of birth >- with invalid age in category having age required >- with invalid age in category having upper age limit >- with invalid age in category having age required and upper age limit >--- > .../search_for_data_inconsistencies.pl | 31 +++++++++++++++---- > 1 file changed, 25 insertions(+), 6 deletions(-) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index 046d72bd36..e8d18f698c 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -229,16 +229,35 @@ use C4::Biblio qw( GetMarcFromKohaField ); > } > > { >- my $patrons = Koha::Patrons->search( {}, { order_by => [ 'categorycode', 'borrowernumber' ] } ); >+ my $aging_patrons = Koha::Patrons->search( >+ { >+ -not => { >+ -or => { >+ 'me.dateofbirth' => undef, >+ -and => { >+ 'categorycode.dateofbirthrequired' => undef, >+ 'categorycode.upperagelimit' => undef, >+ } >+ } >+ } >+ }, >+ { join => { 'categorycode' => 'borrowers' } }, >+ { order_by => [ 'me.categorycode', 'me.borrowernumber' ] }, >+ ); > my @invalid_patrons; >- while ( my $patron = $patrons->next ) { >- push @invalid_patrons, $patron unless $patron->is_valid_age; >+ while ( my $aging_patron = $aging_patrons->next ) { >+ warn $aging_patron->borrowernumber; >+ push @invalid_patrons, $aging_patron unless $aging_patron->is_valid_age; > } > if (@invalid_patrons) { > new_section("Patrons with invalid age for category"); >- foreach my $patron (@invalid_patrons) { >- new_item( sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s'", >- $patron->borrowernumber, $patron->get_age, $patron->category->categorycode, ); >+ foreach my $invalid_patron (@invalid_patrons) { >+ my $category = $invalid_patron->category; >+ new_item( >+ sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s' (%s-%s)", >+ $invalid_patron->borrowernumber, $invalid_patron->get_age, $category->categorycode, >+ $category->dateofbirthrequired, $category->upperagelimit >+ ); > } > new_hint("You may change the patron's category automatically with misc/cronjobs/update_patrons_category.pl"); > } >-- >2.34.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 26311
:
109239
|
110106
|
110130
|
110131
|
110978
|
110979
|
110980
|
110998
|
128235
|
128236
|
128237
|
131295
|
131296
|
131297
|
132978
|
136665
|
136666
|
136667
|
136668
|
136750
|
136751
|
136752
|
136753
|
137039
|
137040
|
137041
|
137042
|
137043