Merged latest changes from stable branch.
[fa-stable.git] / gl / accruals.php
index 660c700395f4ccc9638eff8a31568249a88d60fd..4bfc923b10517901bb401cb78c08f8e5867262e1 100644 (file)
@@ -35,7 +35,7 @@ if (isset($_POST['go']) || isset($_POST['show']))
        }
        elseif (!is_date_in_fiscalyear($_POST['date_']))
        {
-               display_error(_("The entered date is not in fiscal year."));
+               display_error(_("The entered date is out of fiscal year or is closed for further data entry."));
                set_focus('date_');
                $input_error = 1;
        }
@@ -57,6 +57,10 @@ if (isset($_POST['go']) || isset($_POST['show']))
                $per = $periods - 1;
                $date = $date_ = get_post('date_');
                $freq = get_post('freq');
+               if ($freq == 3 || $freq == 4) {
+                       $date_ = begin_month($date_); // avoid skip on shorter months
+                       $date  = end_month($date_); // avoid skip on shorter months
+               }
                $lastdate = ($freq == 1 ? add_days($date_, 7*$per)
                                : ($freq == 2 ? add_days($date_, 14*$per)
                                : ($freq == 3 ? add_months($date_, $per)
@@ -64,7 +68,7 @@ if (isset($_POST['go']) || isset($_POST['show']))
 
                if (!is_date_in_fiscalyears($lastdate, false))
                {
-                       display_error(_("Some of the period dates are outside the fiscal year. Create a new fiscal year first!"));
+                       display_error(_("Some of the period dates are outside the fiscal year or are closed for further data entry. Create a new fiscal year first!"));
                        set_focus('date_');
                        $input_error = 1;
                }