From 0d590c1e30b1f6b3534838a4de8b66139d809605 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 11 Mar 2009 09:09:30 -0500 Subject: [PATCH] bug 3028: remove reservefix.pl cronjob Removed cronjob, which was written to work around a bug in 2.2 that no longer applies and is specific to a single library in any event. Signed-off-by: Galen Charlton --- misc/cronjobs/reservefix.pl | 107 ------------------------------------ 1 file changed, 107 deletions(-) delete mode 100755 misc/cronjobs/reservefix.pl diff --git a/misc/cronjobs/reservefix.pl b/misc/cronjobs/reservefix.pl deleted file mode 100755 index 96b984ac29..0000000000 --- a/misc/cronjobs/reservefix.pl +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/perl -w -#----------------------------------- -# Script Name: reservefix.pl -# Script Version: 1.0.0 -# Date: 2004/02/22 -# Author: Stephen Hedges shedges@skemotah.com -# Description: fixes priority of reserves -# It also e-mails a list of 'problem' reserves -# to me at the library -# Usage: reservefix.pl. -# Revision History: -# 1.0.0 2004/02/22: original version -#----------------------------------- - -use strict; -BEGIN { - # find Koha's Perl modules - # test carefully before changing this - use FindBin; - eval { require "$FindBin::Bin/../kohalib.pl" }; -} -use C4::Context; -use Date::Manip; -use Mail::Sendmail; - -my $dbh = C4::Context->dbh; -my $message; # e-mail message -my $admin = 'root@localhost'; #To -my @library = 'root@localhost'; #From -# get biblionumbers of unfilled reserves -my $bibnos_sth=$dbh->prepare("SELECT DISTINCT biblionumber FROM reserves WHERE found IS NULL AND priority>0"); -my $get_sth=$dbh->prepare("SELECT * FROM reserves WHERE biblionumber=? AND found IS NULL ORDER BY reservedate,priority"); -# checking reservedate avoids overwriting legitimate duplicate reserves -my $put_sth=$dbh->prepare("UPDATE reserves SET priority=? WHERE biblionumber=? AND borrowernumber=? AND reservedate=?"); -my $count_sth=$dbh->prepare("SELECT COUNT(itemnumber) FROM items WHERE biblionumber=?"); -my $dvd_sth=$dbh->prepare("SELECT itemtype FROM biblioitems WHERE biblionumber=?"); - -$bibnos_sth->execute(); - -while (my $number=$bibnos_sth->fetchrow_arrayref) { - my $bibliono=$number->[0]; - - $get_sth->execute($bibliono); - - my $priority=0; - while (my $data=$get_sth->fetchrow_hashref){ - $priority++; - my $bibno = $data->{'biblionumber'}; - my $borrno = $data->{'borrowernumber'}; - my $resdate = $data->{'reservedate'}; - if ($priority==1) { - my $date1 = DateCalc("today","- 60 days"); # calculate date 60 days ago - my $date2 = ParseDate($resdate); - my $flag = Date_Cmp($date2,$date1); - if ($flag<0) { # date1 is later - $dvd_sth->execute($bibno); - while (my $itemtype=$dvd_sth->fetchrow_arrayref) { - my $it = $itemtype->[0]; - if ($it) { - if ($it ne 'DVD') { - $message .= "Check $bibno\n"; -# print "Check $bibno\n"; - } - } else { - $message .= "$bibno has no itemtype\n"; -# print "$bibno has no itemtype\n"; - } - } - $dvd_sth->finish; - } - } - $put_sth->execute($priority,$bibno,$borrno,$resdate); - $put_sth->finish; - } - - $count_sth->execute($bibliono); # get item count - my $itemcount=$count_sth->fetchrow; - if (($priority/4)>$itemcount) { # no more than 4 reserves per item - $dvd_sth->execute($bibliono); - while (my $itemtype=$dvd_sth->fetchrow_arrayref) { - my $it = $itemtype->[0]; - if ($it) { - if ($it ne 'DVD') { - $message .= "Check $bibliono\n"; -# print "Check $bibliono\n"; - } - } else { - $message .= "$bibliono has no itemtype\n" -# print "$bibliono has no itemtype\n"; - } - } - $dvd_sth->finish; - } - $count_sth->finish; - $get_sth->finish; -} -$bibnos_sth->finish; -$dbh->disconnect; - -my %mail = ( To => '$admin', - From => '$library', - Subject => 'Reserve problems', - Message => $message, - 'Content-Type' => 'text/plain; charset="utf8"', - ); -sendmail(%mail); - -- 2.39.5