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 ($SysPrefs->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 //---------------------------------------------------------------------------------------------
46 function sortByOption($a, $b) {
47 return strcmp($a['name'], $b['name']);
54 $mods = get_charts_list();
57 display_note(_("No optional chart of accounts is currently available."));
60 uasort($mods, 'sortByOption');
62 $th = array(_("Chart"), _("Installed"), _("Available"), _("Encoding"), "", "");
65 start_table(TABLESTYLE);
67 foreach($mods as $pkg_name => $ext)
69 $available = @$ext['available'];
70 $installed = @$ext['version'];
71 $id = @$ext['local_id'];
72 $encoding = @$ext['encoding'];
74 alt_table_row_color($k);
76 label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
78 label_cell($id === null ? _("None") :
79 ($available && $installed ? $installed : _("Unknown")));
80 label_cell($available ? $available : _("None"));
81 label_cell($encoding ? $encoding : _("Unknown"));
83 if ($available && check_pkg_upgrade($installed, $available)) // outdated or not installed theme in repo
84 button_cell('Update'.$pkg_name, $installed ? _("Update") : _("Install"),
85 _('Upload and install latest extension package'), ICON_DOWN);
90 delete_button_cell('Delete'.$id, _('Delete'));
91 submit_js_confirm('Delete'.$id,
92 sprintf(_("You are about to remove package \'%s\'.\nDo you want to continue ?"),
103 //---------------------------------------------------------------------------------------------