Added chart packages installation.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 6 Aug 2010 14:50:32 +0000 (14:50 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Fri, 6 Aug 2010 14:50:32 +0000 (14:50 +0000)
admin/inst_chart.php [new file with mode: 0644]
applications/setup.php

diff --git a/admin/inst_chart.php b/admin/inst_chart.php
new file mode 100644 (file)
index 0000000..35e7667
--- /dev/null
@@ -0,0 +1,98 @@
+<?php
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       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/gpl-3.0.html>.
+***********************************************************************/
+$page_security = 'SA_CREATEMODULES';
+$path_to_root="..";
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root."/includes/packages.inc");
+
+if ($use_popup_windows) {
+       $js = get_js_open_window(900, 500);
+}
+page(_($help_context = "Install Charts of Accounts"), false, false, '', $js);
+
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/admin/db/company_db.inc");
+include_once($path_to_root . "/admin/db/maintenance_db.inc");
+include_once($path_to_root . "/includes/ui.inc");
+
+//---------------------------------------------------------------------------------------------
+
+if ($id = find_submit('Delete', false))
+{
+       $extensions = get_company_extensions();
+       if (($extensions[$id]['type']=='chart') && uninstall_package($extensions[$id]['package'])) {
+               unset($extensions[$id]);
+               if (update_extensions($extensions)) {
+                       display_notification(_("Selected chart has been successfully deleted"));
+                       meta_forward($_SERVER['PHP_SELF']);
+               }
+       }
+}
+
+if ($id = find_submit('Update', false))
+       install_extension($id);
+
+//---------------------------------------------------------------------------------------------
+start_form(true);
+
+       div_start('ext_tbl');
+       start_table(TABLESTYLE);
+
+       $th = array(_("Chart"),  _("Installed"), _("Available"), _("Encoding"), "", "");
+       table_header($th);
+
+       $k = 0;
+       $mods = get_charts_list();
+
+       foreach($mods as $pkg_name => $ext)
+       {
+               $available = @$ext['available'];
+               $installed = @$ext['version'];
+               $id = @$ext['local_id'];
+               $encoding = @$ext['encoding'];
+
+               alt_table_row_color($k);
+
+//             label_cell(is_array($ext['Descr']) ? $ext['Descr'][0] : $ext['Descr']);
+               label_cell($available ? get_package_view_str($pkg_name, $ext['name']) : $ext['name']);
+
+               label_cell($id === null ? _("None") :
+                       ($available && $installed ? $installed : _("Unknown")));
+               label_cell($available ? $available : _("None"));
+               label_cell($encoding ? $encoding : _("Unknown"));
+
+               if ($available && check_pkg_upgrade($installed, $available)) // outdated or not installed theme in repo
+                       button_cell('Update'.$pkg_name, $installed ? _("Update") : _("Install"),
+                               _('Upload and install latest extension package'), ICON_DOWN);
+               else
+                       label_cell('');
+
+               if ($id !== null) {
+                       delete_button_cell('Delete'.$id, _('Delete'));
+                       submit_js_confirm('Delete'.$id, 
+                               sprintf(_("You are about to remove package \'%s\'.\nDo you want to continue ?"), 
+                                       $ext['name']));
+               } else
+                       label_cell('');
+
+               end_row();
+       }
+
+       end_table(1);
+
+       div_end();
+
+//---------------------------------------------------------------------------------------------
+end_form();
+
+end_page();
+?>
\ No newline at end of file
index 89b095ecf30e92933f2c0a51e6f6ddcffefef3fd..344ee00a6cc08d1fdb66afd70e563425c372ed6b 100644 (file)
@@ -70,7 +70,9 @@ class setup_app extends application
                $this->add_rapp_function(2, _("Install/Activate &Extensions"),
                        "admin/inst_module.php?", 'SA_CREATEMODULES');
                $this->add_rapp_function(2, _("Install/Activate &Themes"),
-                       "admin/inst_theme.php?", 'SA_CREATEMODULES');
+                       "admin/inst_module.php?", 'SA_CREATEMODULES');
+               $this->add_rapp_function(2, _("Install/Activate &Chart of Accounts"),
+                       "admin/inst_chart.php?", 'SA_CREATEMODULES');
                $this->add_rapp_function(2, _("Software &Upgrade"),
                        "admin/inst_upgrade.php?", 'SA_SOFTWAREUPGRADE');