@@ -, +, @@ 1/ Debar a patron 2/ On the checkout tables (circulation and moremember), add a renewal 3/ On the checkout page, specify a due date 4/ On the return page, specify a return date 5/ On the invoice page (acquisition module), enter a shipment and 6/ On the invoice search page (invoices.pl) use filters shipment and 7/ On the offline circ page, specify a due date 8/ On the edit patron page (memberentry), add a debarment 9/ On the reserve page (reserve/request.pl), use the date inputs to --- .../prog/en/includes/borrower_debarments.inc | 2 +- .../intranet-tmpl/prog/en/includes/calendar.inc | 29 ++++++++++++++++++++-- .../prog/en/includes/checkouts-table-footer.inc | 2 +- .../intranet-tmpl/prog/en/modules/acqui/invoice.tt | 4 +-- .../prog/en/modules/acqui/invoices.tt | 4 +-- .../prog/en/modules/circ/circulation.tt | 14 +++++++---- .../intranet-tmpl/prog/en/modules/circ/offline.tt | 8 ++++-- .../intranet-tmpl/prog/en/modules/circ/returns.tt | 6 ++++- .../prog/en/modules/members/memberentrygen.tt | 2 +- .../prog/en/modules/members/moremember.tt | 5 ---- .../prog/en/modules/reserve/request.tt | 6 ++--- .../prog/en/modules/tools/modborrowers.tt | 5 ++-- .../intranet-tmpl/prog/js/pages/circulation.js | 9 ++++++- 13 files changed, 68 insertions(+), 28 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -85,7 +85,7 @@ Add manual restriction
  1. -
  2. +
  3. Clear date
Cancel
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -6,6 +6,24 @@ var debug = "[% debug %]"; var dformat = "[% dateformat %]"; var sentmsg = 0; if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} +var MSG_PLEASE_ENTER_A_VALID_DATE = ("Please enter a valid date."); + +function validate_date (dateText, inst) { + var dateformat = '[% Koha.Preference('dateformat') %]'; + if ( dateformat == 'us' ) { + dateformat = 'mm/dd/yy'; + } else if ( dateformat == 'metric' ) { + dateformat = 'dd/mm/yy'; + } else if (dateformat == 'iso' ) { + dateformat = 'yy-mm-dd'; + } + try { + $.datepicker.parseDate(dateformat, dateText); + } catch (e) { + alert(MSG_PLEASE_ENTER_A_VALID_DATE); + $('#'+inst.id).val(''); + }; +} function Date_from_syspref(dstring) { var dateX = dstring.split(/[-/.]/); @@ -89,7 +107,11 @@ $.datepicker.setDefaults({ selectOtherMonths: true }); - $( ".datepicker" ).datepicker(); + $( ".datepicker" ).datepicker({ + onClose: function(dateText, inst) { + validate_date(dateText, inst); + }, + }); // http://jqueryui.com/demos/datepicker/#date-range var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ changeMonth: true, @@ -102,7 +124,10 @@ $.datepicker.setDefaults({ $.datepicker._defaults.dateFormat, selectedDate, instance.settings ); dates.not( this ).datepicker( "option", option, date ); - } + }, + onClose: function(dateText, inst) { + validate_date(dateText, inst); + }, }); }); //]]> --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc @@ -5,7 +5,7 @@ [% finetotal %] [% totalprice %]
-

+

--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -77,10 +77,10 @@
  1. -
  2. +
  3. -
  4. +
  5. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -180,10 +180,10 @@ $(document).ready(function() {
  6. -
  7. +
  8. -
  9. +
  10. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -71,7 +71,11 @@ function toggle_onsite_checkout(){ [% END %] } else { $("#duedatespec").datetimepicker({ - onClose: function(dateText, inst) { $("#barcode").focus(); }, + onClose: function(dateText, inst) { + if (validate_date(dateText, inst) ) { + $("#barcode").focus(); + } + }, hour: 23, minute: 59 }); @@ -335,7 +339,7 @@ $(document).ready(function() { [% IF ( DEBT ) %][% END %] [% IF ( INVALID_DATE ) %]

    - +

    [% ELSE %] @@ -597,9 +601,9 @@ No patron matched [% message | html %]
    Specify due date [% INCLUDE 'date-format.inc' %]:
    [% IF ( duedatespec ) %] - + [% ELSE %] - + [% END %] [% IF ( stickyduedate ) %] @@ -647,7 +651,7 @@ No patron matched [% message | html %] [% IF noissues %]
    - +
    [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt @@ -553,7 +553,11 @@ $(document).ready(function () { minute: 59 }); $("#duedatespec").datetimepicker({ - onClose: function(dateText, inst) { setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); }, + onClose: function(dateText, inst) { + if (validate_date(dateText, inst) ) { + setTimeout(function() { $('#checkout-barcode').trigger('focus'), 1 }); + } + }, hour: 23, minute: 59 }); @@ -690,7 +694,7 @@ $(document).ready(function () {
    Specify due date [% INCLUDE 'date-format.inc' %]:
    - + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -58,7 +58,11 @@ $(document).ready(function () { }, columns_settings); $("#return_date_override").datetimepicker({ - onClose: function(dateText, inst) { $("#barcode").focus(); }, + onClose: function(dateText, inst) { + if (validate_date(dateText, inst) ) { + $("#barcode").focus(); + } + }, defaultDate: -1, hour: 23, minute: 59, --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1003,7 +1003,7 @@ $(document).ready(function() { Add manual restriction
    1. -
    2. +
    3. Clear date
    --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -84,11 +84,6 @@ $(document).ready(function() { });[% END %] $("#suspend_until").datepicker({ minDate: 1 }); // require that hold suspended until date is after today - $("#newduedate").datetimepicker({ - minDate: 1, // require that renewal date is after today - hour: 23, - minute: 59 - }); $("#view_restrictions").on("click",function(){ $('#debarments-tab-link').click(); }); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -390,14 +390,14 @@ function checkMultiHold() { [% IF ( reserve_in_future ) %]
  11. - + Clear date
  12. [% END %]
  13. - + Clear date
  14. @@ -810,7 +810,7 @@ function checkMultiHold() { [% IF AutoResumeSuspendedHolds %] - + Clear date [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/modborrowers.tt @@ -1,3 +1,4 @@ +[% USE Koha %] [% USE KohaDates %] [% INCLUDE 'doc-head-open.inc'%] Koha › Tools › Batch patron modification @@ -335,7 +336,7 @@ [% END %] [% IF field.mandatory %] - + [% ELSE %] [% END %] @@ -354,7 +355,7 @@ [% END %] [% END %] [% IF ( field.type == 'date' ) %] - + Clear [% END %] [% IF field.mandatory %] --- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js +++ a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js @@ -29,12 +29,19 @@ $(document).ready(function() { }); $("#newduedate").datetimepicker({ + onClose: function(dateText, inst) { + validate_date(dateText, inst); + }, minDate: 1, // require that renewal date is after today hour: 23, minute: 59 }); $("#duedatespec").datetimepicker({ - onClose: function(dateText, inst) { $("#barcode").focus(); }, + onClose: function(dateText, inst) { + if ( validate_date(dateText, inst) ) { + $("#barcode").focus(); + } + }, hour: 23, minute: 59 }); --