3 #run nightly -- changes J to A on someone's 18th birthday
4 use lib '/usr/local/koha/intranet/modules/';
7 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
10 $mon +=1; if ($mon < 10) {$mon = "0".$mon;}
11 if ($mday < 10) {$mday = "0".$mday;}
13 $year -=18; #18 year olds here: if your J turns to A before this change here
14 my $dbh=C4::Context->dbh;
16 #get today's date, format it and subtract 18 yrs.
17 my $itsyourbirthday = "$year-$mon-$mday";
19 my $fixit="UPDATE borrowers SET categorycode='A' WHERE dateofbirth<=? AND dateofbirth!='0000-00-00' AND categorycode='J'";
21 my $sth=$dbh->prepare($fixit);
22 my $res = $sth->execute($itsyourbirthday) or die "can't execute";
23 print "$res\n"; #did it work?