[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/misc/cronjobs j2a.pl [rel_3_0]
From: |
Bruno Toumi |
Subject: |
[Koha-cvs] koha/misc/cronjobs j2a.pl [rel_3_0] |
Date: |
Thu, 07 Dec 2006 17:05:22 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: rel_3_0
Changes by: Bruno Toumi <btoumi> 06/12/07 17:05:22
Modified files:
misc/cronjobs : j2a.pl
Log message:
modify cronjob j2a.pl to work with category_type and categorycode
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/cronjobs/j2a.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1&r2=1.1.2.1
Patches:
Index: j2a.pl
===================================================================
RCS file: /sources/koha/koha/misc/cronjobs/j2a.pl,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- j2a.pl 4 May 2005 13:52:03 -0000 1.1
+++ j2a.pl 7 Dec 2006 17:05:22 -0000 1.1.2.1
@@ -1,7 +1,5 @@
-
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#run nightly -- changes J to A on someone's 18th birthday
-use lib '/usr/local/koha/intranet/modules/';
use strict;
use C4::Context;
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
@@ -16,9 +14,12 @@
#get today's date, format it and subtract 18 yrs.
my $itsyourbirthday = "$year-$mon-$mday";
-my $fixit="UPDATE borrowers SET categorycode='A' WHERE dateofbirth<=? AND
dateofbirth!='0000-00-00' AND categorycode='J'";
-
-my $sth=$dbh->prepare($fixit);
+my $query=qq|UPDATE borrowers
+ SET categorycode='A'
+ WHERE dateofbirth<=?
+ AND dateofbirth!='0000-00-00'
+ AND categorycode IN (select categorycode from categories where
category_type='C')|;
+my $sth=$dbh->prepare($query);
my $res = $sth->execute($itsyourbirthday) or die "can't execute";
print "$res\n"; #did it work?
$dbh->disconnect();
- [Koha-cvs] koha/misc/cronjobs j2a.pl [rel_3_0],
Bruno Toumi <=