[Koha-patches] [PATCH] Bug 8972 - Due Date set to 100 years ago

Owen Leonard oleonard at myacpl.org
Wed Nov 7 16:52:30 CET 2012


In order to prevent submission of dates with ambiguous two-digit
years this patch makes date-due input fields read-only so that
users must use date/time picker.

Other minor fixes:

- Adding missing labels
- Adding common class wrapper to datepicker for checkout and renewal
- Correcting focus handling on "specify due date" field (should
  focus on barcode field after a date has been selected).
- Removing trailing comma from JavaScript (breaks IE)

To test, try typing an invalid number in any of the date due entry
fields: Under 'specify due date,' 'renewal due date,' or the
confirm "invalid" date dialog (after specifying a date in the past).
Manual entry should not work. Choosing a date/time using the
widget should work.
---
 .../intranet-tmpl/prog/en/css/staff-global.css     |   17 +++++++++--------
 .../prog/en/includes/checkouts-table-footer.inc    |    6 +++---
 .../prog/en/modules/circ/circulation.tt            |   14 +++++++++-----
 .../prog/en/modules/members/moremember.tt          |    7 ++++++-
 4 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 3cfbb9b..e66c349 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -1008,18 +1008,19 @@ tr.confirm td, tr.highlight.confirm td {
 	margin: .2em 0;
 }
 
-#circ_circulation_issue .date-select {
-	font-size : 85%;
-	padding-top : .3em;
+.date-select {
+    font-size : 85%;
+    padding-top : .3em;
 }
 
-#circ_circulation_issue .date-select label {
-	font-size : inherit;
-	font-weight: normal;
+#circ_circulation_issue .date-select label,
+.date-select label {
+    font-size : inherit;
+    font-weight: normal;
 }
 
-#circ_circulation_issue .date-select input {
-	padding : 1px;
+.date-select input {
+    padding : 1px;
 }
 
 tr.expired td {
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
index f2edfd6..90c4cb2 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc
@@ -3,10 +3,10 @@
         <td colspan="6" style="text-align: right; font-weight:bold;">Totals:</td>
 		<td>[% totaldue %]</td>
 		<td>[% totalprice %]</td>
-                <td colspan="3">
-            <p>Renewal due date: <input type="text" size="8" id="newduedate" name="newduedate" value="[% newduedate %]" />
+                <td colspan="3"><div class="date-select">
+            <p><label for="newduedate">Renewal due date:</label> <input type="text" size="12" id="newduedate" name="newduedate" value="[% newduedate %]" readonly="readonly" />
 </p>
-			<p><label>Forgive fines on return: <input type="checkbox" name="exemptfine" value="1" /></label></p>
+            <p><label for="exemptfine">Forgive fines on return: <input type="checkbox" id="exemptfine" name="exemptfine" value="1" /></label></p></div>
 		</td>
 	</tr>
 </tfoot>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
index 652cbf8..ee3a666 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
@@ -160,11 +160,15 @@ var allcheckboxes = $(".checkboxed");
     $("#exportmenuc").empty();
     initExportButton();
 
-    $("#newduedate").datepicker({ minDate: 1 }); // require that renewal date is after today
+    $("#newduedate").datetimepicker({
+        minDate: 1, // require that renewal date is after today
+        hour: 23,
+        minute: 59
+    });
     $("#duedatespec").datetimepicker({
-        onSelect: function(dateText, inst) { $("#barcode").focus(); },
+        onClose: function(dateText, inst) { $("#barcode").focus(); },
         hour: 23,
-        minute: 59,
+        minute: 59
     });
 
  });
@@ -399,7 +403,7 @@ function validate1(date) {
     [% IF ( DEBT ) %]<input type="hidden" name="debt_confirmed" value="1" />[% END %]
     [% IF ( INVALID_DATE ) %]
     <p>
-    <input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" />
+    <input type="text" size="13" id="duedatespec" name="duedatespec" readonly="readonly" value="[% duedatespec %]" />
     <label for="duedatespec">Due date</label>
     </p>
     [% ELSE %]
@@ -577,7 +581,7 @@ No patron matched <span class="ex">[% message %]</span>
 
     [% IF ( SpecifyDueDate ) %]<div class="date-select">
         <div class="hint">Specify due date [% INCLUDE 'date-format.inc' %]: </div>
-        [% IF ( duedatespec ) %]<input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" />[% ELSE %]<input type="text" size="13" id="duedatespec" name="duedatespec" value="" />
+        [% IF ( duedatespec ) %]<input type="text" size="13" id="duedatespec" name="duedatespec" value="[% duedatespec %]" readonly="readonly" />[% ELSE %]<input type="text" size="13" id="duedatespec" name="duedatespec" value="" readonly="readonly" />
 [% END %]
           <label for="stickyduedate"> Remember for session:</label>
 [% IF ( stickyduedate ) %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
index abbf26f..4e6271f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
@@ -11,6 +11,7 @@
 [% INCLUDE 'calendar.inc' %]
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
+<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery-ui-timepicker-addon.js"></script>
 <script type="text/JavaScript" language="JavaScript">
 //<![CDATA[
 $.tablesorter.addParser({
@@ -84,7 +85,11 @@ $(document).ready(function() {
 		}
 	});
     $("#suspend_until").datepicker({ minDate: 1 }); // require that hold suspended until date is after today
-    $("#newduedate").datepicker({ minDate: 1 }); // require that renewal date is after today
+    $("#newduedate").datetimepicker({
+        minDate: 1, // require that renewal date is after today
+        hour: 23,
+        minute: 59
+    });
  });
 function uncheck_sibling(me){
 nodename=me.getAttribute("name");
-- 
1.7.9.5


More information about the Koha-patches mailing list