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

(-)a/misc/cronjobs/set_expired_lost.pl (-1 / +25 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
use strict;
4
use C4::Context;
5
6
my $dbh = C4::Context->dbh();
7
my $DEBUG = 1;
8
9
my $sth = $dbh->prepare("SELECT COUNT(*) AS amount FROM borrowers WHERE dateexpiry < NOW() AND lost <> 1");
10
$sth->execute;
11
my $row = $sth->fetchrow_hashref();
12
13
# Output for email only if borrowers need changing
14
if ($row->{'amount'}) {
15
    $DEBUG && print $row->{'amount'} . " borrowers to be changed";
16
}
17
$sth->finish();
18
19
$sth = $dbh->prepare("UPDATE borrowers SET lost = 1 WHERE dateexpiry < NOW() AND lost <> 1");
20
21
$sth->execute;
22
23
$sth->finish;
24
$dbh->disconnect;
25

Return to bug 32560