2 #run nightly -- changes J to A on someone's 18th birthday
5 # find Koha's Perl modules
6 # test carefully before changing this
8 eval { require "$FindBin::Bin/../kohalib.pl" };
12 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
15 $mon +=1; if ($mon < 10) {$mon = "0".$mon;}
16 if ($mday < 10) {$mday = "0".$mday;}
18 $year -=18; #18 year olds here: if your J turns to A before this change here
19 my $dbh=C4::Context->dbh;
21 #get today's date, format it and subtract 18 yrs.
22 my $itsyourbirthday = "$year-$mon-$mday";
24 my $query=qq|UPDATE borrowers
28 AND dateofbirth!='0000-00-00'
29 AND categorycode IN (select categorycode from categories where category_type='C')|;
30 my $sth=$dbh->prepare($query);
31 my $res = $sth->execute($itsyourbirthday) or die "can't execute";
32 print "$res\n"; #did it work?