Qual: Clean a lot of code to prepare remove of pre.inc.php
This commit is contained in:
parent
99e6134e82
commit
43b69e1da0
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007-2010 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
|
||||
@ -30,14 +30,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||
|
||||
// This is to make Dolibarr working with Plesk
|
||||
set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
|
||||
|
||||
// Retrieve the entity in the cookie
|
||||
$entityCookieName = "DOLENTITYID_".md5($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"]);
|
||||
if (isset($_COOKIE[$entityCookieName])) $_SESSION["dol_entity"] = $_COOKIE[$entityCookieName];
|
||||
|
||||
require('master.inc.php');
|
||||
require('./main.inc.php');
|
||||
require_once(DOL_DOCUMENT_ROOT."/boxes.php");
|
||||
|
||||
// Registering the location of boxes
|
||||
|
||||
@ -506,7 +506,6 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
{
|
||||
$facture = new Facture($db);
|
||||
$facture->socid=$_POST['socid'];
|
||||
$facture->fetch_client();
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -530,6 +529,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
|
||||
{
|
||||
// This is a replacement invoice
|
||||
$result=$facture->fetch($_POST['fac_replacement']);
|
||||
$facture->fetch_client();
|
||||
|
||||
$facture->date = $datefacture;
|
||||
$facture->note_public = trim($_POST['note_public']);
|
||||
@ -891,6 +891,11 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("UnitPriceHT")).'</div>';
|
||||
$result = -1 ;
|
||||
}
|
||||
if (empty($_POST['idprod']) && empty($_POST["np_desc"]) && empty($_POST["dp_desc"]))
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Description")).'</div>';
|
||||
$result = -1 ;
|
||||
}
|
||||
if (! isset($_POST['qty']) || $_POST['qty']=='')
|
||||
{
|
||||
$mesg='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv('Qty')).'</div>';
|
||||
|
||||
@ -594,25 +594,26 @@ if (! defined('NOLOGIN'))
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (empty($_GET["lang"])) // If language was not forced on URL
|
||||
if (! defined('NOREQUIRETRAN'))
|
||||
{
|
||||
// If user has chosen its own language
|
||||
if (! empty($user->conf->MAIN_LANG_DEFAULT))
|
||||
if (empty($_GET["lang"])) // If language was not forced on URL
|
||||
{
|
||||
// If different than current language
|
||||
//print ">>>".$langs->getDefaultLang()."-".$user->conf->MAIN_LANG_DEFAULT;
|
||||
if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT)
|
||||
// If user has chosen its own language
|
||||
if (! empty($user->conf->MAIN_LANG_DEFAULT))
|
||||
{
|
||||
$langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
|
||||
// If different than current language
|
||||
//print ">>>".$langs->getDefaultLang()."-".$user->conf->MAIN_LANG_DEFAULT;
|
||||
if ($langs->getDefaultLang() != $user->conf->MAIN_LANG_DEFAULT)
|
||||
{
|
||||
$langs->setDefaultLang($user->conf->MAIN_LANG_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // If language was forced on URL
|
||||
{
|
||||
$langs->setDefaultLang($_GET["lang"]);
|
||||
}
|
||||
}
|
||||
else // If language was forced on URL
|
||||
{
|
||||
$langs->setDefaultLang($_GET["lang"]);
|
||||
}
|
||||
|
||||
|
||||
// Case forcing style from url
|
||||
if (! empty($_GET["theme"]))
|
||||
|
||||
@ -1,146 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2004 Guillaume Delecourt <guillaume.delecourt@opensides.be>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/pre.inc.php
|
||||
* \brief File to manage left menu for home page
|
||||
* \version $Id$
|
||||
*/
|
||||
require ("./main.inc.php");
|
||||
|
||||
|
||||
function llxHeader($head = '', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='')
|
||||
{
|
||||
global $user, $conf, $langs;
|
||||
|
||||
top_menu($head, $title, $target, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
|
||||
$menu = new Menu();
|
||||
|
||||
if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("companies");
|
||||
$menu->add(DOL_URL_ROOT."/societe.php", $langs->trans("ThirdParties"));
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/soc.php?action=create", $langs->trans("MenuNewThirdParty"),1);
|
||||
}
|
||||
|
||||
$menu->add(DOL_URL_ROOT."/contact/index.php",$langs->trans("Contacts"),1);
|
||||
}
|
||||
|
||||
if (! empty($conf->categorie->enabled))
|
||||
{
|
||||
$langs->load("categories");
|
||||
$menu->add(DOL_URL_ROOT."/categories/index.php?type=0", $langs->trans("Categories"));
|
||||
}
|
||||
|
||||
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
|
||||
{
|
||||
$langs->trans("interventions");
|
||||
$menu->add(DOL_URL_ROOT."/fichinter/index.php", $langs->trans("Interventions"));
|
||||
}
|
||||
|
||||
if (($conf->produit->enabled && $user->rights->produit->lire) || ($conf->service->enabled && $user->rights->service->lire))
|
||||
{
|
||||
$langs->load("products");
|
||||
$chaine="";
|
||||
if ($conf->produit->enabled) { $chaine.= $langs->trans("Products"); }
|
||||
if ($conf->produit->enabled && $conf->service->enabled) { $chaine.="/"; }
|
||||
if ($conf->service->enabled) { $chaine.= $langs->trans("Services"); }
|
||||
$menu->add(DOL_URL_ROOT."/product/index.php", "$chaine");
|
||||
}
|
||||
|
||||
|
||||
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
|
||||
{
|
||||
$langs->load("orders");
|
||||
$menu->add(DOL_URL_ROOT."/commande/index.php", $langs->trans("Orders"));
|
||||
}
|
||||
|
||||
if (! empty($conf->document->enabled))
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/docs/index.php", $langs->trans("DocumentsBuilder"));
|
||||
}
|
||||
|
||||
if (! empty($conf->expedition->enabled) && $user->rights->expedition->lire)
|
||||
{
|
||||
$langs->load("sendings");
|
||||
$menu->add(DOL_URL_ROOT."/expedition/index.php", $langs->trans("Sendings"));
|
||||
}
|
||||
|
||||
if (! empty($conf->mailing->enabled) && $user->rights->mailing->lire)
|
||||
{
|
||||
$langs->load("mails");
|
||||
$menu->add(DOL_URL_ROOT."/comm/mailing/index.php",$langs->trans("EMailings"));
|
||||
}
|
||||
|
||||
if (! empty($conf->telephonie->enabled))
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/telephonie/index.php", "Telephonie");
|
||||
}
|
||||
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/compta/dons/index.php", $langs->trans("Donations"));
|
||||
}
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
|
||||
{
|
||||
$langs->load("suppliers");
|
||||
$menu->add(DOL_URL_ROOT."/fourn/index.php", $langs->trans("Suppliers"));
|
||||
}
|
||||
|
||||
if (! empty($conf->domaine->enabled))
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/domain/index.php", "Domaines");
|
||||
}
|
||||
|
||||
if (! empty($conf->export->enabled))
|
||||
{
|
||||
$langs->load("exports");
|
||||
$menu->add(DOL_URL_ROOT."/exports/index.php?leftmenu=export",$langs->trans("FormatedExport"),0,$user->rights->export->lire);
|
||||
$menu->add(DOL_URL_ROOT."/exports/export.php?leftmenu=export",$langs->trans("NewExport"),1,$user->rights->export->creer);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MODULE_IMPORT))
|
||||
{
|
||||
$langs->load("exports");
|
||||
$menu->add(DOL_URL_ROOT."/imports/index.php?leftmenu=import",$langs->trans("FormatedImport"),0,$user->rights->import->run);
|
||||
$menu->add(DOL_URL_ROOT."/imports/import.php?leftmenu=import",$langs->trans("NewImport"),1,$user->rights->import->run);
|
||||
}
|
||||
|
||||
if ($user->rights->user->user->lire || $user->admin)
|
||||
{
|
||||
$langs->load("users");
|
||||
$menu->add(DOL_URL_ROOT."/user/home.php", $langs->trans("MenuUsersAndGroups"));
|
||||
}
|
||||
|
||||
if ($user->admin)
|
||||
{
|
||||
$menu->add(DOL_URL_ROOT."/admin/index.php", $langs->trans("Setup"));
|
||||
}
|
||||
|
||||
left_menu($menu->liste, $help_url);
|
||||
}
|
||||
?>
|
||||
@ -29,7 +29,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("pre.inc.php");
|
||||
require("./main.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formadmin.class.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formcompany.class.php");
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require_once("./pre.inc.php");
|
||||
require_once("./main.inc.php");
|
||||
include_once(DOL_DOCUMENT_ROOT."/contact.class.php");
|
||||
|
||||
$langs->load("companies");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user