From 7633c94a60c870d7508d59cdd50cc450587264bb Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Wed, 29 Sep 2010 11:57:09 +0000
Subject: [PATCH] Qual: Menu management is simpler (no difference between left
 and top in setup).

---
 htdocs/admin/menus.php                        |  30 ---
 htdocs/admin/menus/edit.php                   |   3 -
 htdocs/admin/menus/index.php                  |   3 -
 htdocs/core/class/conf.class.php              |   4 +-
 htdocs/cron/functions_cron.lib.php            | 176 -----------------
 htdocs/fourn/stats.php                        | 183 ------------------
 htdocs/includes/menus/barre_left/eldy.lib.php |  48 +++--
 htdocs/includes/menus/init_menu_auguria.sql   |  18 +-
 .../mysql/tables/llx_fournisseur_ca.sql       |  29 ---
 htdocs/main.inc.php                           |  22 +--
 htdocs/user/param_ihm.php                     |   1 -
 11 files changed, 45 insertions(+), 472 deletions(-)
 delete mode 100644 htdocs/fourn/stats.php
 delete mode 100644 htdocs/install/mysql/tables/llx_fournisseur_ca.sql

diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php
index 95f0d77d8c2..e7b7755de51 100644
--- a/htdocs/admin/menus.php
+++ b/htdocs/admin/menus.php
@@ -62,19 +62,15 @@ if (isset($_POST["action"]) && $_POST["action"] == 'update' && empty($_POST["can
 	$_SESSION["mainmenu"]="home";   // Le gestionnaire de menu a pu changer
 
 	dolibarr_set_const($db, "MAIN_MENU_BARRETOP",      $_POST["main_menu_barretop"],'chaine',0,'',$conf->entity);
-	//dolibarr_set_const($db, "MAIN_MENU_BARRELEFT",     $_POST["main_menu_barreleft"],'chaine',0,'',$conf->entity);
 	dolibarr_set_const($db, "MAIN_MENU_SMARTPHONE",     $_POST["main_menu_smartphone"],'chaine',0,'',$conf->entity);
 
 	dolibarr_set_const($db, "MAIN_MENUFRONT_BARRETOP", $_POST["main_menufront_barretop"],'chaine',0,'',$conf->entity);
-	//dolibarr_set_const($db, "MAIN_MENUFRONT_BARRELEFT",$_POST["main_menufront_barreleft"],'chaine',0,'',$conf->entity);
 	dolibarr_set_const($db, "MAIN_MENUFRONT_SMARTPHONE",$_POST["main_menufront_smartphone"],'chaine',0,'',$conf->entity);
 
 	// Define list of menu handlers to initialize
 	$listofmenuhandler=array();
 	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_barretop"])]=1;
 	$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barretop"])]=1;
-	//$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_barreleft"])]=1;
-	//$listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_barreleft"])]=1;
 	if (isset($_POST["main_menu_smartphone"]))      $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menu_smartphone"])]=1;
 	if (isset($_POST["main_menufront_smartphone"])) $listofmenuhandler[preg_replace('/((_back|_front)office)?\.php/i','',$_POST["main_menufront_smartphone"])]=1;
 
@@ -160,18 +156,6 @@ if (isset($_GET["action"]) && $_GET["action"] == 'edit')
 	print '</td>';
 	print '</tr>';
 
-	// Menu left
-	/*$var=!$var;
-	print '<tr '.$bc[$var].'><td>'.$langs->trans("DefaultMenuLeftManager").'</td>';
-	print '<td>';
-	print $htmladmin->select_menu($conf->global->MAIN_MENU_BARRELEFT,'main_menu_barreleft',$dirleft);
-	print '</td>';
-	print '<td>';
-	print $htmladmin->select_menu($conf->global->MAIN_MENUFRONT_BARRELEFT,'main_menufront_barreleft',$dirleft);
-	print '</td>';
-	print '</tr>';
-    */
-
 	// Menu smartphone
 	if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
 	{
@@ -223,20 +207,6 @@ else
 	print '</td>';
 	print '</tr>';
 
-	/*$var=!$var;
-	print '<tr '.$bc[$var].'>';
-	print '<td>'.$langs->trans("DefaultMenuLeftManager").'</td>';
-	print '<td>';
-	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENU_BARRELEFT);
-	print $filelib;
-	print '</td>';
-	print '<td>';
-	$filelib=preg_replace('/.php$/i','',$conf->global->MAIN_MENUFRONT_BARRELEFT);
-	print $filelib;
-	print '</td>';
-	print '</tr>';
-    */
-
     if ($conf->global->MAIN_FEATURES_LEVEL >= 1)
     {
     	$var=!$var;
diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php
index 0b540de0cd0..14814fe5c75 100644
--- a/htdocs/admin/menus/edit.php
+++ b/htdocs/admin/menus/edit.php
@@ -44,12 +44,9 @@ $dirmenu = array($dirleft,$dirsmartphone);
 $mesg=$_GET["mesg"];
 
 $menu_handler_top=$conf->global->MAIN_MENU_BARRETOP;
-//$menu_handler_left=$conf->global->MAIN_MENU_BARRELEFT;
 $menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE;
 $menu_handler_top=preg_replace('/_backoffice.php/i','',$menu_handler_top);
 $menu_handler_top=preg_replace('/_frontoffice.php/i','',$menu_handler_top);
-//$menu_handler_left=preg_replace('/_backoffice.php/i','',$menu_handler_left);
-//$menu_handler_left=preg_replace('/_frontoffice.php/i','',$menu_handler_left);
 $menu_handler_smartphone=preg_replace('/_backoffice.php/i','',$menu_handler_smartphone);
 $menu_handler_smartphone=preg_replace('/_frontoffice.php/i','',$menu_handler_smartphone);
 
diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php
index d550c2908bc..59552d4cdcf 100644
--- a/htdocs/admin/menus/index.php
+++ b/htdocs/admin/menus/index.php
@@ -44,12 +44,9 @@ $dirmenu = array($dirleft,$dirsmartphone);
 $mesg=$_GET["mesg"];
 
 $menu_handler_top=$conf->global->MAIN_MENU_BARRETOP;
-//$menu_handler_left=$conf->global->MAIN_MENU_BARRELEFT;
 $menu_handler_smartphone=$conf->global->MAIN_MENU_SMARTPHONE;
 $menu_handler_top=preg_replace('/_backoffice.php/i','',$menu_handler_top);
 $menu_handler_top=preg_replace('/_frontoffice.php/i','',$menu_handler_top);
-//$menu_handler_left=preg_replace('/_backoffice.php/i','',$menu_handler_left);
-//$menu_handler_left=preg_replace('/_frontoffice.php/i','',$menu_handler_left);
 $menu_handler_smartphone=preg_replace('/_backoffice.php/i','',$menu_handler_smartphone);
 $menu_handler_smartphone=preg_replace('/_frontoffice.php/i','',$menu_handler_smartphone);
 
diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php
index 4497041c0e4..e0666b847d1 100644
--- a/htdocs/core/class/conf.class.php
+++ b/htdocs/core/class/conf.class.php
@@ -202,11 +202,9 @@ class Conf
 		//var_dump($this->modules);
 
 		// Clean some variables
-		// conf->menu_top et conf->menu_left are defined in main.inc.php (according to user choice)
+		// conf->menu_top is defined in main.inc.php
 		if (! $this->global->MAIN_MENU_BARRETOP) $this->global->MAIN_MENU_BARRETOP="eldy_backoffice.php";
 		if (! $this->global->MAIN_MENUFRONT_BARRETOP) $this->global->MAIN_MENUFRONT_BARRETOP="eldy_frontoffice.php";
-		//if (! $this->global->MAIN_MENU_BARRELEFT) $this->global->MAIN_MENU_BARRELEFT="eldy_backoffice.php";
-		//if (! $this->global->MAIN_MENUFRONT_BARRELEFT) $this->global->MAIN_MENUFRONT_BARRELEFT="eldy_frontoffice.php";
 		if (empty($this->global->MAIN_MENU_SMARTPHONE)) $this->global->MAIN_MENU_SMARTPHONE="iphone_backoffice.php";
 		if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="iphone_frontoffice.php";
 
diff --git a/htdocs/cron/functions_cron.lib.php b/htdocs/cron/functions_cron.lib.php
index d3d09e584d7..924c29ceee7 100644
--- a/htdocs/cron/functions_cron.lib.php
+++ b/htdocs/cron/functions_cron.lib.php
@@ -26,180 +26,4 @@
 
 
 
-/**
- * 		\deprecated		Function no more used
- */
-function batch_fournisseur_updateturnover($year)
-{
-	global $conf, $user, $db, $langs;
-
-	$fournisseurs = array();
-	$fournisseurs_ca_achat = array();
-	$products = array();
-	$real_products = array();
-
-
-	$sql  = "SELECT fk_soc, date_format(datef,'%Y'),sum(total_ht) ";
-	$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn";
-	$sql.= " WHERE entity = ".$conf->entity;
-	$sql.= " GROUP BY fk_soc, date_format(datef,'%Y') ";
-
-	$resql = $db->query($sql) ;
-
-	if ($resql)
-	{
-		while ($row = $db->fetch_row($resql))
-		{
-			$fournisseurs_ca_achat[$row[0]][$row[1]] = $row[2];
-		}
-		$db->free($resql);
-	}
-	else
-	{
-		dol_print_error($db);
-		return -1;
-	}
-
-	/*
-	 *
-	 *
-	 */
-	$sql = "SELECT fk_product,fk_soc ";
-	$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur";
-	$sql.= " WHERE entity = ".$conf->entity;
-
-	$resql = $db->query($sql) ;
-
-	if ($resql)
-	{
-		while ($row = $db->fetch_row($resql))
-		{
-			$products[$row[0]] = $row[1];
-		}
-		$db->free($resql);
-	}
-	else
-	{
-		dol_print_error($db);
-		return -1;
-	}
-
-	/*
-	 * Recuperation des id produits en lieu et place
-	 * des id de sous-produits
-	 */
-	foreach($products as $key => $value)
-	{
-		$sql = "SELECT fk_product ";
-		$sql.= " FROM ".MAIN_DB_PREFIX."product_subproduct";
-		$sql.= " WHERE fk_product_subproduct ='".$key."';";
-
-		$resql = $db->query($sql) ;
-
-		if ($resql)
-		{
-			if ($db->num_rows($resql) > 0)
-			{
-				$row = $db->fetch_row($resql);
-				$real_products[$row[0]] = $value;
-			}
-			else
-			{
-				$real_products[$key] = $value;
-			}
-			$db->free($resql);
-		}
-		else
-		{
-			dol_print_error($db);
-			return -1;
-		}
-	}
-
-	/*
-	 * Recuperation des id produits en lieu et place
-	 * des id de sous-produits
-	 */
-	$ca_products = array();
-	$ca_fourns = array();
-	foreach($real_products as $key => $value)
-	{
-		$sql = "SELECT sum(fd.total_ht) ";
-		$sql.= " FROM ".MAIN_DB_PREFIX."facturedet as fd, ".MAIN_DB_PREFIX."facture as f";
-		$sql.= " WHERE fk_product ='".$key."'";
-		$sql.= " AND f.rowid = fd.fk_facture";
-		$sql.= " WHERE f.entity = ".$conf->entity;
-		$sql.= " AND date_format(f.datef,'%Y') = '".$year."';";
-
-		$resql = $db->query($sql) ;
-
-		if ($resql)
-		{
-
-			$row = $db->fetch_row($resql);
-			$ca_products[$key] = $row[0];
-			$ca_fourns[$value] += $row[0];
-
-			$db->free($resql);
-		}
-		else
-		{
-			dol_print_error($db);
-			return -1;
-		}
-	}
-	/*
-	 * Mets a jour la table fournisseur
-	 *
-	 */
-	foreach($ca_fourns as $key => $value)
-	{
-		$sqld = "DELETE FROM ".MAIN_DB_PREFIX."fournisseur_ca";
-		$sqld .= " WHERE year = ".$year." AND fk_societe = ".$key;
-
-		$resqld = $db->query($sqld);
-		if (! $resqld)
-		{
-			dol_print_error($db);
-			return -1;
-		}
-
-		$sqli = "INSERT INTO ".MAIN_DB_PREFIX."fournisseur_ca";
-		$sqli .= " VALUES (".$key.",".$db->idate(mktime()).",".$year.",'".price2num($value)."'";
-		$sqli.=  ",'". $fournisseurs_ca_achat[$key][$year] ."');";
-		$resqli = $db->query($sqli);
-		if (! $resqli)
-		{
-			dol_print_error($db);
-			return -1;
-		}
-	}
-
-	/*
-	 * Mets a jour la table produit
-	 */
-	foreach($ca_products as $key => $value)
-	{
-		$sqld = "DELETE FROM ".MAIN_DB_PREFIX."product_ca";
-		$sqld .= " WHERE year = ".$year." AND fk_product=".$key;
-		$resqld = $db->query($sqld);
-		if (! $resqld)
-		{
-			dol_print_error($db);
-			return -1;
-		}
-
-		$sqli = "INSERT INTO ".MAIN_DB_PREFIX."product_ca(fk_product, date_calcul, year, ca_genere)";
-		$sqli .= " VALUES (".$key.",".$db->idate(mktime()).",".$year.",'".price2num($value)."')";
-		$resqli = $db->query($sqli);
-		if (! $resqli)
-		{
-			dol_print_error($db);
-			return -1;
-		}
-	}
-
-	return 1;
-}
-
 ?>
diff --git a/htdocs/fourn/stats.php b/htdocs/fourn/stats.php
deleted file mode 100644
index 0ccb13399f4..00000000000
--- a/htdocs/fourn/stats.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2007 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copyright (C) 2005-2006 Regis Houssin        <regis@dolibarr.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 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
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * $Id$
- */
-
-/**
-        \file       htdocs/fourn/stats.php
-        \ingroup    fournisseur
-        \brief      Page stats fournisseurs
-        \version    $Revision$
-*/
-
-require("../main.inc.php");
-
-$langs->load("suppliers");
-$langs->load("orders");
-$langs->load("companies");
-
-$page = isset($_GET["page"])?$_GET["page"]:'';
-$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:'';
-$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:'';
-$socname = isset($_GET["socname"])?$_GET["socname"]:'';
-$search_nom = isset($_GET["search_nom"])?$_GET["search_nom"]:'';
-$search_ville = isset($_GET["search_ville"])?$_GET["search_ville"]:'';
-
-// Security check
-$socid = isset($_GET["socid"])?$_GET["socid"]:'';
-if ($user->societe_id) $socid=$user->societe_id;
-$result = restrictedArea($user, 'societe',$socid,'');
-
-if ($page == -1) { $page = 0 ; }
-
-$offset = $conf->liste_limit * $page ;
-if (! $sortorder) $sortorder="ASC";
-if (! $sortfield) $sortfield="year";
-
-$years=array();
-$fourns=array();
-
-
-/*
- * View
- */
-
-llxHeader();
-
-$sql = "SELECT s.rowid as socid, s.nom, s.ville, ca.ca_genere as ca, ca.year";
-$sql.= " , s.code_fournisseur, s.code_compta_fournisseur";
-if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
-$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."fournisseur_ca as ca";
-if ($_GET["cat"]) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cf";
-if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
-$sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur=1 AND s.rowid = ca.fk_societe";
-if ($_GET["cat"]) $sql .= " AND cf.fk_societe = s.rowid AND cf.fk_categorie = '".$_GET["cat"]."'";
-if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
-if ($socid) $sql .= " AND s.rowid = ".$socid;
-if ($socname) {
-  $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'";
-  $sortfield = "lower(s.nom)";
-  $sortorder = "ASC";
-}
-if ($search_nom)
-{
-  $sql .= " AND s.nom LIKE '%".$search_nom."%'";
-}
-if ($search_ville)
-{
-  $sql .= " AND s.ville LIKE '%".$search_ville."%'";
-}
-// TODO Add date ranges
-$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset);
-
-dol_syslog("fourn/stats.php sql=".$sql);
-$resql = $db->query($sql);
-if ($resql)
-{
-  $num = $db->num_rows($resql);
-  $i = 0;
-
-  while ($i < min($num,$conf->liste_limit))
-  {
-  	$obj = $db->fetch_object($resql);
-    $var=!$var;
-    $i++;
-
-    $fourns[$obj->socid] = $obj->nom;
-    $code_fourns[$obj->socid] = $obj->code_fournisseur;
-    $years[$obj->year] = $obj->year;
-    $ca[$obj->socid][$obj->year] = $obj->ca;
-  }
-
-}
-else
-{
-  dol_print_error($db);
-}
-
-
-print_barre_liste($langs->trans("SuppliersProductsSellSalesTurnover"), $page, "stats.php", "", $sortfield, $sortorder, '', $num);
-
-print '<form action="stats.php" method="GET">';
-print '<table class="liste" width="100%">';
-print '<tr class="liste_titre">';
-print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","",'valign="middle"',$sortfield,$sortorder);
-print_liste_field_titre($langs->trans("Town"),$_SERVER["PHP_SELF"],"s.ville","","",'valign="middle"',$sortfield,$sortorder);
-print_liste_field_titre($langs->trans("SupplierCode"),$_SERVER["PHP_SELF"],"s.code_fournisseur","","",'valign="middle"',$sortfield,$sortorder);
-
-foreach($years as $year)
-{
-  print  '<td align="right" class="liste_titre">'.$langs->trans("CA") .' '.$year.'</td>';
-}
-print '<td align="right" class="liste_titre">&nbsp;</td>';
-print "</tr>\n";
-
-print '<tr class="liste_titre">';
-
-print '<td class="liste_titre"><input type="text" class="flat" name="search_nom" value="'.$search_nom.'"></td>';
-print '<td class="liste_titre"><input type="text" class="flat" name="search_ville" value="'.$search_ville.'"></td>';
-
-foreach($years as $year)
-{
-  print '<td align="left" class="liste_titre">&nbsp;';
-  print '</td>';
-}
-
-print '<td class="liste_titre" colspan="2" align="right"><input class="liste_titre" type="image" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'"></td>';
-
-print '</tr>';
-$var=True;
-
-foreach($fourns as $fid => $fnom)
-{
-  $var=!$var;
-
-  print "<tr $bc[$var]>";
-  print '<td><a href="fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").'</a>';
-  print "&nbsp;<a href=\"fiche.php?socid=".$fid."\">".$fnom."</a></td>\n";
-  print "<td>".$obj->ville."</td>\n";
-  print '<td>'.$code_fourns[$fid].'&nbsp;</td>';
-
-  foreach($years as $year)
-  {
-  	print '<td align="right">'.price($ca[$fid][$year]).'&nbsp;</td>';
-  }
-  print '<td align="right">&nbsp;</td>';
-  print "</tr>\n";
-}
-
-print "</table>\n";
-print "</form>\n";
-$db->free($resql);
-
-
-
-
-
-
-
-
-
-
-
-$db->close();
-
-llxFooter('$Date$ - $Revision$');
-?>
diff --git a/htdocs/includes/menus/barre_left/eldy.lib.php b/htdocs/includes/menus/barre_left/eldy.lib.php
index 359cd7de6e1..2bb406fb0c2 100644
--- a/htdocs/includes/menus/barre_left/eldy.lib.php
+++ b/htdocs/includes/menus/barre_left/eldy.lib.php
@@ -174,22 +174,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
 				}
 			}
 
-			// Fournisseurs
-			$langs->load("suppliers");
-
-			if ($conf->societe->enabled && $conf->fournisseur->enabled)
-			{
-				$newmenu->add(DOL_URL_ROOT."/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
-
-				if ($user->societe_id == 0)
-				{
-					$newmenu->add(DOL_URL_ROOT."/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
-				}
-				//$newmenu->add(DOL_URL_ROOT."/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
-				//$newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
-				$newmenu->add(DOL_URL_ROOT."/fourn/stats.php",$langs->trans("Statistics"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
-			}
-
 			// Prospects
 			if ($conf->societe->enabled)
 			{
@@ -210,6 +194,20 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
 				//$newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=customers&amp;type=c", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);
 			}
 
+            // Fournisseurs
+            if ($conf->societe->enabled && $conf->fournisseur->enabled)
+            {
+                $langs->load("suppliers");
+                $newmenu->add(DOL_URL_ROOT."/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
+
+                if ($user->societe_id == 0)
+                {
+                    $newmenu->add(DOL_URL_ROOT."/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
+                }
+                //$newmenu->add(DOL_URL_ROOT."/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
+                //$newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
+            }
+
 			// Contacts
 			$newmenu->add(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts", $langs->trans("Contacts"), 0, $user->rights->societe->contact->lire);
 			$newmenu->add(DOL_URL_ROOT."/contact/fiche.php?leftmenu=contacts&amp;action=create", $langs->trans("NewContact"), 1, $user->rights->societe->contact->creer);
@@ -224,21 +222,21 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after)
 			if ($conf->categorie->enabled)
 			{
 				$langs->load("categories");
-				// Categories suppliers
-				if ($conf->fournisseur->enabled)
-				{
-					$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire);
-					if ($user->societe_id == 0)
-					{
-						$newmenu->add(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
-					}
-				}
 				// Categories prospects/customers
 				$newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire);
 				if ($user->societe_id == 0)
 				{
 					$newmenu->add(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
 				}
+                // Categories suppliers
+                if ($conf->fournisseur->enabled)
+                {
+                    $newmenu->add(DOL_URL_ROOT."/categories/index.php?leftmenu=cat&amp;type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire);
+                    if ($user->societe_id == 0)
+                    {
+                        $newmenu->add(DOL_URL_ROOT."/categories/fiche.php?action=create&amp;type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer);
+                    }
+                }
 				//if ($leftmenu=="cat") $newmenu->add(DOL_URL_ROOT."/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire);
 			}
 
diff --git a/htdocs/includes/menus/init_menu_auguria.sql b/htdocs/includes/menus/init_menu_auguria.sql
index 325005faad8..5e1dac807c3 100644
--- a/htdocs/includes/menus/init_menu_auguria.sql
+++ b/htdocs/includes/menus/init_menu_auguria.sql
@@ -61,26 +61,28 @@ insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu=="users"', __HANDLER__, 'left', 402__+MAX_llx_menu__, 'home', '', 401__+MAX_llx_menu__, '/user/fiche.php?leftmenu=users&action=create', 'NewUser', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu=="users"', __HANDLER__, 'left', 403__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/group/index.php?leftmenu=users', 'Groups', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 1, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$leftmenu=="users"', __HANDLER__, 'left', 404__+MAX_llx_menu__, 'home', '', 403__+MAX_llx_menu__, '/user/group/fiche.php?leftmenu=users&action=create', 'NewGroup', 2, 'users', '$user->rights->user->user->creer || $user->admin', '', 2, 0, __ENTITY__);
-
+-- Third parties
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', '', 2__+MAX_llx_menu__, '/societe/societe.php', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/liste.php?leftmenu=suppliers', 'Suppliers', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/liste.php?leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&action=create&type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 505__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/contact/index.php?leftmenu=suppliers&type=f', 'Contacts', 2, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 1, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/prospects.php?leftmenu=prospects', 'Prospects', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/prospects.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&action=create&type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 508__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/contact/index.php?leftmenu=customers&type=p', 'Contacts', 2, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/clients.php?leftmenu=customers', 'Customers', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 509__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/clients.php?leftmenu=customers', 'ListCustomersShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 4, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 510__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/societe/soc.php?leftmenu=customers&action=create&type=c', 'MenuNewCustomer', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 511__+MAX_llx_menu__, 'companies', '', 509__+MAX_llx_menu__, '/contact/index.php?leftmenu=customers&type=c', 'Contacts', 2, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
+-- Third parties - Contacts
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 600__+MAX_llx_menu__, 'companies', '', 2__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts', 'Contacts', 0, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 601__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/fiche.php?leftmenu=contacts&action=create', 'NewContact', 1, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 602__+MAX_llx_menu__, 'companies', '', 600__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 1, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 604__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts&type=p', 'Prospects', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 1, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 605__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts&type=c', 'Customers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 2, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 606__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts&type=f', 'Suppliers', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled', __HANDLER__, 'left', 607__+MAX_llx_menu__, 'companies', '', 602__+MAX_llx_menu__, '/contact/index.php?leftmenu=contacts&type=o', 'Others', 2, 'companies', '$user->rights->societe->contact->lire', '', 2, 4, __ENTITY__);
 -- Third parties - Category customer
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 650__+MAX_llx_menu__, 'companies', '', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=1', 'SuppliersCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->societe->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 651__+MAX_llx_menu__, 'companies', '', 650__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=1', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
 -- Third parties - Category supplier
-insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', '', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 3, __ENTITY__);
+insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 660__+MAX_llx_menu__, 'companies', '', 2__+MAX_llx_menu__, '/categories/index.php?leftmenu=cat&type=2', 'CustomersProspectsCategoriesShort', 0, 'categories', '$user->rights->categorie->lire', '', 2, 4, __ENTITY__);
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->fournisseur->enabled && $conf->categorie->enabled', __HANDLER__, 'left', 661__+MAX_llx_menu__, 'companies', '', 660__+MAX_llx_menu__, '/categories/fiche.php?action=create&type=2', 'NewCategory', 1, 'categories', '$user->rights->categorie->creer', '', 2, 0, __ENTITY__);
 -- Product
 insert into llx_menu (enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('$conf->product->enabled', __HANDLER__, 'left', 2800__+MAX_llx_menu__, 'products', '', 3__+MAX_llx_menu__, '/product/index.php?leftmenu=product&type=0', 'Products', 0, 'products', '$user->rights->produit->lire', '', 2, 0, __ENTITY__);
diff --git a/htdocs/install/mysql/tables/llx_fournisseur_ca.sql b/htdocs/install/mysql/tables/llx_fournisseur_ca.sql
deleted file mode 100644
index 47d937ec012..00000000000
--- a/htdocs/install/mysql/tables/llx_fournisseur_ca.sql
+++ /dev/null
@@ -1,29 +0,0 @@
--- ============================================================================
--- Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
---
--- This program is free software; you can redistribute it and/or modify
--- it under the terms of the GNU General Public License as published by
--- the Free Software Foundation; either version 2 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
--- GNU General Public License for more details.
---
--- You should have received a copy of the GNU General Public License
--- along with this program; if not, write to the Free Software
--- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
---
--- $Id$
--- ============================================================================
-
-create table llx_fournisseur_ca
-(
-  fk_societe    integer,
-  date_calcul   datetime,
-  year          smallint UNSIGNED,
-  ca_genere     float,                  -- ca genere par les ventes des produits de ce fournisseur
-  ca_achat      float(11,2) DEFAULT 0,  -- ca effectue aupres de ce fournisseur (somme de ses factures)
-  UNIQUE (fk_societe, year)
-)type=innodb;
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 544b9b1600c..392f3210924 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -939,7 +939,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
 	$html=new Form($db);
 
 	if (! $conf->top_menu)  $conf->top_menu ='eldy_backoffice.php';
-	//if (! $conf->left_menu) $conf->left_menu='eldy_backoffice.php';
 
 
 	// For backward compatibility with old modules
@@ -954,9 +953,6 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
     $top_menu=$conf->top_menu;
     if (GETPOST('top_menu')) $top_menu=GETPOST('top_menu');
 
-    print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
-	print '<div class="tmenu">'."\n";
-
 	// Load the top menu manager
 	$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_top/".$top_menu);
 	if (! $result)	// If failed to include, we try with standard
@@ -964,10 +960,13 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
 		$top_menu='eldy_backoffice.php';
 		include_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_top/".$top_menu);
 	}
-	$menutop = new MenuTop($db);
-	$menutop->atarget=$target;
 
-	// Affiche le menu
+    print "\n".'<!-- Start top horizontal menu '.$top_menu.' -->'."\n";
+    print '<div class="tmenu">'."\n";
+
+    // Show menu
+    $menutop = new MenuTop($db);
+	$menutop->atarget=$target;
 	$menutop->showmenu();
 
 	// Link to login card
@@ -1107,10 +1106,6 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
     $left_menu=$conf->top_menu;
     if (GETPOST('left_menu')) $left_menu=GETPOST('left_menu');
 
-    // Left column
-	print '<!-- Begin left vertical menu '.$left_menu.' -->'."\n";
-	print '<div class="vmenu">'."\n";
-
     // Load the left menu manager
 	$result=@include_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_left/".$left_menu);
 	if (! $result)
@@ -1118,6 +1113,11 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
 		$left_menu='eldy_backoffice.php';
 		include_once(DOL_DOCUMENT_ROOT ."/includes/menus/barre_left/".$left_menu);
 	}
+
+    // Left column
+    print '<!-- Begin left vertical menu '.$left_menu.' -->'."\n";
+    print '<div class="vmenu">'."\n";
+
 	$menuleft=new MenuLeft($db,$menu_array_before,$menu_array_after);
 	$menuleft->showmenu(); // output menu_array and menu found in database
 
diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php
index bbafc3cff76..5c19360762a 100644
--- a/htdocs/user/param_ihm.php
+++ b/htdocs/user/param_ihm.php
@@ -93,7 +93,6 @@ if ($_POST["action"] == 'update' && ($caneditfield  || $user->admin))
         else $tabparam["MAIN_LANG_DEFAULT"]='';
 
         $tabparam["MAIN_MENU_BARRETOP"]=$_POST["main_menu_barretop"];
-        //$tabparam["MAIN_MENU_BARRELEFT"]=$_POST["main_menu_barreleft"];
 
         if ($_POST["check_SIZE_LISTE_LIMIT"]=="on") $tabparam["MAIN_SIZE_LISTE_LIMIT"]=$_POST["main_size_liste_limit"];
         else $tabparam["MAIN_SIZE_LISTE_LIMIT"]='';
-- 
GitLab