Removed obsolete $tabs global array, tab ids retrieved from $_SESSION['App']
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 24 Oct 2009 19:59:38 +0000 (19:59 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sat, 24 Oct 2009 19:59:38 +0000 (19:59 +0000)
admin/inst_module.php
includes/page/header.inc
includes/types.inc
includes/ui/ui_lists.inc

index 2329146cf05af39c4ac60adbbb82f917221cdd6f..c85dd49ad11863599fca3c9aca5e2a615625116f 100644 (file)
@@ -188,7 +188,7 @@ function handle_delete()
 
 function display_extensions()
 {
-       global $table_style, $tabs;
+       global $table_style;
 
        start_table($table_style);
        $th = array(_("Name"),_("Tab"), _("Link text"), _("Folder"), _("Filename"), 
@@ -204,7 +204,8 @@ function display_extensions()
                $is_mod = $mod['type'] == 'module';
                alt_table_row_color($k);
                label_cell($mod['name']);
-               label_cell( $is_mod ? $mod['title'] : $tabs[$mod['tab']]);
+               label_cell( $is_mod ? 
+                       $mod['title'] : access_string($_SESSION['App']->applications[$mod['tab']]->name, true));
                $ttl = access_string($mod['title']);
                label_cell($ttl[0]);
                label_cell($mod['path']);
@@ -228,7 +229,7 @@ function display_extensions()
 
 function company_extensions($id)
 {
-       global $table_style, $tabs;
+       global $table_style;
 
        start_table($table_style);
        
@@ -253,7 +254,8 @@ function company_extensions($id)
        {
                alt_table_row_color($k);
                label_cell($mod['name']);
-               label_cell($mod['type'] == 'module' ? $mod['title'] : $tabs[$mod['tab']]);
+               label_cell( $mod['type'] == 'module' ? 
+                       $mod['title'] : access_string($_SESSION['App']->applications[$mod['tab']]->name, true));
                $ttl = access_string($mod['title']);
                label_cell($ttl[0]);
                check_cells(null, 'Active'.$i, @$mod['active'] ? 1:0, 
@@ -294,7 +296,7 @@ function display_ext_edit($selected_id)
        text_row_ex(_("Name"), 'name', 30);
        text_row_ex(_("Folder"), 'path', 20);
 
-       tab_list_row(_("Menu Tab"), 'tab', null);
+       tab_list_row(_("Menu Tab"), 'tab', null, true);
        text_row_ex(_("Menu Link Text"), 'title', 30);
 
        record_status_list_row(_("Default status"), 'active');
index 8b1b36e2f4c338a62221994767ebd562ed1ff14a..65003be49eb533b62f2a61c7a44ecf83a3624f7c 100644 (file)
@@ -102,8 +102,13 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        else
                $sel_app = user_startup_tab();
        $_SESSION["sel_app"] = $sel_app;
+
+       // When startup tab for current user was set to already 
+       // removed/inactivated extension module select Sales tab as default.
        if (isset($_SESSION["App"]) && is_object($_SESSION["App"]))
-               $_SESSION["App"]->selected_application = $sel_app;
+               $_SESSION["App"]->selected_application = 
+                       isset($_SESSION["App"]->applications[$sel_app]) ? $sel_app : 'orders';
+                       
        $encoding = $_SESSION['language']->encoding;
 
        if (!headers_sent()){
index f9acce38cc845a187c0935d7c961f271c20777be..3636a4936e3eee4287504da194059956ee210755 100644 (file)
@@ -89,17 +89,6 @@ $bank_transfer_types = array(
                        _("Cash")
        );
 
-//----------------------------------------------------------------------------------
-// Core FA menu tabs (modules)
-//
-$tabs = array('orders'=>_("Sales"), 
-                       'AP'=>_("Purchases"),
-                       'stock'=>_("Items and Inventory"),
-                       'manuf'=>_("Manufacturing"), 
-                       'proj'=>_("Dimensions"),
-                       'GL'=>_("Banking and General Ledger"),
-                       'system'=>_("Setup"));
-
 include_once($path_to_root . "/manufacturing/includes/manufacturing_db.inc");
 include_once($path_to_root . "/purchasing/includes/purchasing_db.inc");
 include_once($path_to_root . "/sales/includes/sales_db.inc");
index 3a34efba66bcd3d8a98af592fb9253775691acd6..a68454cf8b267c7c1a0a430a0e9e81ae49da44dd 100644 (file)
@@ -2127,16 +2127,23 @@ function security_roles_list_row($label, $name, $selected_id=null, $new_item=fal
        return $str;
 }
 
-function tab_list_row($label, $name, $selected_id=null)
+function tab_list_row($label, $name, $selected_id=null, $all = false)
 {
-       global $tabs;
+       global $installed_extensions;
+       
+       $tabs = array();
+       foreach ($_SESSION['App']->applications as $app) {
+               $tabs[$app->id] = access_string($app->name, true);
+       }
+       if ($all) {     // add also not active ext. modules
+               foreach ($installed_extensions as $ext) {
+                       if ($ext['type'] == 'module' && !$ext['active'])
+                               $tabs[$ext['tab']] = access_string($ext['title'], true);
+               }
+       }
        echo "<tr>\n";
        echo "<td>$label</td><td>\n";
-
-       $items = array();
-
        array_selector($name, $selected_id, $tabs);
-
        echo "</td></tr>\n";
 }