[Koha-patches] [PATCH] Bug 5578 Followup: Hard Due Dates break hard-coded default circ rule

Ian Walls ian.walls at bywatersolutions.com
Thu Mar 31 21:33:17 CEST 2011


If you do not have an applicable circulation rule for a combination of branch,
item type and patron category defined in your Circulation and Fines rules,
the Hard Due Dates development prevents circulation by introducing an error:

Can't call method "output" on an undefined value at /home/magnus/kohahead/C4/Circulation.pm line 2713

This is because the $hardduedate variable is not defined.  Changing the conditional
to check it, rather that it's output, fixes the issue.  That's what this patch does.

Is this the longest commit message for a single line fix?  Maybe.

Signed-off-by: Ian Walls <ian.walls at bywatersolutions.com>
---
 C4/Circulation.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 584589e..bee4251 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -2718,7 +2718,7 @@ sub CalcDateDue {
 
 	# if Hard Due Dates are used, retreive them and apply as necessary
         my ($hardduedate, $hardduedatecompare) = GetHardDueDate($borrower->{'categorycode'},$itemtype, $branch);
-	if ( $hardduedate->output('iso') && $hardduedate->output('iso') ne '0000-00-00') {
+	if ( $hardduedate && $hardduedate->output('iso') ne '0000-00-00') {
             # if the calculated due date is after the 'before' Hard Due Date (ceiling), override
             if ( $datedue->output( 'iso' ) gt $hardduedate->output( 'iso' ) && $hardduedatecompare == -1) {
                 $datedue = $hardduedate;
-- 
1.5.6.5



More information about the Koha-patches mailing list