Changed default startup_up app to be in user preferences. Default 'Sales'.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 25 Aug 2009 09:20:37 +0000 (09:20 +0000)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 25 Aug 2009 09:20:37 +0000 (09:20 +0000)
  Moved tab_list_row to ui_lists.inc and changed the global $tabs to be in types.inc

13 files changed:
CHANGELOG.txt
admin/db/users_db.inc
admin/display_prefs.php
admin/inst_module.php
config.php
includes/current_user.inc
includes/page/header.inc
includes/prefs/userprefs.inc
includes/types.inc
includes/ui/ui_lists.inc
sql/alter2.2.sql
sql/en_US-demo.sql
sql/en_US-new.sql

index d21348f37af5234c2a6f405ab9aa3b890581e3b6..da74759a5403fecb018bf944bc937579472d6ff6 100644 (file)
@@ -22,6 +22,21 @@ $ -> Affected files
 25-Aug-2009 Joe Hunt
 + Added reference number in report List of Journal Entries.
 $ /reporting/rep702.php
+! Changed default startup_up app to be in user preferences. Default 'Sales'.
+  Moved tab_list_row to ui_lists.inc and changed the global $tabs to be in types.inc
+$ config.php
+  /admin/display_prefs.php
+  /admin/inst_module.php
+  /admin/db/users_db.inc
+  /includes/current_user.inc
+  /includes/types.inc
+  /includes/page/header.inc
+  /includes/prefs/userprefs.inc
+  /includes/ui/ui_lists.inc
+  /sql/alter2.2.sql
+  /sql/en_US-demo.sql
+  /sql/en_US-new.sql
+  
 
 24-Aug-2009 Janusz Dobrowolski
 # Fixed warning displayed before db upgrade.
index 527b89ce3b90cfc7d80be2e21ecf7169c641be4b..ebb9c8f6936e716fb1b9c1c2186bda3c2a4cbf75 100644 (file)
@@ -56,7 +56,7 @@ function update_user($id, $user_id, $real_name, $phone, $email, $full_access,
 function update_user_display_prefs($id, $price_dec, $qty_dec, $exrate_dec, 
        $percent_dec, $showgl, $showcodes, $date_format, $date_sep, $tho_sep, 
        $dec_sep, $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, 
-       $graphic_links, $lang, $stickydate)
+       $graphic_links, $lang, $stickydate, $startup_tab)
 {
        $sql = "UPDATE ".TB_PREF."users SET
                prices_dec=".db_escape($price_dec).",
@@ -77,7 +77,8 @@ function update_user_display_prefs($id, $price_dec, $qty_dec, $exrate_dec,
                query_size=$query_size,
                graphic_links=$graphic_links,
                language=".db_escape($lang).",
-               sticky_doc_date=".db_escape($stickydate)."
+               sticky_doc_date=".db_escape($stickydate).",
+               startup_tab=".db_escape($startup_tab)."
                WHERE id = ".db_escape($id);
 
        db_query($sql, "could not update user display prefs for $id");
index 6d1bd6c47e839ec6b3139778e6e9e3df12b9b70a..1d77d28614b157fd4105cb62f8c4ce6bcaef53d0 100644 (file)
@@ -42,7 +42,7 @@ if (isset($_POST['setprefs']))
                        $_POST['theme'], $_POST['page_size'], check_value('show_hints'),
                        $_POST['profile'], check_value('rep_popup'), 
                        (int)($_POST['query_size']), check_value('graphic_links'), 
-                       $_POST['language'], check_value('sticky_doc_date'));
+                       $_POST['language'], check_value('sticky_doc_date'), $_POST['startup_tab']);
 
                if ($chg_lang)
                        language::set_language($_POST['language']);
@@ -110,6 +110,8 @@ possible separators can be added by modifying the array definition by editing th
 
 pagesizes_list_row(_("Page Size:"), "page_size", user_pagesize());
 
+tab_list_row(_("Start-up Tab"), 'startup_tab', user_startup_tab());
+
 /* The array $pagesizes is set up in config.php for modifications
 possible separators can be added by modifying the array definition by editing that file */
 
index 622f5305395dab621790ae4a20d4c1573cd888f9..342c3e7f811007c99313f64ff52889a95b352e74 100644 (file)
@@ -21,10 +21,6 @@ include_once($path_to_root . "/admin/db/maintenance_db.inc");
 include_once($path_to_root . "/modules/installed_modules.php");
 include_once($path_to_root . "/includes/ui.inc");
 
-$tabs = array('orders', 'AP', 'stock', 'manuf', 'proj', 'GL', 'system');
-$names = array(_("Sales"), _("Purchases"), _("Items and Inventory"), _("Manufacturing"),
-       _("Dimensions"), _("Banking and General Ledger"), _("Setup"));
-
 //---------------------------------------------------------------------------------------------
 
 if (isset($_GET['selected_id']))
@@ -40,39 +36,6 @@ else
 
 //---------------------------------------------------------------------------------------------
 
-function get_tab_title($tab)
-{
-       global $tabs, $names;
-       for ($i = 0; $i < count($tabs); $i++)
-       {
-               if ($tabs[$i] == $tab)
-                       return $names[$i];
-       }
-       return "";
-}
-
-function tab_list_row($label, $name, $selected)
-{
-       global $tabs, $names;
-       echo "<tr>\n";
-       if ($label != null)
-               echo "<td>$label</td>\n";
-       if ($selected == null)
-               $selected = (!isset($_POST[$name]) ? "orders" : $_POST[$name]);
-       echo "<td><select name='$name'>";
-       for ($i = 0; $i < count($tabs); $i++)
-       {
-               if ($selected == $tabs[$i])
-                       echo "<option selected value='".$tabs[$i]."'>" . $names[$i]. "</option>\n";
-               else
-                       echo "<option value='".$tabs[$i]."'>" . $names[$i]. "</option>\n";
-       }
-       echo "</select></td>\n";
-       echo "</tr>\n";
-}
-
-//---------------------------------------------------------------------------------------------
-
 function check_data()
 {
        if ($_POST['name'] == "" || $_POST['path'] == "")
@@ -263,7 +226,7 @@ function handle_delete()
 
 function display_modules()
 {
-       global $table_style, $installed_modules;
+       global $table_style, $installed_modules, $tabs;
 
        echo "
                <script language='javascript'>
@@ -284,7 +247,7 @@ function display_modules()
        {
                alt_table_row_color($k);
 
-               label_cell(get_tab_title($mods[$i]['tab']));
+               label_cell($tabs[$mods[$i]['tab']]);
                label_cell($mods[$i]['name']);
                label_cell($mods[$i]['path']);
                label_cell($mods[$i]['filename']);
index d6eeddf280e5daa2a902bb3e4f7ff2181178074b..c1508a559772772ac08d2e0b8a246f6aa85e465e 100644 (file)
@@ -172,9 +172,6 @@ if (!isset($path_to_root) || isset($_GET['path_to_root']) || isset($_POST['path_
                        array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,20),
        );
 
-       /* default start-up tab (orders/AP/stock/manuf/proj/GL/system) */
-       $def_app = "orders";
-
        //MySQL Backup and Restore Settings
 
 if(isset($_SESSION["wa_current_user"])) {
index 549c31b045897cf31ea57d23fa94d86a3ec40b8e..59ed4109e3226e334e84e820ad05daf012d65029 100644 (file)
@@ -114,11 +114,11 @@ class current_user
        function update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, 
                $showgl, $showcodes, $date_format, $date_sep, $tho_sep, $dec_sep, 
                $theme, $pagesize, $show_hints, $profile, $rep_popup, $query_size, 
-               $graphic_links, $lang, $stickydate) {
+               $graphic_links, $lang, $stickydate, $startup_tab) {
                update_user_display_prefs($this->user, $price_dec, 
                        $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes, 
                        $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, 
-                       $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate);
+                       $show_hints, $profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate, $startup_tab);
 
                // re-read the prefs
                $user = get_user($this->user);
@@ -312,14 +312,19 @@ function sticky_doc_date()
        return $_SESSION["wa_current_user"]->prefs->sticky_date();
 }
 
+function user_startup_tab()
+{
+       return $_SESSION["wa_current_user"]->prefs->start_up_tab();
+}
+
 function set_user_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
        $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints,
-       $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate)
+       $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate, $startup_tab)
 {
 
        $_SESSION["wa_current_user"]->update_prefs($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes,
                $date_format, $date_sep, $tho_sep, $dec_sep, $theme, $pagesize, $show_hints,
-               $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate);
+               $print_profile, $rep_popup, $query_size, $graphic_links, $lang, $stickydate, $startup_tab);
 }
 
 function add_user_js_data() {
index ac9283ec471113936c7248f9259cae7b3f920058..17bd333d22a15a193eb034e12baec744ef97e133 100644 (file)
@@ -100,7 +100,7 @@ function page_header($title, $no_menu=false, $is_index=false, $onload="", $js=""
        elseif (isset($_SESSION["sel_app"]) && $_SESSION["sel_app"] != "")
                $sel_app = $_SESSION["sel_app"];
        else
-               $sel_app = $def_app;
+               $sel_app = user_startup_tab();
        $_SESSION["sel_app"] = $sel_app;
        if (isset($_SESSION["App"]) && is_object($_SESSION["App"]))
                $_SESSION["App"]->selected_application = $sel_app;
index 7ba4c0c7ef40b301401ab4a8e2018833621ee7f5..32e92ce6df0fafd871ca75d1554c3d3d227aeecd 100644 (file)
@@ -34,6 +34,7 @@ class user_prefs
        var $query_size; // table pager page length
        var $graphic_links; // use graphic links
        var $sticky_date;       // save date on subsequent document entry
+       var $startup_tab;  // default start-up menu tab
        
        function user_prefs($user=null)
        {
@@ -67,6 +68,7 @@ class user_prefs
                        $this->query_size = $user["query_size"];
                        $this->graphic_links = $user["graphic_links"];
                        $this->sticky_date = $user["sticky_doc_date"];
+                       $this->startup_tab = $user['startup_tab'];
                }
        }
 
@@ -177,6 +179,11 @@ class user_prefs
                return $this->sticky_date;
        }
        
+       function start_up_tab()
+       {
+               return $this->startup_tab;
+       }
+
        function set_dec($price_dec, $qty_dec, $exrate_dec, $percent_dec, $showgl, $showcodes) 
        {
                $this->price_dec = $price_dec;
index 6039829edda9d1d5c8886c5032911fbdbd5e2726..ced641c24f0e55a3d353678aff36d545e5b86c98 100644 (file)
@@ -146,6 +146,11 @@ class bank_account_types
                return $bank_account_types_array[$index]['ptype'];
        }
 }
+
+/* Menu tabs */
+$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");
index 320e13cfad2230d3b11fd212c7565dcb1ea8d1c8..ad7a2cb542d2c5024ecc31b33af48d2caaef5710 100644 (file)
@@ -2134,5 +2134,18 @@ function security_roles_list_row($label, $name, $selected_id=null, $new_item=fal
        return $str;
 }
 
+function tab_list_row($label, $name, $selected_id=null)
+{
+       global $tabs;
+       echo "<tr>\n";
+       echo "<td>$label</td><td>\n";
+
+       $items = array();
+
+       array_selector($name, $selected_id, $tabs);
+
+       echo "</td></tr>\n";
+}
+
 
 ?>
\ No newline at end of file
index 49f9fc4d0dcaf7834782c7d5957f36e35e9fecd5..b3662df5961cb4f1d79a3f6af7374e9bba346751 100644 (file)
@@ -34,6 +34,7 @@ ALTER TABLE `0_stock_category` ADD COLUMN `dflt_dim2` int(11) default NULL;
 ALTER TABLE `0_stock_category` ADD COLUMN `dflt_no_sale` tinyint(1) NOT NULL default '0';
 
 ALTER TABLE `0_users` ADD COLUMN `sticky_doc_date` TINYINT(1) DEFAULT '0';
+ALTER TABLE `0_users` ADD COLUMN `startup_tab` VARCHAR(20) NOT NULL default '' AFTER sticky_doc_date;
 
 ALTER TABLE `0_debtors_master` MODIFY COLUMN `name` varchar(100) NOT NULL default '';
 
index 72d0785c6711eca96a7eb4c56c050f1d2da53d08..fa2d5c792a13b6df4a4e39967a7e234f355ffd39 100644 (file)
@@ -1851,6 +1851,7 @@ CREATE TABLE `0_users` (
   `print_profile` varchar(30) NOT NULL default '1',
   `rep_popup` tinyint(1) default '1',
   `sticky_doc_date` tinyint(1) default '0',
+  `startup_tab` varchar(20) NOT NULL default '',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY  (`user_id`)
@@ -1859,8 +1860,8 @@ CREATE TABLE `0_users` (
 
 ### Data of table `0_users` ###
 
-INSERT INTO `0_users` VALUES ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '1', '1', '0', '0');
-INSERT INTO `0_users` VALUES ('2', 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '999-999-999', 'demo@demo.nu', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '3', '1', '1', '0', '0', '2008-02-06 19:02:35', '10', '1', '1', '1', '1', '0', '0');
+INSERT INTO `0_users` VALUES ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '1', '1', '0', 'orders', '0');
+INSERT INTO `0_users` VALUES ('2', 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '999-999-999', 'demo@demo.nu', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '3', '1', '1', '0', '0', '2008-02-06 19:02:35', '10', '1', '1', '1', '1', '0', 'orders', '0');
 
 ### Structure of table `0_voided` ###
 
index d2266787b1cbb1d5fcf7329832bd18386427c99e..66ad32f472a3c7b656267c035b31b5eecaee8b1f 100644 (file)
@@ -1623,6 +1623,7 @@ CREATE TABLE `0_users` (
   `print_profile` varchar(30) NOT NULL default '1',
   `rep_popup` tinyint(1) default '1',
   `sticky_doc_date` tinyint(1) default '0',
+  `startup_tab` varchar(20) NOT NULL default '',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY  (`user_id`)
@@ -1631,7 +1632,7 @@ CREATE TABLE `0_users` (
 
 ### Data of table `0_users` ###
 
-INSERT INTO `0_users` VALUES ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2008-04-04 12:34:29', '10', '1', '1', '1', '1', '0', '0');
+INSERT INTO `0_users` VALUES ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2008-04-04 12:34:29', '10', '1', '1', '1', '1', '0', 'orders', '0');
 
 ### Structure of table `0_voided` ###