View | Details | Raw Unified | Return to bug 25958
Collapse All | Expand All

(-)a/misc/cronjobs/longoverdue.pl (-6 / +11 lines)
Lines 298-303 sub bounds { Link Here
298
298
299
# FIXME - This sql should be inside the API.
299
# FIXME - This sql should be inside the API.
300
sub longoverdue_sth {
300
sub longoverdue_sth {
301
    my ( $params ) = @_;
302
    my $skip_lost_values = $params->{skip_lost_values};
303
304
    my $skip_lost_values_sql = q{};
305
    if ( @$skip_lost_values ) {
306
        my $values = join( ',', map { qq{'$_'} } @$skip_lost_values );
307
        $skip_lost_values_sql = "AND itemlost NOT IN ( $values )"
308
    }
309
301
    my $query = "
310
    my $query = "
302
    SELECT items.itemnumber, borrowernumber, date_due, itemlost
311
    SELECT items.itemnumber, borrowernumber, date_due, itemlost
303
      FROM issues, items
312
      FROM issues, items
Lines 305-310 sub longoverdue_sth { Link Here
305
      AND  DATE_SUB(CURDATE(), INTERVAL ? DAY)  > date_due
314
      AND  DATE_SUB(CURDATE(), INTERVAL ? DAY)  > date_due
306
      AND  DATE_SUB(CURDATE(), INTERVAL ? DAY) <= date_due
315
      AND  DATE_SUB(CURDATE(), INTERVAL ? DAY) <= date_due
307
      AND  itemlost <> ?
316
      AND  itemlost <> ?
317
      $skip_lost_values_sql
308
     ORDER BY date_due
318
     ORDER BY date_due
309
    ";
319
    ";
310
    return C4::Context->dbh->prepare($query);
320
    return C4::Context->dbh->prepare($query);
Lines 376-382 my $i = 0; Link Here
376
# FIXME - The item is only marked returned if you supply --charge .
386
# FIXME - The item is only marked returned if you supply --charge .
377
#         We need a better way to handle this.
387
#         We need a better way to handle this.
378
#
388
#
379
my $sth_items = longoverdue_sth();
389
my $sth_items = longoverdue_sth({ skip_lost_values => \@skip_lost_values });
380
390
381
foreach my $startrange (sort keys %$lost) {
391
foreach my $startrange (sort keys %$lost) {
382
    if( my $lostvalue = $lost->{$startrange} ) {
392
    if( my $lostvalue = $lost->{$startrange} ) {
Lines 389-398 foreach my $startrange (sort keys %$lost) { Link Here
389
        $sth_items->execute($startrange, $endrange, $lostvalue);
399
        $sth_items->execute($startrange, $endrange, $lostvalue);
390
        $count=0;
400
        $count=0;
391
        ITEM: while (my $row=$sth_items->fetchrow_hashref) {
401
        ITEM: while (my $row=$sth_items->fetchrow_hashref) {
392
            if ( @skip_lost_values ) {
393
                next ITEM if any { $_ eq $row->{itemlost} } @skip_lost_values;
394
            }
395
396
            if( $filter_borrower_categories ) {
402
            if( $filter_borrower_categories ) {
397
                my $category = uc Koha::Patrons->find( $row->{borrowernumber} )->categorycode();
403
                my $category = uc Koha::Patrons->find( $row->{borrowernumber} )->categorycode();
398
                next ITEM unless ( $category_to_process{ $category } );
404
                next ITEM unless ( $category_to_process{ $category } );
399
- 

Return to bug 25958