<!ENTITY staff.circ.renew_overlay.renew_export.label "Export">
<!ENTITY staff.circ.renew_overlay.trim_list.label "Trim List (20 rows)">
<!ENTITY staff.circ.renew_overlay.strict_barcode.label "Strict Barcode">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.label "Normal">
-<!ENTITY staff.circ.checkout_overlay.duedate_menu.accesskey "u">
+<!ENTITY staff.circ.checkout_overlay.duedate.label "Specific Due Date">
+<!ENTITY staff.circ.checkout_overlay.duedate.accesskey "u">
<!ENTITY staff.circ.checkout_overlay.barcode.accesskey "C">
<!ENTITY staff.circ.checkout_overlay.export.accesskey "">
<!ENTITY staff.circ.checkout_overlay.export.label "Export">
}
}
],
- 'checkout_duedate_menu' : [
+ 'checkout_duedate_datepicker' : [
['change'],
function(ev) {
try {
- obj.check_date(ev.target);
- ev.target.parentNode.setAttribute('style','');
+ if (obj.check_date(ev.target)) {
+ ev.target.parentNode.setAttribute('style','');
+ } else {
+ ev.target.parentNode.setAttribute('style','background-color: red');
+ }
} catch(E) {
- ev.target.parentNode.setAttribute('style','background-color: red');
- alert(E + '\n' + document.getElementById('circStrings').getString('staff.circ.checkout.date.exception'));
- try {
- ev.target.inputField.select();
- ev.target.inputField.focus();
- } catch(EX) { /* this should work, let me try on other platforms */
- obj.error.sdump('D_ERROR','menulist.inputField: ' + EX);
- }
+ alert('Error in checkout.js, checkout_duedate_datepicker @change: ' + E);
}
}
],
},
'check_date' : function(node) {
+ var obj = this;
JSAN.use('util.date');
try {
- if (node.value == 'Normal') { return true; }
- var pattern = node.value.match(/Today \+ (\d+) days/);
- if (pattern) {
- var today = new Date();
- var todayPlus = new Date(); todayPlus.setTime( today.getTime() + 24*60*60*1000*pattern[1] );
- node.value = util.date.formatted_date(todayPlus,"%F");
- }
- if (! util.date.check('YYYY-MM-DD',node.value) ) {
- throw(document.getElementById('circStrings').getString('staff.circ.invalid_date'));
- }
+ obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','false');
+ obj.controller.view.checkout_barcode_entry_textbox.disabled = false;
+ obj.controller.view.cmd_checkout_submit.setAttribute('disabled','false');
+ obj.controller.view.cmd_checkout_submit.disabled = false;
if (util.date.check_past('YYYY-MM-DD',node.value) ) {
- throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
- }
- if ( util.date.formatted_date(new Date(),'%F') == node.value) {
- throw(document.getElementById('circStrings').getString('staff.circ.checkout.date.too_early.error'));
+ obj.controller.view.checkout_barcode_entry_textbox.setAttribute('disabled','true');
+ obj.controller.view.cmd_checkout_submit.setAttribute('disabled','true');
+ return false;
}
return true;
} catch(E) {
'checkout' : function(params) {
var obj = this;
- try { obj.check_date(obj.controller.view.checkout_duedate_menu); } catch(E) { return; }
- if (obj.controller.view.checkout_duedate_menu.value != 'Normal') {
- params.due_date = obj.controller.view.checkout_duedate_menu.value;
- }
+ if (document.getElementById('checkout_duedate_checkbox').checked) {
+ if (! obj.check_date(obj.controller.view.checkout_duedate_datepicker)) return;
+ var tp = document.getElementById('checkout_duedate_timepicker');
+ var dp = obj.controller.view.checkout_duedate_datepicker;
+ var tp_date = tp.dateValue;
+ var dp_date = dp.dateValue;
+ tp_date.setFullYear( dp_date.getFullYear() );
+ tp_date.setMonth( dp_date.getMonth() );
+ tp_date.setDate( dp_date.getDate() );
+
+ JSAN.use('util.date');
+ params.due_date = util.date.formatted_date(tp_date,'%{iso8601}');
+ }
if (typeof obj.on_checkout == 'function') { obj.on_checkout(params); }
accesskey="&staff.patron_display.checkout.submit.accesskey;"/>
<spacer flex="1"/>
<hbox id="duedate_hbox">
- <label value="&staff.circ.checkout_overlay.duedate_menu.label;" accesskey="&staff.circ.checkout_overlay.duedate_menu.accesskey;" control="checkout_duedate_menu"/>
- <menulist id="checkout_duedate_menu" editable="true">
- <menupopup>
- <menuitem label="&common.date_helper.normal;" selected="true"/>
- <menuitem label="&common.date_helper.3_days;" />
- <menuitem label="&common.date_helper.7_days;" />
- <menuitem label="&common.date_helper.14_days;" />
- <menuitem label="&common.date_helper.30_days;" />
- </menupopup>
- </menulist>
+ <checkbox id="checkout_duedate_checkbox" label="&staff.circ.checkout_overlay.duedate.label;" accesskey="&staff.circ.checkout_overlay.duedate.accesskey;" oncommand="if (this.checked) { this.nextSibling.focus(); } else { document.getElementById('checkout_barcode_entry_textbox').focus(); }"/>
+ <datepicker id="checkout_duedate_datepicker" type="popup" />
+ <timepicker id="checkout_duedate_timepicker" type="popup" />
</hbox>
</hbox>