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