Lines 15-44
Link Here
|
15 |
// to check if the data are correctly entered. |
15 |
// to check if the data are correctly entered. |
16 |
function Check(ff) { |
16 |
function Check(ff) { |
17 |
var ok=0; |
17 |
var ok=0; |
18 |
var _alertString=_("Form not submitted because of the following problem(s)\n"); |
18 |
var _alertString=_("Form not submitted because of the following problem(s)"); |
19 |
_alertString +="-------------------------------------------------------------------\n\n"; |
19 |
_alertString +="\n-------------------------------------------------------------------\n\n"; |
20 |
if (!(isNotNull(ff.contractname,0))){ |
20 |
if (!(isNotNull(ff.contractname,0))){ |
21 |
ok=1; |
21 |
ok=1; |
22 |
_alertString += _("- Name missing\n"); |
22 |
_alertString += _("- Name missing") + "\n"; |
23 |
} |
23 |
} |
24 |
var startDate = Date_from_syspref($("#contractstartdate").val()); |
24 |
var startDate = Date_from_syspref($("#contractstartdate").val()); |
25 |
var endDate = Date_from_syspref($("#contractenddate").val()); |
25 |
var endDate = Date_from_syspref($("#contractenddate").val()); |
26 |
if (!parseInt(startDate.getTime())) { |
26 |
if (!parseInt(startDate.getTime())) { |
27 |
ok=1; |
27 |
ok=1; |
28 |
_alertString += _("- Start date missing or invalid.\n"); |
28 |
_alertString += _("- Start date missing or invalid.") + "\n"; |
29 |
} |
29 |
} |
30 |
if (!parseInt(endDate.getTime())) { |
30 |
if (!parseInt(endDate.getTime())) { |
31 |
ok=1; |
31 |
ok=1; |
32 |
_alertString += _("- End date missing or invalid.\n"); |
32 |
_alertString += _("- End date missing or invalid.") + "\n"; |
33 |
} |
33 |
} |
34 |
|
34 |
|
35 |
if (startDate > endDate) { |
35 |
if (startDate > endDate) { |
36 |
ok=1; |
36 |
ok=1; |
37 |
_alertString += _("Wrong date! start date cannot be after end date.\n"); |
37 |
_alertString += _("Wrong date! start date cannot be after end date.") + "\n"; |
38 |
} |
38 |
} |
39 |
if (endDate < (new Date)) { |
39 |
if (endDate < (new Date)) { |
40 |
ok=1; |
40 |
ok=1; |
41 |
_alertString += _("End date before today, Invalid end date!\n"); |
41 |
_alertString += _("End date before today, Invalid end date!") + "\n"; |
42 |
} |
42 |
} |
43 |
if (ok) { // if there is a problem |
43 |
if (ok) { // if there is a problem |
44 |
alert(_alertString); |
44 |
alert(_alertString); |