2 #-----------------------------------
3 # Script Name: longoverdue.pl
4 # Script Version: 1.0.0
6 # Author: Stephen Hedges shedges@skemotah.com
7 # Description: set itemlost status to '2'
8 # ("long overdue") on items more than 90
10 # Usage: longoverdue.pl.
12 # 1.0.0 2004/04/01: original version
13 #-----------------------------------
17 # find Koha's Perl modules
18 # test carefully before changing this
20 eval { require "$FindBin::Bin/../kohalib.pl" };
24 my $dbh = C4::Context->dbh;
26 my $itemnos_sth=$dbh->prepare("SELECT items.itemnumber FROM issues,items WHERE items.itemnumber=issues.itemnumber AND DATE_SUB(CURDATE(),INTERVAL 90 DAY) > date_due AND returndate IS NULL AND (itemlost=0 OR itemlost IS NULL)");
27 my $put_sth=$dbh->prepare("UPDATE items SET itemlost=2 WHERE itemnumber=?");
29 # get itemnumbers of items more than 90 days overdue
30 $itemnos_sth->execute();
32 while (my $row=$itemnos_sth->fetchrow_arrayref) {
35 $put_sth->execute($item);