From 82b9f92bd9611569dbd4347d0d2ac4629dd38353 Mon Sep 17 00:00:00 2001 From: joshferraro Date: Wed, 4 May 2005 13:54:01 +0000 Subject: [PATCH] set itemlost status to '2' ("long overdue") on items more than 90 days overdue. --- misc/cronjobs/longoverdue.pl | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 misc/cronjobs/longoverdue.pl diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl new file mode 100755 index 0000000000..000d662a47 --- /dev/null +++ b/misc/cronjobs/longoverdue.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl -w +#----------------------------------- +# Script Name: longoverdue.pl +# Script Version: 1.0.0 +# Date: 2004/04/01 +# Author: Stephen Hedges shedges@skemotah.com +# Description: set itemlost status to '2' +# ("long overdue") on items more than 90 +# days overdue. +# Usage: longoverdue.pl. +# Revision History: +# 1.0.0 2004/04/01: original version +#----------------------------------- + +use lib '/usr/local/koha/intranet/modules/'; + +use strict; +use C4::Context; + +my $dbh = C4::Context->dbh; + +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)"); +my $put_sth=$dbh->prepare("UPDATE items SET itemlost=2 WHERE itemnumber=?"); + +# get itemnumbers of items more than 90 days overdue +$itemnos_sth->execute(); + +while (my $row=$itemnos_sth->fetchrow_arrayref) { + my $item=$row->[0]; + + $put_sth->execute($item); + $put_sth->finish; +# print "$item\n"; +} + +$itemnos_sth->finish; +$dbh->disconnect; -- 2.39.5