[Koha-bugs] [Bug 2010] New: Dates compared as strings in C4::Circulation::Circ2::issuebook

bugzilla-daemon at pippin.metavore.com bugzilla-daemon at pippin.metavore.com
Thu Apr 10 12:27:05 CEST 2008


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

           Summary: Dates compared as strings in
                    C4::Circulation::Circ2::issuebook
           Product: Koha
           Version: 2.2.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P3
         Component: Circulation
        AssignedTo: galen.charlton at liblime.com
        ReportedBy: rick at calyx.net.au
         QAContact: koha-bugs at lists.koha.org


line 904:

  my $dateduef = (1900+$datearr[5])."-".($datearr[4]+1)."-".$datearr[3];

results in a date of "2008-5-8" for May 8, 2008.
This is then compared to the MySQL date for the borrower's expiry: "2008-12-31"

Such a comparison fails intermittently depending on the due date and
the borrower's expiry date.

The fix:

  my $dateduef = sprintf
"%04d-%02d-%02d",1900+$datearr[5],$datearr[4]+1,$datearr[3];

Unfortunately this is but one example of many such similar errors in Koha.
There is no consistent handling of dates in the application. Rather, various
programmers over time have reinvented their own way to do date things, rather
than rely on a standard O-O module (Date::Manip????) to standardise things and
avoid situations like this.

Enough said.




------- 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