From 8810f62ad47ee657d7d0021447a87fc41d3de134 Mon Sep 17 00:00:00 2001 From: joshferraro Date: Wed, 4 May 2005 13:52:03 +0000 Subject: [PATCH] Changed the status of a Juvinile patron to Adult on his/her 18th birthday --- misc/cronjobs/j2a.pl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 misc/cronjobs/j2a.pl diff --git a/misc/cronjobs/j2a.pl b/misc/cronjobs/j2a.pl new file mode 100755 index 0000000000..5bf3b0a18c --- /dev/null +++ b/misc/cronjobs/j2a.pl @@ -0,0 +1,24 @@ + +#!/usr/bin/perl -w +#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) + = localtime(time); +$year +=1900; +$mon +=1; if ($mon < 10) {$mon = "0".$mon;} +if ($mday < 10) {$mday = "0".$mday;} + +$year -=18; #18 year olds here: if your J turns to A before this change here +my $dbh=C4::Context->dbh; + +#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 $res = $sth->execute($itsyourbirthday) or die "can't execute"; +print "$res\n"; #did it work? +$dbh->disconnect(); -- 2.39.5