[Koha-bugs] [Bug 1351] Auto-calculation of expiry date for new members not working

bugzilla-daemon at pippin.metavore.com bugzilla-daemon at pippin.metavore.com
Fri Jul 6 20:18:11 CEST 2007


http://bugs.koha.org/cgi-bin/bugzilla/show_bug.cgi?id=1351


devin at freeshell.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |devin at freeshell.org




------- Comment #1 from devin at freeshell.org  2007-07-06 11:18 -------
I also experienced and had to fix this problem on 2.2.8, because with MySQL 5
Koha is useless because of this bug; users cannot be added.

The solution was to stop using those other date functions, because ParseDate(),
DateCalc(), and format_date_in_iso() do not have compatible formats. 
ParseDate() doesn't output dashes, but format_date_in_iso() requires them. 

Here is the code block, equally functional, using only localtime() and
strftime():

        $data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
        # $data{'joining'} = &ParseDate("today") unless $data{'joining'};
        # $data{'joining'}=format_date_in_iso($data{'joining'});
        $data{'joining'} = strftime("%Y-%m-%d",localtime());
       # if expirydate is not set, calculate it from borrower category
subscription duration
        unless ($data{'expiry'}) {
                my $sth = $dbh->prepare("select enrolmentperiod from categories
where categorycode=?");
                $sth->execute($data{'categorycode'});
                my ($enrolmentperiod) = $sth->fetchrow;
                $enrolmentperiod = 12 unless ($enrolmentperiod);

                # $data{'expiry'} =
&DateCalc($data{'joining'},"$enrolmentperiod years");
                my @latertime = localtime();

                @latertime[4] += $enrolmentperiod;
                $data{'expiry'} = strftime("%Y-%m-%d", @latertime);
        }




------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.





More information about the Koha-bugs mailing list