@@ -, +, @@ contracts - Test the budget creation process for adding, editing, and duplicating budgets. In all cases: - The start date and end date should be required - You should be warned if you enter an end date which falls before the start date. - The description should be required - The budget amount should be required to be a number - When viewing the table of funds for a budget, select a choice from the 'planning' toolbar menu. - Verify that after entering a numeric value in any cell, the 'remaning' value at the end of the row is correctly updated. - Verify that after entering non-numeric data an error is displayed. - Verify that clicking the 'auto-fill' button at the end of the row - Go to Acquisitions -> Vendor -> Contracts - Add or edit a contract - Confirm that name, start date, and end date are required. - Confirm that you are warned if you enter an end date which falls before the start date. --- .../intranet-tmpl/prog/en/includes/calendar.inc | 26 +++++ .../prog/en/modules/admin/aqbudgetperiods.tt | 112 ++++++--------------- .../prog/en/modules/admin/aqcontract.tt | 67 +++++------- .../intranet-tmpl/prog/en/modules/admin/aqplan.tt | 51 +++------- 4 files changed, 100 insertions(+), 156 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -76,6 +76,32 @@ jQuery(function($){ $.datepicker.setDefaults($.datepicker.regional['']); }); +/* jQuery Validator plugin custom method + This allows you to check that a given date falls after another. + It is required that a message be defined. + + Syntax: + $("#form_id").validate({ + rules: { + input_name_of_later_date_field: { + is_date_after: "#input_id_of_earlier_date_field" + }, + }, + messages: { + input_name_of_later_date_field: { + is_date_after: _("Validation error to be shown, i.e. End date must come after start date") + } + } + }); +*/ + +jQuery.validator.addMethod("is_date_after", +function(value, element, params) { + var from = Date_from_syspref( $(params).val() ); + var to = Date_from_syspref(value); + return to > from; +}); + $(document).ready(function(){ $.datepicker.setDefaults({ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgetperiods.tt @@ -37,75 +37,6 @@ [% END %] @@ -252,13 +201,13 @@
-[% UNLESS close_form OR closed%] +[% UNLESS close_form OR closed OR duplicate_form %] [% INCLUDE 'budgets-admin-toolbar.inc' %] [% END %] [% IF ( duplicate_form ) %]

Duplicate budget

-
+
@@ -268,18 +217,21 @@
  • -
    [% INCLUDE 'date-format.inc' %]
    + Required +
    [% INCLUDE 'date-format.inc' %]
  • -
    [% INCLUDE 'date-format.inc' %]
    + Required +
    [% INCLUDE 'date-format.inc' %]
  • + Required
  • @@ -308,7 +260,7 @@
  • - Cancel + Cancel
    @@ -323,7 +275,7 @@ [% ELSE %]

    Add budget

    [% END %] -
    +
    @@ -334,13 +286,15 @@
  • -
    [% INCLUDE 'date-format.inc' %]
    + Required +
    [% INCLUDE 'date-format.inc' %]
  • -
    [% INCLUDE 'date-format.inc' %]
    + Required +
    [% INCLUDE 'date-format.inc' %]
  • @@ -349,6 +303,7 @@ + Required
  • @@ -378,8 +333,7 @@
    - - + [% IF ( budget_period_id ) %] Cancel [% ELSE %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqcontract.tt @@ -14,41 +14,23 @@ @@ -97,7 +79,7 @@ function Check(ff) { [% END %] [% IF ( add_form ) %] - + @@ -109,29 +91,32 @@ function Check(ff) {
      [% IF ( contractnumber ) %] -
    1. Contract id [% contractnumber %] +
    2. Contract id:[% contractnumber %]
    3. [% END %] -
    4.   +
    5.   + Required
    6.  
    7. -
    8.   +
    9.   + Required
      [% INCLUDE 'date-format.inc' %]
    10. -
    11.   +
    12.   + Required
      [% INCLUDE 'date-format.inc' %]
    - Cancel + Cancel
    [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqplan.tt @@ -2,41 +2,12 @@ [% INCLUDE 'doc-head-open.inc' %] Koha › Administration › Budgets › Funds › Planning for [% budget_period_description %] by [% authcat %] [% INCLUDE 'doc-head-close.inc' %] - - + [% INCLUDE 'header.inc' %] @@ -150,7 +129,7 @@ [% line.estimated_amount %]  [% ELSE %] - + [% END %] @@ -188,7 +167,7 @@ [% UNLESS ( budget_line.budget_lock ) %] - + [% ELSE %]
    not owned
    [% END %] @@ -202,7 +181,7 @@ [% IF ( budget_period_locked ) %] [% ELSE %] -
    +
    [% END %] --