Fixed maximum nam length.
[fa-stable.git] / admin / fiscalyears.php
index 6f3071648c879be0f5cf58ca1f7771a3ab57148a..1926d48e1719c6c0a6bec73b5ac605f4f8f2b5e8 100644 (file)
@@ -29,7 +29,7 @@ simple_page_mode(true);
 
 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']) || !check_begin_date($_POST['from_date']))
        {
                display_error( _("Invalid BEGIN date in fiscal year."));
                set_focus('from_date');
@@ -126,7 +126,7 @@ function display_fiscalyears()
        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"), "", "");
@@ -196,7 +196,16 @@ function display_fiscalyear_edit($selected_id)
        }
        else
        {
-               date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
+               $begin = check_begin_date("", false);
+               if ($begin)
+               {
+                       $_POST['from_date'] = $begin;
+                       hidden('from_date', $begin);
+                       $_POST['to_date'] = end_month(add_months($begin, 11));
+                       label_row(_("Fiscal Year Begin:"), $_POST['from_date']);
+               }
+               else
+                       date_row(_("Fiscal Year Begin:"), 'from_date', '', null, 0, 0, 1001);
                date_row(_("Fiscal Year End:"), 'to_date', '', null, 0, 0, 1001);
        }
        hidden('selected_id', $selected_id);