diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php
index 45678f54fb48673043da5c28e89b70f44d1648ba..7830abef6550be4c9358c0ac38d84ffbee63618f 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 64e518243386f3f4c3a4ca4c0d7aa7c89bb055ac..ada636adb330517ba37c9c45d99eb2db00b9df8c 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 31d929dfed537d391970935a632152a80ac676f6..402dbeda0957b3bf462c392c0530775b2a4f35c0 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 7ee5d069e11af5da53ff7108058379985a6a6113..2224627cd94191184bd64522600f2b6f1900cc8c 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 d513c65fb30312bdd1065b5eeb4ce79d7c821b56..e14b3e92df60315269a373be0266b6753d351808 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 423abdf9fb989166341824047cdc3729a7846d76..9fcd579bc159bcbbd52cf5d2e98e22fbc3913775 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 b811e35f7d7a8c8c46a0c5dd5db1df3b2f4e007c..e7d6fbbce9f8b95a297aed5605ef2c2a8e6b273d 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 fb4e2a09a868fbff456bce16cbae9d610c417fdb..932acf5dcb5d5bb737a9112e6ef7415e09a05950 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 54f89cd95e6f13d5772802c9c0080bfc69ca98ce..8948037e486ee40171c786bae029d874a4a24f8d 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 2a94840e3b73570d4508870c27225c8baeb1615e..a4a871cec93bd875608eb4594d8aaf30c94d7e3d 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 58675900a8cae1f5aa4da8c068819700b2f889ef..dcad7cd4f222479e7a073f2f5d643a34378b4fc3 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 a507c4c0a715093847b0c559ea2f817909887f0c..0000000000000000000000000000000000000000
--- 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 4e8b717201c29edbd59e1c0f5c06d4d8591bee6a..e38ce88633a1b4e057019f7b62e5c67c6b736ad2 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 f3603da2d6d2d0677a7616b72310b4f3b7efa80e..adbed8ea74041cb337fb53598409b9c7020b8810 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 f7cbf8f86293f1d6de47a37982fb5351619f2aa6..9117a099fb5c82c4c9373f7eab00570838a66224 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 eb39379ace0f9e0bb583120c17dc1c0ce4b7f267..91f05a2fdaa463d7a4919ab6fc1102d976f353e4 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 2908039a26d7c38aa85e0abfe045d673b7e05923..f770c5bc3712f93bdd3634564da6ddd0c8c07486 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 6347a847e36cf1c2ee038bcb0ffaa785302827c0..8a24ab3ce290c0740fd5a12bceaf18d6727b0a46 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 b3ccf19ae19277c06e401332179991e0c9b0b7db..cfde42a5cf3a81303d44b7c73498b95e5b2da62c 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 3f4b1d12cbdedc29db04d2594aa3041ca9faa154..8370bd95551e4808bd99ac0fdfc5b39ce5f95c47 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 bc730c9740d5ee0e56cd4789a5a8a9d8c3815cf8..0000000000000000000000000000000000000000
--- 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 792fd012fdf3b84ab8c6cf89c39f8445df3db0bf..6448a5b3df5cf793de628852034f6509d71ea36c 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 bc69163e00077c173d9cd549b28de709606e4fdc..218d8fb95237c20e9511e430b33a11d9da76f9d4 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 054a73db0623255fc81b6d3ced5c84b666cbafcb..5be91cb8044af7b302acc41ddc2a5bbdc885ce12 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 3d685d18e940633b6f6a1818335028164df116d5..4d83076c6009960cf8310003c400a14966e3a4dc 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 0ec6018f9ebcbb2a04a86a4aba504d1198190b03..5271dbd03b433cf193915648e4708b87e2df83ad 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 c88df2483a3d52662674973022d2ea65583e4d6b..3cc372094a379f9f4385cdd97f96dbd014dc88db 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 28cf71231b561ecad6fa2a2ea3241dbabf7e1238..20e9c09145f017586f759f7e3dd5c565ffe94865 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 895d5b35080ad711bacaae59dcd1b4fdb5ae9ccc..283f0c241833c8b0530fc77e1c32a5e946e575da 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 f685922e167e3589b8d565a124d63fa55dc7b0ae..c1d0a0aaa3fe0a298b114bbc3fff48fd6aca16e3 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 d2c8c71e62a4f7c0cb7f5c9fc3ab38db6569e140..5f7e17fb6799e914c07db6f06a0fed4f170f8d65 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 0f87e78213daeda38c35e69cb8659b84e89fa749..298effa2b15b9702c0f6e2f3b004f5393090ed66 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 3d49c05026861c307a52bb4bfff9115b3e3ab290..1410b177ff2feaef3727cefa8553332aa0aae0fc 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 b22289b5f5020eb9869cb781c0a96ce24aa39a3c..012c236463596ccdf1bf5f3fa33996e31b0fef42 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 a2edee3061e6d244987d3fe320bfab26766892c4..419fb7eb3e877b140a7266c85ab1ea114455314d 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 43c270c188d6241f575be4a7b08d52c8fec4d584..316c4d5b607ce9f9d33536d00e37532227139dd8 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 5fefb32d4a1ab30b9dff395674732d6d83f7a838..f4a2b09733387ec5e9a5aea8f69a19b6020ca8b2 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 cd99f7fe2a5bc6b5b42a77f872f35c6f58fb0122..641925f42a915f523f263529db6b0959411d926d 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 4530dcd6f8f7bec85a5d1122fbb2510f33c65645..1decdb22990da27f4cc2baea5d4396b74908e380 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 4baa4f51680164ab885bab4d194bc9d21afa474e..e6235572c1affbb740c3399add50efb47e7c8be3 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 d376c96c7ff820d43c597deb642a32d266ea92e5..63f98a2be142f77794b2ae090701de2c41500ee2 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 19a9d2547fba93884fcfee7f361997953dc482e1..0000000000000000000000000000000000000000
--- 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 b18471c06f221638f86c139a434fc9d26ac1581d..424359786aec31f38a41799dc953805cf4042233 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>