From fec9202ce1b68c0dcdead1cfd8aec1ac1a327069 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Tue, 5 May 2009 17:22:03 +0000
Subject: [PATCH] Qual: Remove deprecated code

---
 htdocs/docs/pre.inc.php                       | 37 +++++--------------
 .../menus/barre_top/eldy_backoffice.php       |  2 +-
 .../menus/barre_top/eldy_frontoffice.php      |  2 +-
 htdocs/includes/menus/init_menu_auguria.sql   |  2 +-
 htdocs/pre.inc.php                            | 15 --------
 5 files changed, 12 insertions(+), 46 deletions(-)

diff --git a/htdocs/docs/pre.inc.php b/htdocs/docs/pre.inc.php
index b85f5fb34aa..f3b9b7cf72a 100644
--- a/htdocs/docs/pre.inc.php
+++ b/htdocs/docs/pre.inc.php
@@ -37,45 +37,26 @@ function llxHeader($head = "", $title="", $help_url='')
 
 	$menu = new Menu();
 
-	if ($conf->societe->enabled && $user->rights->societe->lire)
+	if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
 	{
 		$langs->load("companies");
-		$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("Companies"));
+		$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("ThirdParties"));
 
-		if(is_dir("societe/groupe"))
+		if ($user->rights->societe->creer)
 		{
-	  $menu->add_submenu(DOL_URL_ROOT."/societe/groupe/index.php", $langs->trans("MenuSocGroup"));
+	  		$menu->add_submenu(DOL_URL_ROOT."/soc.php?action=create", $langs->trans("MenuNewThirdParty"));
 		}
-		$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"));
-	}
-
-	if ($conf->commercial->enabled && $user->rights->commercial->main->lire)
-	{
-		$langs->load("commercial");
-		$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));
-
-		$menu->add_submenu(DOL_URL_ROOT."/comm/clients.php",$langs->trans("Customers"));
-		$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php",$langs->trans("Prospects"));
 
-		if ($user->rights->propale->lire)
-		{
-	  $langs->load("propal");
-	  $menu->add_submenu(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop"));
-		}
+		$menu->add_submenu(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"));
 	}
 
-	if ($conf->compta->enabled || $conf->comptaexpert->enabled)
+	if (! empty($conf->categorie->enabled))
 	{
-		$langs->load("compta");
-		$menu->add(DOL_URL_ROOT."/compta/index.php", $langs->trans("MenuFinancial"));
-
-		if ($user->rights->facture->lire) {
-			$langs->load("bills");
-			$menu->add_submenu(DOL_URL_ROOT."/compta/facture.php", $langs->trans("Bills"));
-		}
+		$langs->load("categories");
+		$menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("Categories"));
 	}
 
-	if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire)
+	if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
 	{
 		$langs->trans("interventions");
 		$menu->add(DOL_URL_ROOT."/fichinter/index.php", $langs->trans("Interventions"));
diff --git a/htdocs/includes/menus/barre_top/eldy_backoffice.php b/htdocs/includes/menus/barre_top/eldy_backoffice.php
index cd854fb3561..18e4de13721 100644
--- a/htdocs/includes/menus/barre_top/eldy_backoffice.php
+++ b/htdocs/includes/menus/barre_top/eldy_backoffice.php
@@ -162,7 +162,7 @@ class MenuTop {
 			}
 
 			$idsel='id="commercial" ';
-			if($user->rights->societe->lire)
+			if($user->rights->societe->lire || $user->rights->societe->contact->lire)
 			{
 				print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Commercial").'</a></td>';
 			}
diff --git a/htdocs/includes/menus/barre_top/eldy_frontoffice.php b/htdocs/includes/menus/barre_top/eldy_frontoffice.php
index 4dbd1ba9a75..265fd5e955f 100644
--- a/htdocs/includes/menus/barre_top/eldy_frontoffice.php
+++ b/htdocs/includes/menus/barre_top/eldy_frontoffice.php
@@ -162,7 +162,7 @@ class MenuTop {
 			}
 
 			$idsel='id="commercial" ';
-			if($user->rights->societe->lire)
+			if($user->rights->societe->lire || $user->rights->societe->contact->lire)
 			{
 				print '<td class="tmenu"><a '.$class.' '.$idsel.'href="'.DOL_URL_ROOT.'/comm/index.php?mainmenu=commercial&amp;leftmenu="'.($this->atarget?" target=$this->atarget":"").'>'.$langs->trans("Commercial").'</a></td>';
 			}
diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql
index 6a6414ef53d..0036209f870 100644
--- a/htdocs/includes/menus/init_menu_auguria.sql
+++ b/htdocs/includes/menus/init_menu_auguria.sql
@@ -19,7 +19,7 @@ insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`,
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 2__+MAX_llx_menu__, 'auguria', 'top', 'companies',   '', 0, '/index.php?mainmenu=companies&amp;leftmenu=', 'ThirdParties', -1, 'companies', '', '', 2, 2);
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 3__+MAX_llx_menu__, 'auguria', 'top', 'products',    '', 0, '/product/index.php?mainmenu=products&amp;leftmenu=', 'Products/Services', -1, 'products', '$user->rights->produit->lire', '', 0, 3);
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 4__+MAX_llx_menu__, 'auguria', 'top', 'suppliers',   '', 0, '/fourn/index.php?mainmenu=suppliers&amp;leftmenu=', 'Suppliers', -1, 'suppliers', '$user->rights->fournisseur->lire', '', 0, 4);
-insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 5__+MAX_llx_menu__, 'auguria', 'top', 'commercial',  '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->commercial->main->lire', '', 2, 5);
+insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 5__+MAX_llx_menu__, 'auguria', 'top', 'commercial',  '', 0, '/comm/index.php?mainmenu=commercial&amp;leftmenu=', 'Commercial', -1, 'commercial', '$user->rights->societe->lire || $user->rights->societe->contact->lire', '', 2, 5);
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 6__+MAX_llx_menu__, 'auguria', 'top', 'accountancy', '', 0, '/compta/index.php?mainmenu=accountancy&amp;leftmenu=', 'MenuFinancial', -1, 'compta', '$user->rights->compta->resultat->lire || $user->rights->comptaexpert->plancompte->lire || $user->rights->commande->lire || $user->rights->facture->lire || $user->rights->banque->lire', '', 2, 6);
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 7__+MAX_llx_menu__, 'auguria', 'top', 'project',     '', 0, '/projet/index.php?mainmenu=project&amp;leftmenu=', 'Projects', -1, 'projects', '$user->rights->projet->lire', '', 0, 7);
 insert into `llx_menu` (`rowid`, `menu_handler`, `type`, `mainmenu`, `leftmenu`, `fk_menu`, `url`, `titre`, `level`, `langs`, perms, `target`, `user`, position) values ( 8__+MAX_llx_menu__, 'auguria', 'top', 'tools',       '', 0, '/index.php?mainmenu=tools&amp;leftmenu=', 'Tools', -1, 'other', '$user->rights->mailing->lire || $user->rights->bookmark->lire || $user->rights->export->lire', '', 2, 8);
diff --git a/htdocs/pre.inc.php b/htdocs/pre.inc.php
index aba0e3fe90d..762e8d56d6f 100644
--- a/htdocs/pre.inc.php
+++ b/htdocs/pre.inc.php
@@ -55,21 +55,6 @@ function llxHeader($head = '', $title='', $help_url='')
 		$menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("Categories"));
 	}
 
-	if (! empty($conf->commercial->enabled) && isset($user->rights->commercial->main->lire) && $user->rights->commercial->main->lire)
-	{
-		$langs->load("commercial");
-		$menu->add(DOL_URL_ROOT."/comm/index.php",$langs->trans("Commercial"));
-
-		$menu->add_submenu(DOL_URL_ROOT."/comm/clients.php",$langs->trans("Customers"));
-		$menu->add_submenu(DOL_URL_ROOT."/comm/prospect/prospects.php",$langs->trans("Prospects"));
-
-		if ($user->rights->propale->lire)
-		{
-	  		$langs->load("propal");
-	  		$menu->add_submenu(DOL_URL_ROOT."/comm/propal.php", $langs->trans("Prop"));
-		}
-	}
-
 	if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
 	{
 		$langs->trans("interventions");
-- 
GitLab