Password reset mail could take several hours. After fix only a couple of seconds...
[fa-stable.git] / gl / manage / close_period.php
index 76fc317f237eda874a4fd33dc1a491cc85b991fc..07d2d476eca52c98af06bc8d7d0f3ee88a4e3e9f 100644 (file)
@@ -17,16 +17,17 @@ include_once($path_to_root . "/includes/session.inc");
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/banking.inc");
+include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
 
 $js = "";
-if ($use_date_picker)
+if (user_use_date_picker())
        $js .= get_js_date_picker();
 page(_($help_context = "Closing GL Transactions"), false, false, "", $js);
 
 //---------------------------------------------------------------------------------------------
 function check_data()
 {
-       global $Refs, $allow_gl_reopen;
+       global $SysPrefs;
        
        if (!is_date($_POST['date']) || date1_greater_date2($_POST['date'], Today()))
        {
@@ -34,9 +35,15 @@ function check_data()
                set_focus('date');
                return false;
        }
+       if (!is_date_in_fiscalyears($_POST['date'], false))
+       {
+               display_error(_("Selected date is not in fiscal year or the year is closed."));
+               set_focus('date');
+               return false;
+       }
        if (date1_greater_date2(sql2date(get_company_pref('gl_closing_date')), $_POST['date']))
        {
-               if (!$allow_gl_reopen) {
+               if (!$SysPrefs->allow_gl_reopen) {
                        display_error(_("The entered date is earlier than date already selected as closing date."));
                        set_focus('date');
                        return false;
@@ -99,4 +106,3 @@ end_form();
 
 end_page();
 
-?>