Lines 229-244
use C4::Biblio qw( GetMarcFromKohaField );
Link Here
|
229 |
} |
229 |
} |
230 |
|
230 |
|
231 |
{ |
231 |
{ |
232 |
my $patrons = Koha::Patrons->search( {}, { order_by => [ 'categorycode', 'borrowernumber' ] } ); |
232 |
my $aging_patrons = Koha::Patrons->search( |
|
|
233 |
{ |
234 |
-not => { |
235 |
-or => { |
236 |
'me.dateofbirth' => undef, |
237 |
-and => { |
238 |
'categorycode.dateofbirthrequired' => undef, |
239 |
'categorycode.upperagelimit' => undef, |
240 |
} |
241 |
} |
242 |
} |
243 |
}, |
244 |
{ join => { 'categorycode' => 'borrowers' } }, |
245 |
{ order_by => [ 'me.categorycode', 'me.borrowernumber' ] }, |
246 |
); |
233 |
my @invalid_patrons; |
247 |
my @invalid_patrons; |
234 |
while ( my $patron = $patrons->next ) { |
248 |
while ( my $aging_patron = $aging_patrons->next ) { |
235 |
push @invalid_patrons, $patron unless $patron->is_valid_age; |
249 |
warn $aging_patron->borrowernumber; |
|
|
250 |
push @invalid_patrons, $aging_patron unless $aging_patron->is_valid_age; |
236 |
} |
251 |
} |
237 |
if (@invalid_patrons) { |
252 |
if (@invalid_patrons) { |
238 |
new_section("Patrons with invalid age for category"); |
253 |
new_section("Patrons with invalid age for category"); |
239 |
foreach my $patron (@invalid_patrons) { |
254 |
foreach my $invalid_patron (@invalid_patrons) { |
240 |
new_item( sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s'", |
255 |
my $category = $invalid_patron->category; |
241 |
$patron->borrowernumber, $patron->get_age, $patron->category->categorycode, ); |
256 |
new_item( |
|
|
257 |
sprintf "Patron borrowernumber=%s has an invalid age of %s for their category '%s' (%s-%s)", |
258 |
$invalid_patron->borrowernumber, $invalid_patron->get_age, $category->categorycode, |
259 |
$category->dateofbirthrequired, $category->upperagelimit |
260 |
); |
242 |
} |
261 |
} |
243 |
new_hint("You may change the patron's category automatically with misc/cronjobs/update_patrons_category.pl"); |
262 |
new_hint("You may change the patron's category automatically with misc/cronjobs/update_patrons_category.pl"); |
244 |
} |
263 |
} |
245 |
- |
|
|