From de2ddc02e4815c30f22a296ffe2b618fa3cec90c Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 15 Apr 2013 13:11:29 +0200
Subject: [PATCH] Qual: Another clean of menu management system. Removed all
 files pre.inc.php

---
 htdocs/compta/bank/account.php              |  7 +-
 htdocs/compta/bank/annuel.php               |  5 +-
 htdocs/compta/bank/bankid_fr.php            |  8 +-
 htdocs/compta/bank/bilan.php                |  6 +-
 htdocs/compta/bank/budget.php               |  8 +-
 htdocs/compta/bank/categ.php                |  6 +-
 htdocs/compta/bank/fiche.php                |  8 +-
 htdocs/compta/bank/graph.php                |  7 +-
 htdocs/compta/bank/index.php                |  9 +-
 htdocs/compta/bank/info.php                 |  8 +-
 htdocs/compta/bank/ligne.php                |  4 +-
 htdocs/compta/bank/pre.inc.php              | 92 ---------------------
 htdocs/compta/bank/rappro.php               |  8 +-
 htdocs/compta/bank/releve.php               | 11 +--
 htdocs/compta/bank/search.php               | 13 +--
 htdocs/compta/bank/treso.php                |  8 +-
 htdocs/compta/bank/virement.php             | 11 ++-
 htdocs/compta/paiement/cheque/fiche.php     |  7 +-
 htdocs/compta/paiement/cheque/index.php     |  7 +-
 htdocs/compta/paiement/cheque/liste.php     |  6 +-
 htdocs/compta/paiement/cheque/pre.inc.php   | 92 ---------------------
 htdocs/compta/prelevement/bon.php           |  7 +-
 htdocs/compta/prelevement/bons.php          |  8 +-
 htdocs/compta/prelevement/create.php        |  8 +-
 htdocs/compta/prelevement/demandes.php      |  8 +-
 htdocs/compta/prelevement/factures.php      |  8 +-
 htdocs/compta/prelevement/fiche-rejet.php   |  8 +-
 htdocs/compta/prelevement/fiche-stat.php    | 10 ++-
 htdocs/compta/prelevement/fiche.php         |  7 +-
 htdocs/compta/prelevement/index.php         |  8 +-
 htdocs/compta/prelevement/ligne.php         |  7 +-
 htdocs/compta/prelevement/lignes.php        |  7 +-
 htdocs/compta/prelevement/liste.php         |  6 +-
 htdocs/compta/prelevement/rejets.php        |  8 +-
 htdocs/compta/prelevement/stats.php         |  8 +-
 htdocs/core/menus/standard/auguria.lib.php  | 57 ++++++++++++-
 htdocs/core/menus/standard/auguria_menu.php |  4 +-
 htdocs/core/menus/standard/eldy.lib.php     | 55 +++++++++++-
 htdocs/core/menus/standard/eldy_menu.php    |  4 +-
 htdocs/core/modules/modMargin.class.php     |  2 +-
 htdocs/ftp/index.php                        |  2 +-
 htdocs/ftp/pre.inc.php                      | 72 ----------------
 test/phpunit/phpunittest.xml                |  4 -
 43 files changed, 275 insertions(+), 364 deletions(-)
 delete mode 100644 htdocs/compta/bank/pre.inc.php
 delete mode 100644 htdocs/compta/paiement/cheque/pre.inc.php
 delete mode 100644 htdocs/ftp/pre.inc.php

diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 45678f54fb4..7830abef655 100644
--- a/htdocs/compta/bank/account.php
+++ b/htdocs/compta/bank/account.php
@@ -27,7 +27,7 @@
  *		\brief      List of details of bank transactions for an account
  */
 
-require 'pre.inc.php';	// We use pre.inc.php to have a dynamic menu
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -35,7 +35,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
 require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 
 $id = (GETPOST('id','int') ? GETPOST('id','int') : GETPOST('account','int'));
diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php
index 64e51824338..ada636adb33 100644
--- a/htdocs/compta/bank/annuel.php
+++ b/htdocs/compta/bank/annuel.php
@@ -23,9 +23,12 @@
  *		\brief       Page reporting mensuel Entrees/Sorties d'un compte bancaire
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 $id=GETPOST('account');
 $ref=GETPOST('ref');
diff --git a/htdocs/compta/bank/bankid_fr.php b/htdocs/compta/bank/bankid_fr.php
index 31d929dfed5..402dbeda095 100644
--- a/htdocs/compta/bank/bankid_fr.php
+++ b/htdocs/compta/bank/bankid_fr.php
@@ -24,11 +24,13 @@
  *  \brief      Fiche creation compte bancaire
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 
 $action=GETPOST('action');
diff --git a/htdocs/compta/bank/bilan.php b/htdocs/compta/bank/bilan.php
index 7ee5d069e11..2224627cd94 100644
--- a/htdocs/compta/bank/bilan.php
+++ b/htdocs/compta/bank/bilan.php
@@ -22,7 +22,11 @@
  *		\brief      Page de bilan
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 if (!$user->rights->banque->lire)
   accessforbidden();
diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php
index d513c65fb30..e14b3e92df6 100644
--- a/htdocs/compta/bank/budget.php
+++ b/htdocs/compta/bank/budget.php
@@ -23,9 +23,11 @@
  *		\brief      Page de budget
  */
 
-require 'pre.inc.php';
-
-$langs->load("categories");
+require('../../main.inc.php');
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id) $socid=$user->societe_id;
diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php
index 423abdf9fb9..9fcd579bc15 100644
--- a/htdocs/compta/bank/categ.php
+++ b/htdocs/compta/bank/categ.php
@@ -23,7 +23,11 @@
  *      \brief      Page ajout de categories bancaires
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 if (!$user->rights->banque->configurer)
   accessforbidden();
diff --git a/htdocs/compta/bank/fiche.php b/htdocs/compta/bank/fiche.php
index b811e35f7d7..e7d6fbbce9f 100644
--- a/htdocs/compta/bank/fiche.php
+++ b/htdocs/compta/bank/fiche.php
@@ -24,13 +24,15 @@
  *		\brief      Page to create/view a bank account
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("companies");
 
 $action=GETPOST("action");
diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php
index fb4e2a09a86..932acf5dcb5 100644
--- a/htdocs/compta/bank/graph.php
+++ b/htdocs/compta/bank/graph.php
@@ -23,12 +23,13 @@
  *	\brief      Page graph des transactions bancaires
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
-
-$langs->load("banks");
+
+$langs->load("banks");
+$langs->load("categories");
 
 $WIDTH=DolGraph::getDefaultGraphSizeForStats('width',768);
 $HEIGHT=DolGraph::getDefaultGraphSizeForStats('height',200);
diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php
index 54f89cd95e6..8948037e486 100644
--- a/htdocs/compta/bank/index.php
+++ b/htdocs/compta/bank/index.php
@@ -23,13 +23,14 @@
  *       \brief      Home page of bank module
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
-
-$langs->load("banks");
-$langs->load("categories");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id) $socid=$user->societe_id;
diff --git a/htdocs/compta/bank/info.php b/htdocs/compta/bank/info.php
index 2a94840e3b7..a4a871cec93 100644
--- a/htdocs/compta/bank/info.php
+++ b/htdocs/compta/bank/info.php
@@ -21,11 +21,13 @@
  *     \brief      Onglet info d'une ecriture bancaire
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("companies");
 
 
diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php
index 58675900a8c..dcad7cd4f22 100644
--- a/htdocs/compta/bank/ligne.php
+++ b/htdocs/compta/bank/ligne.php
@@ -25,13 +25,13 @@
  *	\brief      Page to edit a bank transaction record
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
 
 $langs->load("banks");
+$langs->load("categories");
 $langs->load("compta");
 $langs->load("bills");
-$langs->load("categories");
 if (! empty($conf->adherent->enabled)) $langs->load("members");
 
 
diff --git a/htdocs/compta/bank/pre.inc.php b/htdocs/compta/bank/pre.inc.php
deleted file mode 100644
index a507c4c0a71..00000000000
--- a/htdocs/compta/bank/pre.inc.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2003      Jean-Louis Bergamo   <jlb@j1b.org>
- * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copytight (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
- *
- * 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 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
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- *		\file   	htdocs/compta/bank/pre.inc.php
- *		\ingroup    compta
- *		\brief  	Fichier gestionnaire du menu compta banque
- */
-
-require_once realpath(dirname(__FILE__)) . '/../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
-$langs->load("banks");
-$langs->load("categories");
-
-
-/**
- * Replace the default llxHeader function
- *
- * @param 	string 	$head		Optionnal head lines
- * @param 	string 	$title		HTML title
- * @param 	string 	$help_url	Link to online url help to show on left menu
- * @param 	string 	$target		Force target on menu links
- * @param 	int    	$disablejs	More content into html header
- * @param 	int    	$disablehead	More content into html header
- * @param 	array  	$arrayofjs	Array of complementary js files
- * @param 	array  	$arrayofcss	Array of complementary css files
- * @return	none
- */
-function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
-{
-	global $db, $user, $conf, $langs;
-
-	top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-	top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-
-	require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
-	$menu = new Menu();
-
-	// Entry for each bank account
-	if ($user->rights->banque->lire)
-	{
-		$sql = "SELECT rowid, label, courant, rappro, courant";
-		$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
-		$sql.= " WHERE entity = ".$conf->entity;
-		$sql.= " AND clos = 0";
-        $sql.= " ORDER BY label";
-
-		$resql = $db->query($sql);
-		if ($resql)
-		{
-			$numr = $db->num_rows($resql);
-			$i = 0;
-
-			if ($numr > 0) 	$menu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
-
-			while ($i < $numr)
-			{
-				$objp = $db->fetch_object($resql);
-				$menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
-                if ($objp->rappro && $objp->courant != 2 && empty($objp->clos))  // If not cash account and not closed and can be reconciliate
-                {
-				    $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
-                }
-				$i++;
-			}
-		}
-		else dol_print_error($db);
-		$db->free($resql);
-	}
-
-	left_menu('', $help_url, '', $menu->liste, 1);
-    main_area();
-}
-?>
diff --git a/htdocs/compta/bank/rappro.php b/htdocs/compta/bank/rappro.php
index 4e8b717201c..e38ce88633a 100644
--- a/htdocs/compta/bank/rappro.php
+++ b/htdocs/compta/bank/rappro.php
@@ -23,7 +23,7 @@
  *       \brief      Page to reconciliate bank transactions
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@@ -31,8 +31,10 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
 require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 
 if (! $user->rights->banque->consolidate) accessforbidden();
diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php
index f3603da2d6d..adbed8ea740 100644
--- a/htdocs/compta/bank/releve.php
+++ b/htdocs/compta/bank/releve.php
@@ -23,15 +23,16 @@
  *		\brief      Page d'affichage d'un releve
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
-
-$action=GETPOST('action', 'alpha');
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("companies");
-$langs->load("banks");
 $langs->load("bills");
 
+$action=GETPOST('action', 'alpha');
 $id=GETPOST('account');
 $ref=GETPOST('ref');
 $dvid=GETPOST('dvid');
diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php
index f7cbf8f8629..9117a099fb5 100644
--- a/htdocs/compta/bank/search.php
+++ b/htdocs/compta/bank/search.php
@@ -24,11 +24,14 @@
  *	\brief      List of bank transactions
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id) $socid=$user->societe_id;
@@ -134,9 +137,9 @@ if ($resql)
 
 	// Title
 	$bankcateg=new BankCateg($db);
-	if (! empty($_REQUEST["bid"]))
+	if (GETPOST("bid"))
 	{
-		$result=$bankcateg->fetch($_REQUEST["bid"]);
+		$result=$bankcateg->fetch(GETPOST("bid"));
 		print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->nom:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num);
 	}
 	else
diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php
index eb39379ace0..91f05a2fdaa 100644
--- a/htdocs/compta/bank/treso.php
+++ b/htdocs/compta/bank/treso.php
@@ -23,14 +23,16 @@
  *	\brief      Page de detail du budget de tresorerie
  */
 
-require 'pre.inc.php';
+require '../../main.inc.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 
 // Security check
diff --git a/htdocs/compta/bank/virement.php b/htdocs/compta/bank/virement.php
index 2908039a26d..f770c5bc371 100644
--- a/htdocs/compta/bank/virement.php
+++ b/htdocs/compta/bank/virement.php
@@ -24,10 +24,12 @@
  *		\brief      Page de saisie d'un virement
  */
 
-require 'pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
-
-$langs->load("banks");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 if (! $user->rights->banque->transfer)
   accessforbidden();
@@ -36,8 +38,9 @@ $action = GETPOST('action','alpha');
 
 
 /*
- * Action ajout d'un virement
+ * Actions
  */
+
 if ($action == 'add')
 {
 	$langs->load("errors");
diff --git a/htdocs/compta/paiement/cheque/fiche.php b/htdocs/compta/paiement/cheque/fiche.php
index 6347a847e36..8a24ab3ce29 100644
--- a/htdocs/compta/paiement/cheque/fiche.php
+++ b/htdocs/compta/paiement/cheque/fiche.php
@@ -24,14 +24,15 @@
  *	\brief      Page for cheque deposits
  */
 
-require 'pre.inc.php';	// We use pre.inc.php to have a dynamic menu
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load('bills');
-$langs->load('banks');
 $langs->load('companies');
 $langs->load('compta');
 
diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php
index b3ccf19ae19..cfde42a5cf3 100644
--- a/htdocs/compta/paiement/cheque/index.php
+++ b/htdocs/compta/paiement/cheque/index.php
@@ -23,11 +23,12 @@
  *		\brief      Home page for cheque receipts
  */
 
-require 'pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
-$langs->load("banks");
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id) $socid=$user->societe_id;
diff --git a/htdocs/compta/paiement/cheque/liste.php b/htdocs/compta/paiement/cheque/liste.php
index 3f4b1d12cbd..8370bd95551 100644
--- a/htdocs/compta/paiement/cheque/liste.php
+++ b/htdocs/compta/paiement/cheque/liste.php
@@ -23,10 +23,12 @@
  *   \brief      Page liste des bordereau de remise de cheque
  */
 
-require 'pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 
 // Security check
diff --git a/htdocs/compta/paiement/cheque/pre.inc.php b/htdocs/compta/paiement/cheque/pre.inc.php
deleted file mode 100644
index bc730c9740d..00000000000
--- a/htdocs/compta/paiement/cheque/pre.inc.php
+++ /dev/null
@@ -1,92 +0,0 @@
-<?php
-/* Copyright (C) 2006      Rodolphe Quiedeville <rodolphe@quiedeville.org>
- * Copyright (C) 2004-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
- * Copytight (C) 2005-2009 Regis Houssin        <regis.houssin@capnetworks.com>
- *
- * 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 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
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- *		\file   	htdocs/compta/paiement/cheque/pre.inc.php
- *		\ingroup    compta
- *		\brief  	Fichier gestionnaire du menu cheques
- */
-
-require_once realpath(dirname(__FILE__)) . '/../../../main.inc.php';
-require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
-
-$langs->load("banks");
-$langs->load("categories");
-
-
-/**
- * Replace the default llxHeader function
- *
- * @param 	string 	$head		Optionnal head lines
- * @param 	string 	$title		HTML title
- * @param 	string 	$help_url	Link to online url help to show on left menu
- * @param 	string 	$target		Force target on menu links
- * @param 	int    	$disablejs	More content into html header
- * @param 	int    	$disablehead	More content into html header
- * @param 	array  	$arrayofjs	Array of complementary js files
- * @param 	array  	$arrayofcss	Array of complementary css files
- * @return	none
- */
-function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
-{
-	global $db, $user, $conf, $langs;
-
-	top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-	top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-
-	require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
-	$menu = new Menu();
-
-	// Entry for each bank account
-	if ($user->rights->banque->lire)
-	{
-		$sql = "SELECT rowid, label, courant, rappro, courant";
-		$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
-		$sql.= " WHERE entity = ".$conf->entity;
-		$sql.= " AND clos = 0";
-        $sql.= " ORDER BY label";
-
-		$resql = $db->query($sql);
-		if ($resql)
-		{
-			$numr = $db->num_rows($resql);
-			$i = 0;
-
-			if ($numr > 0) 	$menu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
-
-			while ($i < $numr)
-			{
-				$objp = $db->fetch_object($resql);
-				$menu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
-                if ($objp->rappro && $objp->courant != 2)  // If not cash account and can be reconciliate
-                {
-				    $menu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
-                }
-				$i++;
-			}
-		}
-		else dol_print_error($db);
-		$db->free($resql);
-	}
-
-	left_menu('', $help_url, '', $menu->liste, 1);
-    main_area();
-}
-
-?>
diff --git a/htdocs/compta/prelevement/bon.php b/htdocs/compta/prelevement/bon.php
index 792fd012fdf..6448a5b3df5 100644
--- a/htdocs/compta/prelevement/bon.php
+++ b/htdocs/compta/prelevement/bon.php
@@ -23,11 +23,14 @@
  *      \brief      Fiche apercu du bon de prelevement
  */
 
-require '../bank/pre.inc.php';
+require('../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("bills");
 $langs->load("categories");
 
diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php
index bc69163e000..218d8fb9523 100644
--- a/htdocs/compta/prelevement/bons.php
+++ b/htdocs/compta/prelevement/bons.php
@@ -24,11 +24,13 @@
  * 	\brief      Page liste des bons de prelevements
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("widthdrawals");
-$langs->load("categories");
 
 // Security check
 $socid = GETPOST('socid','int');
diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php
index 054a73db062..5be91cb8044 100644
--- a/htdocs/compta/prelevement/create.php
+++ b/htdocs/compta/prelevement/create.php
@@ -24,16 +24,18 @@
  *	\brief      Prelevement creation page
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("widthdrawals");
 $langs->load("companies");
-$langs->load("banks");
 $langs->load("bills");
 
 // Security check
diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php
index 3d685d18e94..4d83076c600 100644
--- a/htdocs/compta/prelevement/demandes.php
+++ b/htdocs/compta/prelevement/demandes.php
@@ -24,14 +24,16 @@
  *  \brief      Page to list withdraw requests
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/modules/modPrelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("widthdrawals");
 $langs->load("companies");
-$langs->load("categories");
 
 // Security check
 $socid = GETPOST('socid','int');
diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php
index 0ec6018f9eb..5271dbd03b4 100644
--- a/htdocs/compta/prelevement/factures.php
+++ b/htdocs/compta/prelevement/factures.php
@@ -24,14 +24,16 @@
  *     \brief      Page liste des factures prelevees
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("companies");
-$langs->load("categories");
 $langs->load('withdrawals');
 
 // Securite acces client
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index c88df2483a3..3cc372094a3 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -24,13 +24,15 @@
  *		\brief      Withdraw reject
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
-
-$langs->load("categories");
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load('withdrawals');
 
 // Securite acces client
diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php
index 28cf71231b5..20e9c09145f 100644
--- a/htdocs/compta/prelevement/fiche-stat.php
+++ b/htdocs/compta/prelevement/fiche-stat.php
@@ -23,17 +23,19 @@
  *	\brief      Prelevement statistics
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
+$langs->load("withdrawals");
 
 // Security check
 if ($user->societe_id > 0) accessforbidden();
 
-$langs->load("withdrawals");
-$langs->load("categories");
-
 // Get supervariables
 $prev_id = GETPOST('id','int');
 $page = GETPOST('page','int');
diff --git a/htdocs/compta/prelevement/fiche.php b/htdocs/compta/prelevement/fiche.php
index 895d5b35080..283f0c24183 100644
--- a/htdocs/compta/prelevement/fiche.php
+++ b/htdocs/compta/prelevement/fiche.php
@@ -23,16 +23,19 @@
  *	\brief      Fiche prelevement
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 if (!$user->rights->prelevement->bons->lire)
 accessforbidden();
 
 $langs->load("bills");
 $langs->load("withdrawals");
-$langs->load("categories");
 
 
 // Security check
diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php
index f685922e167..c1d0a0aaa3f 100644
--- a/htdocs/compta/prelevement/index.php
+++ b/htdocs/compta/prelevement/index.php
@@ -24,14 +24,16 @@
  *	\brief      Prelevement index page
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
 require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("withdrawals");
-$langs->load("categories");
 
 // Security check
 $socid = GETPOST('socid','int');
diff --git a/htdocs/compta/prelevement/ligne.php b/htdocs/compta/prelevement/ligne.php
index d2c8c71e62a..5f7e17fb679 100644
--- a/htdocs/compta/prelevement/ligne.php
+++ b/htdocs/compta/prelevement/ligne.php
@@ -24,18 +24,21 @@
  *	\brief      card of withdraw line
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id > 0) accessforbidden();
 
 $langs->load("bills");
 $langs->load("withdrawals");
-$langs->load("categories");
 
 // Get supervariables
 $action = GETPOST('action','alpha');
diff --git a/htdocs/compta/prelevement/lignes.php b/htdocs/compta/prelevement/lignes.php
index 0f87e78213d..298effa2b15 100644
--- a/htdocs/compta/prelevement/lignes.php
+++ b/htdocs/compta/prelevement/lignes.php
@@ -24,17 +24,20 @@
  *	\brief      Prelevement lines
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/lib/prelevement.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 
 // Security check
 if ($user->societe_id > 0) accessforbidden();
 
-$langs->load("categories");
 $langs->load('withdrawals');
 
 // Get supervariables
diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php
index 3d49c050268..1410b177ff2 100644
--- a/htdocs/compta/prelevement/liste.php
+++ b/htdocs/compta/prelevement/liste.php
@@ -23,10 +23,12 @@
  *      \ingroup    prelevement
  *      \brief      Page liste des prelevements
  */
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
 $langs->load("withdrawals");
 $langs->load("companies");
 $langs->load("categories");
diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php
index b22289b5f50..012c2364635 100644
--- a/htdocs/compta/prelevement/rejets.php
+++ b/htdocs/compta/prelevement/rejets.php
@@ -24,13 +24,15 @@
  *      \brief      Reject page
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/rejetprelevement.class.php';
 require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("withdrawals");
 $langs->load("companies");
-$langs->load("categories");
 
 // Security check
 $socid = GETPOST('socid','int');
diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php
index a2edee3061e..419fb7eb3e8 100644
--- a/htdocs/compta/prelevement/stats.php
+++ b/htdocs/compta/prelevement/stats.php
@@ -24,12 +24,14 @@
  *      \brief      Page de stats des prelevements
  */
 
-require '../bank/pre.inc.php';
+require('../../../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/ligneprelevement.class.php';
-
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+
+$langs->load("banks");
+$langs->load("categories");
 $langs->load("withdrawals");
 $langs->load("companies");
-$langs->load("categories");
 
 // Security check
 $socid = GETPOST('socid','int');
diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php
index 43c270c188d..316c4d5b607 100644
--- a/htdocs/core/menus/standard/auguria.lib.php
+++ b/htdocs/core/menus/standard/auguria.lib.php
@@ -234,13 +234,62 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
 		}
 	}
 
-	/**
-	 * We update newmenu with entries found into database
-	 * --------------------------------------------------
-	 */
+	// We update newmenu with entries found into database
 	$menuArbo = new Menubase($db,'auguria');
 	$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
 
+	// We update newmenu for special dynamic menus
+	if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank')	// Entry for each bank account
+	{
+		$sql = "SELECT rowid, label, courant, rappro, courant";
+		$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
+		$sql.= " WHERE entity = ".$conf->entity;
+		$sql.= " AND clos = 0";
+		$sql.= " ORDER BY label";
+	
+		$resql = $db->query($sql);
+		if ($resql)
+		{
+			$numr = $db->num_rows($resql);
+			$i = 0;
+	
+			if ($numr > 0) 	$newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
+	
+			while ($i < $numr)
+			{
+				$objp = $db->fetch_object($resql);
+				$newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
+				if ($objp->rappro && $objp->courant != 2 && empty($objp->clos))  // If not cash account and not closed and can be reconciliate
+				{
+					$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+				}
+				$i++;
+			}
+		}
+		else dol_print_error($db);
+		$db->free($resql);
+	}
+
+	if ($conf->ftp->enabled && $mainmenu == 'ftp')	// Entry for FTP
+	{
+		$MAXFTP=20;
+		$i=1;
+		while ($i <= $MAXFTP)
+		{
+			$paramkey='FTP_NAME_'.$i;
+			//print $paramkey;
+			if (! empty($conf->global->$paramkey))
+			{
+				$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
+		
+				$newmenu->add($link, dol_trunc($conf->global->$paramkey,24));
+			}
+			$i++;
+		}
+	}	
+
+	
+	// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
 	//var_dump($menu_array_before);exit;
 	//var_dump($menu_array_after);exit;
 	$menu_array=$newmenu->liste;
diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php
index 5fefb32d4a1..f4a2b097333 100644
--- a/htdocs/core/menus/standard/auguria_menu.php
+++ b/htdocs/core/menus/standard/auguria_menu.php
@@ -210,7 +210,7 @@ class MenuManager
         				|| strpos($canonrelurl,'/product/index.php') || strpos($canonrelurl,'/compta/bank/index.php'))
 					{
         				// We add sub entry
-        				print '<li data-role="list-divider"><a href="'.$relurl.'">'.$langs->trans(ucfirst($val['mainmenu'])."Dashboard").'</a></li>'."\n";
+        				print '<li data-role="list-divider" class="lilevel1"><a href="'.$relurl.'">'.$langs->trans(ucfirst($val['mainmenu'])."Dashboard").'</a></li>'."\n";
         			}
         			foreach($submenu->liste as $key2 => $val2)		// $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
         			{
@@ -220,7 +220,7 @@ class MenuManager
         				$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
         				//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
         				if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
-        				print '<li'.($val2['level']==0?' data-role="list-divider"':'').'>';
+        				print '<li'.($val2['level']==0?' data-role="list-divider"':'').' class="lilevel'.($val2['level']+1).'">';
         				if ($relurl2) print '<a href="'.$relurl2.'">';
         				print $val2['titre'];
         				if ($relurl2) print '</a>';
diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php
index cd99f7fe2a5..641925f42a9 100644
--- a/htdocs/core/menus/standard/eldy.lib.php
+++ b/htdocs/core/menus/standard/eldy.lib.php
@@ -1161,9 +1161,60 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
 		// Add personalized menus and modules menus
 		$menuArbo = new Menubase($db,'eldy');
 		$newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,(empty($user->societe_id)?0:1),'eldy',$tabMenu);
-	}
-
 
+		// We update newmenu for special dynamic menus
+		if ($user->rights->banque->lire && $mainmenu == 'bank')	// Entry for each bank account
+		{
+			$sql = "SELECT rowid, label, courant, rappro, courant";
+			$sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
+			$sql.= " WHERE entity = ".$conf->entity;
+			$sql.= " AND clos = 0";
+			$sql.= " ORDER BY label";
+		
+			$resql = $db->query($sql);
+			if ($resql)
+			{
+				$numr = $db->num_rows($resql);
+				$i = 0;
+		
+				if ($numr > 0) 	$newmenu->add('/compta/bank/index.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
+		
+				while ($i < $numr)
+				{
+					$objp = $db->fetch_object($resql);
+					$newmenu->add('/compta/bank/fiche.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
+					if ($objp->rappro && $objp->courant != 2 && empty($objp->clos))  // If not cash account and not closed and can be reconciliate
+					{
+						$newmenu->add('/compta/bank/rappro.php?account='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
+					}
+					$i++;
+				}
+			}
+			else dol_print_error($db);
+			$db->free($resql);
+		}
+		if ($conf->ftp->enabled && $mainmenu == 'ftp')	// Entry for FTP
+		{
+			$MAXFTP=20;
+			$i=1;
+			while ($i <= $MAXFTP)
+			{
+				$paramkey='FTP_NAME_'.$i;
+				//print $paramkey;
+				if (! empty($conf->global->$paramkey))
+				{
+					$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
+		
+					$newmenu->add($link, dol_trunc($conf->global->$paramkey,24));
+				}
+				$i++;
+			}
+		}		
+	
+	}
+	
+	
+	// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
 	//var_dump($menu_array_before);exit;
 	//var_dump($menu_array_after);exit;
 	$menu_array=$newmenu->liste;
diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php
index 4530dcd6f8f..1decdb22990 100644
--- a/htdocs/core/menus/standard/eldy_menu.php
+++ b/htdocs/core/menus/standard/eldy_menu.php
@@ -164,7 +164,7 @@ class MenuManager
         				|| strpos($canonrelurl,'/product/index.php') || strpos($canonrelurl,'/compta/bank/index.php'))
 					{
         				// We add sub entry
-        				print '<li data-role="list-divider"><a href="'.$relurl.'">'.$langs->trans(ucfirst($val['mainmenu'])."Dashboard").'</a></li>'."\n";
+        				print '<li data-role="list-divider" class="lilevel1><a href="'.$relurl.'">'.$langs->trans(ucfirst($val['mainmenu'])."Dashboard").'</a></li>'."\n";
         			}
        				foreach($submenu->liste as $key2 => $val2)		// $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
        				{
@@ -174,7 +174,7 @@ class MenuManager
         				$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
         				//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
         				if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
-        				print '<li'.($val2['level']==0?' data-role="list-divider"':'').'>';
+        				print '<li'.($val2['level']==0?' data-role="list-divider"':'').' class="lilevel'.($val2['level']+1).'">';
         				if ($relurl2) print '<a href="'.$relurl2.'">';
         				print $val2['titre'];
         				if ($relurl2) print '</a>';
diff --git a/htdocs/core/modules/modMargin.class.php b/htdocs/core/modules/modMargin.class.php
index 4baa4f51680..e6235572c1a 100644
--- a/htdocs/core/modules/modMargin.class.php
+++ b/htdocs/core/modules/modMargin.class.php
@@ -102,7 +102,7 @@ class modMargin extends DolibarrModules
     			'type'=>'left',			// This is a Top menu entry
     			'titre'=>'Margins',
     			'mainmenu'=>'accountancy',
-    			'leftmenu'=>'margins',		// Use 1 if you also want to add left menu entries using this descriptor. Use 0 if left menu entries are defined in a file pre.inc.php (old school).
+    			'leftmenu'=>'margins',
     			'url'=>'/margin/index.php',
     			'langs'=>'margins',	// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
     			'position'=>100,
diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php
index d376c96c7ff..63f98a2be14 100644
--- a/htdocs/ftp/index.php
+++ b/htdocs/ftp/index.php
@@ -23,7 +23,7 @@
  *	\author		Laurent Destailleur
  */
 
-require 'pre.inc.php';	// We use pre.inc.php to have a dynamic menu
+require('../main.inc.php');
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
 require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
diff --git a/htdocs/ftp/pre.inc.php b/htdocs/ftp/pre.inc.php
deleted file mode 100644
index 19a9d2547fb..00000000000
--- a/htdocs/ftp/pre.inc.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/* Copyright (C) 2008-2009 Laurent Destailleur  <eldy@users.sourceforge.net>
- *
- * 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 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
- * 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, see <http://www.gnu.org/licenses/>.
- */
-
-/**
- *		\file 		htdocs/ftp/pre.inc.php
- *		\ingroup    ftp
- *		\brief      File to manage left menu for FTP module
- */
-
-require (realpath(dirname(__FILE__)) . "/../main.inc.php");
-
-$user->getrights('ecm');
-
-/**
- * Replace the default llxHeader function
- *
- * @param 	string	$head			Optionnal head lines
- * @param 	string	$title			HTML title
- * @param 	string	$help_url		Link to online url help
- * @param 	string	$morehtml		More content into html header
- * @param 	string 	$target			Force target on menu links
- * @param 	int    	$disablejs		More content into html header
- * @param 	int    	$disablehead	More content into html header
- * @param 	array  	$arrayofjs		Array of complementary js files
- * @param 	array  	$arrayofcss		Array of complementary css files
- * @return	none
- */
-function llxHeader($head = '', $title='', $help_url='', $morehtml='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
-{
-	global $conf,$langs,$user;
-	$langs->load("ftp");
-
-	top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-	top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);	// Show html headers
-
-	require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
-	$menu = new Menu();
-
-	$MAXFTP=20;
-	$i=1;
-	while ($i <= $MAXFTP)
-	{
-		$paramkey='FTP_NAME_'.$i;
-		//print $paramkey;
-		if (! empty($conf->global->$paramkey))
-		{
-			$link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
-
-			$menu->add($link, dol_trunc($conf->global->$paramkey,24));
-		}
-		$i++;
-	}
-
-
-	left_menu($menu->liste, $help_url, $morehtml, '', 1);
-	main_area();
-}
-?>
diff --git a/test/phpunit/phpunittest.xml b/test/phpunit/phpunittest.xml
index b18471c06f2..424359786ae 100644
--- a/test/phpunit/phpunittest.xml
+++ b/test/phpunit/phpunittest.xml
@@ -47,10 +47,6 @@
 	    <directory suffix=".php">../../htdocs/societe/canvas/</directory>
 	    <directory suffix=".php">../../htdocs/includes/</directory>
 	    <file>../../htdocs/boutique/osc_master.inc.php</file>
-	    <file>../../htdocs/compta/bank/pre.inc.php</file>
-	    <file>../../htdocs/compta/paiement/cheque/pre.inc.php</file>
-	    <file>../../htdocs/holiday/common.inc.php</file>
-	    <file>../../htdocs/ftp/pre.inc.php</file>
 	    </exclude>
 	  </whitelist>
 	</filter>
-- 
GitLab