Bug 8972 - Due Date set to 100 years ago

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.

Signed-off-by: Melia Meggs <melia@test.bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Owen Leonard 2012-11-07 09:41:03 -05:00 committed by Jared Camins-Esakov
parent 3ca887bed2
commit 2a73ced61d
4 changed files with 28 additions and 18 deletions

View file

@ -1008,17 +1008,18 @@ tr.confirm td, tr.highlight.confirm td {
margin: .2em 0;
}
#circ_circulation_issue .date-select {
.date-select {
font-size : 85%;
padding-top : .3em;
}
#circ_circulation_issue .date-select label {
#circ_circulation_issue .date-select label,
.date-select label {
font-size : inherit;
font-weight: normal;
}
#circ_circulation_issue .date-select input {
.date-select input {
padding : 1px;
}

View file

@ -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>

View file

@ -160,11 +160,15 @@ var allcheckboxes = $(".checkboxed");
$("#exportmenuc").empty();
initExportButton();
$("#newduedate").datepicker({ minDate: 1 }); // require that renewal date is after today
$("#duedatespec").datetimepicker({
onSelect: function(dateText, inst) { $("#barcode").focus(); },
$("#newduedate").datetimepicker({
minDate: 1, // require that renewal date is after today
hour: 23,
minute: 59,
minute: 59
});
$("#duedatespec").datetimepicker({
onClose: function(dateText, inst) { $("#barcode").focus(); },
hour: 23,
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 ) %]

View file

@ -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");