[Koha-patches] [PATCH] bugfix invalid comparison to ceilingDueDate in CalcDateDue()

Michael Hafen mdhafen at tech.washk12.org
Fri Aug 14 00:12:33 CEST 2009


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.
---
 C4/Circulation.pm |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 78215ff..adc7f8f 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -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;
-- 
1.6.0.4




More information about the Koha-patches mailing list