function check_data()
{
- if (!is_date($_POST['from_date']) || is_date_in_fiscalyears($_POST['from_date']) || is_bad_begin_date($_POST['from_date']))
+ if (!is_date($_POST['from_date']) || is_date_in_fiscalyears($_POST['from_date']))
{
display_error( _("Invalid BEGIN date in fiscal year."));
set_focus('from_date');
set_focus('to_date');
return false;
}
+ if (!check_begin_end_date($_POST['from_date'], $_POST['to_date']))
+ {
+ display_error( _("Invalid BEGIN or END date in fiscal year."));
+ set_focus('from_date');
+ return false;
+ }
if (date1_greater_date2($_POST['from_date'], $_POST['to_date']))
{
display_error( _("BEGIN date bigger than END date."));
start_form();
display_note(_("Warning: Deleting a fiscal year all transactions
are removed and converted into relevant balances. This process is irreversible!"),
- 0, 0, "class='currentfg'");
+ 0, 1, "class='currentfg'");
start_table(TABLESTYLE);
$th = array(_("Fiscal Year Begin"), _("Fiscal Year End"), _("Closed"), "", "");
}
else
{
+ $begin = next_begin_date();
+ if ($begin && $Mode != 'ADD_ITEM')
+ {
+ $_POST['from_date'] = $begin;
+ $_POST['to_date'] = end_month(add_months($begin, 11));
+ }
date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
date_row(_("Fiscal Year End:"), 'to_date', '', null, 0, 0, 1001);
}