[Koha-patches] [PATCH] [SIGNED-OFF] Bug 2965: Allow due date in the past

Katrin Fischer Katrin.Fischer.83 at web.de
Mon Dec 13 22:34:07 CET 2010


From: Srdjan Jankovic <srdjan at catalyst.net.nz>

Raise warning rather than disallowing
Remove due date js validation when checking out

Signed-off-by: Katrin Fischer <Katrin.Fischer.83 at web.de>
Fixed small error in circulation.tmpl
---
 C4/Circulation.pm                                  |    9 +++++++--
 circ/circulation.pl                                |   12 ++++++------
 .../prog/en/modules/circ/circulation.tmpl          |   13 ++++++++++---
 3 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index c5ac344..0131e90 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -650,7 +650,7 @@ reserved for someone else.
 
 =head3 INVALID_DATE
 
-sticky due date is invalid
+sticky due date is invalid or due date in the past
 
 =head3 TOO_MANY
 
@@ -688,7 +688,12 @@ sub CanBookBeIssued {
         # Offline circ calls AddIssue directly, doesn't run through here
         #  So issuingimpossible should be ok.
     }
-    $issuingimpossible{INVALID_DATE} = $duedate->output('syspref') unless ( $duedate && $duedate->output('iso') ge C4::Dates->today('iso') );
+    if ($duedate) {
+        $needsconfirmation{INVALID_DATE} = $duedate->output('syspref')
+          unless $duedate->output('iso') ge C4::Dates->today('iso');
+    } else {
+        $issuingimpossible{INVALID_DATE} = $duedate->output('syspref');
+    }
 
     #
     # BORROWER STATUS
diff --git a/circ/circulation.pl b/circ/circulation.pl
index bed1191..c4421ed 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -146,13 +146,13 @@ if($duedatespec_allow){
     if ($duedatespec) {
         if ($duedatespec =~ C4::Dates->regexp('syspref')) {
             my $tempdate = C4::Dates->new($duedatespec);
-            if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
-                # i.e., it has to be later than today/now
+#           if ($tempdate and $tempdate->output('iso') gt C4::Dates->new()->output('iso')) {
+#               # i.e., it has to be later than today/now
                 $datedue = $tempdate;
-            } else {
-                $invalidduedate = 1;
-                $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
-            }
+#           } else {
+#               $invalidduedate = 1;
+#               $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
+#           }
         } else {
             $invalidduedate = 1;
             $template->param(IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec);
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index ca93a31..fc27cfa 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -258,7 +258,14 @@ function refocus(calendar) {
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
     <input type="hidden" name="issueconfirmed" value="1" />
     <!-- TMPL_IF NAME="DEBT" --><input type="hidden" name="debt_confirmed" value="1" /><!-- /TMPL_IF -->
+    <!-- TMPL_IF NAME="INVALID_DATE" -->
+    <p>
+    <input type="text" size="10" id="duedatespec" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
+    <label for="duedatespec">Due Date</label>
+    </p>
+    <!-- TMPL_ELSE -->
     <input type="hidden" name="duedatespec" value="<!-- TMPL_VAR NAME="duedatespec" -->" />
+    <!-- /TMPL_IF -->
     <input type="hidden" name="stickyduedate" value="<!-- TMPL_VAR NAME="stickyduedate" -->" />
     <input type="hidden" name="branch" value="<!-- TMPL_VAR NAME="branch" -->" />
     <input type="submit" class="approve" value="Yes, Check Out (Y)" accesskey="y" />
@@ -411,7 +418,7 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
     <!-- TMPL_IF NAME="NEEDSCONFIRMATION" -->
 	    <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" disabled="disabled" />
     <!-- TMPL_ELSE -->
-	    <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" />
+	    <!-- TMPL_IF NAME="barcode" -->><input type="text" name="barcode" id="barcode" class="barcode focus" size="14" value="<!-- TMPL_VAR NAME="barcode" -->"/><!-- TMPL_ELSE --><input type="text" name="barcode" id="barcode" class="barcode focus" size="14" /><!-- /TMPL_IF -->
     <!-- /TMPL_IF -->
     <input type="submit" value="Check Out" />
 
@@ -440,8 +447,8 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
                              inputField : "duedatespec",
                              ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
                              button : "CalendarDueDate",
-                             disableFunc : validate1,
-                             dateStatusFunc : validate1,
+//                           disableFunc : validate1,
+//                           dateStatusFunc : validate1,
                              onClose : refocus
                            }
                         );
-- 
1.7.1



More information about the Koha-patches mailing list