bugfix invalid comparison to ceilingDueDate in CalcDateDue()
authorMichael Hafen <mdhafen@tech.washk12.org>
Thu, 13 Aug 2009 22:12:33 +0000 (16:12 -0600)
committerGalen Charlton <gmcharlt@gmail.com>
Sat, 15 Aug 2009 13:39:04 +0000 (09:39 -0400)
The comparison to check the ceilingDueDate is done in the syspref format,
which isn't a good comparison.  This changes to code so the comparison is done
using iso format.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
C4/Circulation.pm

index 78215ff..adc7f8f 100644 (file)
@@ -2499,9 +2499,11 @@ sub CalcDateDue {
 
        # if ceilingDueDate ON the datedue can't be after the ceiling date
        if ( C4::Context->preference('ceilingDueDate')
-            && ( C4::Context->preference('ceilingDueDate') =~ C4::Dates->regexp('syspref') )
-            && $datedue->output gt C4::Context->preference('ceilingDueDate') ) {
-           $datedue = C4::Dates->new( C4::Context->preference('ceilingDueDate') );
+             && ( C4::Context->preference('ceilingDueDate') =~ C4::Dates->regexp('syspref') ) ) {
+            my $ceilingDate = C4::Dates->new( C4::Context->preference('ceilingDueDate') );
+            if ( $datedue->output( 'iso' ) gt $ceilingDate->output( 'iso' ) ) {
+                $datedue = $ceilingDate;
+            }
        }
 
        return $datedue;