<?php
-
+/**********************************************************************
+ Copyright (C) FrontAccounting, LLC.
+ Released under the terms of the GNU Affero General Public License,
+ AGPL, as published by the Free Software Foundation, either version
+ 3 of the License, or (at your option) any later version.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
+***********************************************************************/
$page_security = 9;
$path_to_root="..";
include_once($path_to_root . "/includes/session.inc");
{
global $selected_id, $Mode;
- if (!check_data())
- return false;
-
if ($selected_id != -1)
{
- update_fiscalyear($_POST['from_date'], $_POST['closed']);
+ update_fiscalyear($selected_id, $_POST['closed']);
display_notification(_('Selected fiscal year has been updated'));
}
else
{
+ if (!check_data())
+ return false;
add_fiscalyear($_POST['from_date'], $_POST['to_date'], $_POST['closed']);
display_notification(_('New fiscal year has been added'));
}
{
global $selected_id, $Mode;
- if (!check_can_delete($selected_id))
- return;
+ if (check_can_delete($selected_id)) {
//only delete if used in neither customer or supplier, comp prefs, bank trans accounts
-
- delete_fiscalyear($selected_id);
- display_notification(_('Selected fiscal year has been deleted'));
+ delete_fiscalyear($selected_id);
+ display_notification(_('Selected fiscal year has been deleted'));
+ }
$Mode = 'RESET';
}
label_cell($closed_text);
edit_button_cell("Edit".$myrow['id'], _("Edit"));
if ($myrow["id"] != $company_year)
- edit_button_cell("Delete".$myrow['id'], _("Delete"));
+ delete_button_cell("Delete".$myrow['id'], _("Delete"));
+ else
+ label_cell('');
end_row();
}