- update_fiscalyear($selected_id, $_POST['closed']);
- display_notification(_('Selected fiscal year has been updated'));
+ if ($_POST['closed'] == 1)
+ {
+ if (check_years_before($_POST['from_date'], false))
+ {
+ display_error( _("Cannot CLOSE this year because there are open fiscal years before"));
+ set_focus('closed');
+ return false;
+ }
+ $ok = close_year($selected_id);
+ }
+ else
+ open_year($selected_id);
+ if ($ok)
+ {
+ update_fiscalyear($selected_id, $_POST['closed']);
+ display_notification(_('Selected fiscal year has been updated'));
+ }