2 /**********************************************************************
3 Copyright (C) FrontAccounting, LLC.
4 Released under the terms of the GNU General Public License, GPL,
5 as published by the Free Software Foundation, either version 3
6 of the License, or (at your option) any later version.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $page_security = 'SA_CREATEMODULES';
14 include_once($path_to_root . "/includes/session.inc");
15 include_once($path_to_root."/includes/packages.inc");
17 if ($use_popup_windows) {
18 $js = get_js_open_window(900, 500);
20 page(_($help_context = "Install Charts of Accounts"), false, false, '', $js);
22 include_once($path_to_root . "/includes/date_functions.inc");
23 include_once($path_to_root . "/admin/db/company_db.inc");
24 include_once($path_to_root . "/admin/db/maintenance_db.inc");
25 include_once($path_to_root . "/includes/ui.inc");
27 //---------------------------------------------------------------------------------------------
29 if ($id = find_submit('Delete', false))
31 $extensions = get_company_extensions();
32 if (($extensions[$id]['type']=='chart') && uninstall_package($extensions[$id]['package'])) {
33 unset($extensions[$id]);
34 if (update_extensions($extensions)) {
35 display_notification(_("Selected chart has been successfully deleted"));
36 meta_forward($_SERVER['PHP_SELF']);
41 if ($id = find_submit('Update', false))
42 install_extension($id);
44 //---------------------------------------------------------------------------------------------
48 start_table(TABLESTYLE);
50 $th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", "");
54 $mods = get_charts_list();
56 foreach($mods as $pkg_name => $ext)
58 $available = @$ext['available'];
59 $installed = @$ext['version'];
60 $id = @$ext['local_id'];
61 $encoding = @$ext['encoding'];
63 alt_table_row_color($k);
65 // label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']);
66 label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
68 label_cell($id === null ? _("None") :
69 ($available && $installed ? $installed : _("Unknown")));
70 label_cell($available ? $available : _("None"));
71 label_cell($encoding ? $encoding : _("Unknown"));
73 if ($available && check_pkg_upgrade($installed, $available)) // outdated or not installed theme in repo
74 button_cell('Update'.$pkg_name, $installed ? _("Update") : _("Install"),
75 _('Upload and install latest extension package'), ICON_DOWN);
80 delete_button_cell('Delete'.$id, _('Delete'));
81 submit_js_confirm('Delete'.$id,
82 sprintf(_("You are about to remove package \'%s\'.\nDo you want to continue ?"),
94 //---------------------------------------------------------------------------------------------