2 #-----------------------------------
3 # Copyright 2009 PTFS Inc.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
19 #-----------------------------------
23 cart_to_shelf.pl cron script to set items with location of CART to original shelving location after X hours.
24 Execute without options for help.
33 # find Koha's Perl modules
34 # test carefully before changing this
36 eval { require "$FindBin::Bin/../kohalib.pl" };
43 GetOptions( 'h|hours=s' => \$hours, );
45 my $usage = << 'ENDUSAGE';
46 longoverdue.pl : This cron script will set any item of the location CART ( Shelving Cart ) to it's original shelving location
47 after the given numer of hours has passed.
49 This script takes the following parameters :
51 --hours | -h The number of hours that need to pass before the location is updated.
54 $PERL5LIB/misc/cronjobs/cart_to_shelf.pl --hours 24
55 Would make any item that has a location of CART for more than 24 hours change to it's original shelving location.
61 die "ERROR: No --hours (-h) option defined";
65 "UPDATE items SET location = permanent_location WHERE location = 'CART' AND TIMESTAMPDIFF(HOUR, items.timestamp, NOW() ) > ?";
67 my $dbh = C4::Context->dbh;
68 my $sth = $dbh->prepare($query);
69 $sth->execute($hours);