Perf: Sompe optimizations that reduce number of opened files
This commit is contained in:
parent
86eb3f096d
commit
3c5708ba7f
@ -113,8 +113,10 @@ $dir = "../includes/modules/societe/";
|
|||||||
$handle = opendir($dir);
|
$handle = opendir($dir);
|
||||||
if ($handle)
|
if ($handle)
|
||||||
{
|
{
|
||||||
$var = true;
|
$var = true;
|
||||||
while (($file = readdir($handle))!==false)
|
|
||||||
|
// Loop on each module find in opened directory
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
|
if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,8 +29,11 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
|
||||||
require_once("main.inc.php");
|
require_once("main.inc.php");
|
||||||
|
|
||||||
|
|
||||||
function llxHeader()
|
function llxHeader()
|
||||||
{
|
{
|
||||||
global $user,$langs;
|
global $user,$langs;
|
||||||
|
|||||||
@ -27,9 +27,16 @@
|
|||||||
\brief Fichier de gestion de la popup de selection de date eldy
|
\brief Fichier de gestion de la popup de selection de date eldy
|
||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
|
||||||
|
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
|
||||||
|
|
||||||
require_once("../conf/conf.php");
|
|
||||||
require_once("../master.inc.php");
|
require_once("../master.inc.php");
|
||||||
|
|
||||||
|
|
||||||
$langs->trans("main");
|
$langs->trans("main");
|
||||||
|
|
||||||
if(!isset($_GET["cm"])) $_GET["cm"]="shw";
|
if(!isset($_GET["cm"])) $_GET["cm"]="shw";
|
||||||
|
|||||||
@ -136,42 +136,58 @@ if (isset($_SERVER["HTTP_USER_AGENT"]))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chargement des includes principaux
|
// Chargement des includes principaux
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
if (! defined('NOREQUIREUSER')) require_once(DOL_DOCUMENT_ROOT ."/user.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
if (! defined('NOREQUIREMENU')) require_once(DOL_DOCUMENT_ROOT ."/menu.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
if (! defined('NOREQUIREHTML')) require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/databases/".$conf->db->type.".lib.php");
|
if (! defined('NOREQUIREDB')) require_once(DOL_DOCUMENT_ROOT ."/lib/databases/".$conf->db->type.".lib.php");
|
||||||
|
if (! defined('NOREQUIRETRAN')) require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
||||||
|
if (! defined('NOREQUIRESOC')) require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creation objet $langs
|
* Creation objet $langs
|
||||||
*/
|
*/
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/translate.class.php");
|
if (! defined('NOREQUIRETRAN'))
|
||||||
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); // A mettre apres lecture de la conf
|
{
|
||||||
|
$langs = new Translate(DOL_DOCUMENT_ROOT ."/langs",$conf); // A mettre apres lecture de la conf
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creation objet $db
|
* Creation objet $db
|
||||||
*/
|
*/
|
||||||
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
if (! defined('NOREQUIREDB'))
|
||||||
if (! $db->connected) {
|
{
|
||||||
dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
$db = new DoliDb($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name);
|
||||||
exit;
|
if (! $db->connected)
|
||||||
|
{
|
||||||
|
dolibarr_print_error($db,"host=".$conf->db->host.", user=".$conf->db->user.", databasename=".$conf->db->name.", ".$db->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creation objet $user
|
* Creation objet $user
|
||||||
*/
|
*/
|
||||||
$user = new User($db);
|
if (! defined('NOREQUIREUSER'))
|
||||||
|
{
|
||||||
|
$user = new User($db);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chargement objet $conf
|
* Chargement objet $conf
|
||||||
*/
|
*/
|
||||||
$conf->setValues($db);
|
if (! defined('NOREQUIREDB'))
|
||||||
|
{
|
||||||
|
$conf->setValues($db);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chargement langage par défaut
|
* Chargement langage par défaut
|
||||||
*/
|
*/
|
||||||
$langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT);
|
if (! defined('NOREQUIRETRAN'))
|
||||||
$langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
{
|
||||||
|
$langs->setDefaultLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
$langs->setPhpLang($conf->global->MAIN_LANG_DEFAULT);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pour utiliser d'autres versions des librairies externes que les
|
* Pour utiliser d'autres versions des librairies externes que les
|
||||||
@ -222,57 +238,58 @@ if (defined("MAIN_MODULE_TELEPHONIE") && MAIN_MODULE_TELEPHONIE) require_once(FP
|
|||||||
* Creation objet mysoc
|
* Creation objet mysoc
|
||||||
* Objet Societe qui contient carac de l'institution géré par Dolibarr.
|
* Objet Societe qui contient carac de l'institution géré par Dolibarr.
|
||||||
*/
|
*/
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/societe.class.php");
|
if (! defined('NOREQUIRESOC'))
|
||||||
$mysoc=new Societe($db);
|
|
||||||
$mysoc->id=0;
|
|
||||||
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
|
||||||
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
|
||||||
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP;
|
|
||||||
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
|
||||||
// Si dans MAIN_INFO_SOCIETE_PAYS on a un id de pays, on recupere code
|
|
||||||
if (is_numeric($conf->global->MAIN_INFO_SOCIETE_PAYS))
|
|
||||||
{
|
{
|
||||||
$mysoc->pays_id=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
$mysoc=new Societe($db);
|
||||||
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
$mysoc->id=0;
|
||||||
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
$mysoc->nom=$conf->global->MAIN_INFO_SOCIETE_NOM;
|
||||||
$result=$db->query($sql);
|
$mysoc->adresse=$conf->global->MAIN_INFO_SOCIETE_ADRESSE;
|
||||||
if ($result)
|
$mysoc->cp=$conf->global->MAIN_INFO_SOCIETE_CP;
|
||||||
{
|
$mysoc->ville=$conf->global->MAIN_INFO_SOCIETE_VILLE;
|
||||||
$obj = $db->fetch_object();
|
// Si dans MAIN_INFO_SOCIETE_PAYS on a un id de pays, on recupere code
|
||||||
$mysoc->pays_code=$obj->code;
|
if (is_numeric($conf->global->MAIN_INFO_SOCIETE_PAYS))
|
||||||
}
|
{
|
||||||
else {
|
$mysoc->pays_id=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||||
dolibarr_print_error($db);
|
$sql = "SELECT code from ".MAIN_DB_PREFIX."c_pays";
|
||||||
}
|
$sql .= " WHERE rowid = ".$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object();
|
||||||
|
$mysoc->pays_code=$obj->code;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Si dans MAIN_INFO_SOCIETE_PAYS on a deja un code, tout est fait
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$mysoc->pays_code=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
||||||
|
}
|
||||||
|
$mysoc->tel=$conf->global->MAIN_INFO_SOCIETE_TEL;
|
||||||
|
$mysoc->fax=$conf->global->MAIN_INFO_SOCIETE_FAX;
|
||||||
|
$mysoc->url=$conf->global->MAIN_INFO_SOCIETE_WEB;
|
||||||
|
// Anciens id prof
|
||||||
|
$mysoc->siren=$conf->global->MAIN_INFO_SIREN;
|
||||||
|
$mysoc->siret=$conf->global->MAIN_INFO_SIRET;
|
||||||
|
$mysoc->ape=$conf->global->MAIN_INFO_APE;
|
||||||
|
$mysoc->rcs=$conf->global->MAIN_INFO_RCS;
|
||||||
|
// Id prof génériques
|
||||||
|
$mysoc->profid1=$conf->global->MAIN_INFO_SIREN;
|
||||||
|
$mysoc->profid2=$conf->global->MAIN_INFO_SIRET;
|
||||||
|
$mysoc->profid3=$conf->global->MAIN_INFO_APE;
|
||||||
|
$mysoc->profid4=$conf->global->MAIN_INFO_RCS;
|
||||||
|
$mysoc->tva_assuj=$conf->global->FACTURE_TVAOPTION;
|
||||||
|
$mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA;
|
||||||
|
$mysoc->capital=$conf->global->MAIN_INFO_CAPITAL;
|
||||||
|
$mysoc->forme_juridique_code=$conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE;
|
||||||
|
$mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL;
|
||||||
|
$mysoc->adresse_full=$mysoc->adresse."\n".$mysoc->cp." ".$mysoc->ville;
|
||||||
|
$mysoc->logo=$conf->global->MAIN_INFO_SOCIETE_LOGO;
|
||||||
|
$mysoc->logo_small=$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL;
|
||||||
|
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
|
||||||
}
|
}
|
||||||
// Si dans MAIN_INFO_SOCIETE_PAYS on a deja un code, tout est fait
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$mysoc->pays_code=$conf->global->MAIN_INFO_SOCIETE_PAYS;
|
|
||||||
}
|
|
||||||
$mysoc->tel=$conf->global->MAIN_INFO_SOCIETE_TEL;
|
|
||||||
$mysoc->fax=$conf->global->MAIN_INFO_SOCIETE_FAX;
|
|
||||||
$mysoc->url=$conf->global->MAIN_INFO_SOCIETE_WEB;
|
|
||||||
// Anciens id prof
|
|
||||||
$mysoc->siren=$conf->global->MAIN_INFO_SIREN;
|
|
||||||
$mysoc->siret=$conf->global->MAIN_INFO_SIRET;
|
|
||||||
$mysoc->ape=$conf->global->MAIN_INFO_APE;
|
|
||||||
$mysoc->rcs=$conf->global->MAIN_INFO_RCS;
|
|
||||||
// Id prof génériques
|
|
||||||
$mysoc->profid1=$conf->global->MAIN_INFO_SIREN;
|
|
||||||
$mysoc->profid2=$conf->global->MAIN_INFO_SIRET;
|
|
||||||
$mysoc->profid3=$conf->global->MAIN_INFO_APE;
|
|
||||||
$mysoc->profid4=$conf->global->MAIN_INFO_RCS;
|
|
||||||
$mysoc->tva_assuj=$conf->global->FACTURE_TVAOPTION;
|
|
||||||
$mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA;
|
|
||||||
$mysoc->capital=$conf->global->MAIN_INFO_CAPITAL;
|
|
||||||
$mysoc->forme_juridique_code=$conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE;
|
|
||||||
$mysoc->email=$conf->global->MAIN_INFO_SOCIETE_MAIL;
|
|
||||||
$mysoc->adresse_full=$mysoc->adresse."\n".$mysoc->cp." ".$mysoc->ville;
|
|
||||||
$mysoc->logo=$conf->global->MAIN_INFO_SOCIETE_LOGO;
|
|
||||||
$mysoc->logo_small=$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL;
|
|
||||||
$mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
|
|
||||||
|
|
||||||
|
|
||||||
// Sert uniquement dans module telephonie
|
// Sert uniquement dans module telephonie
|
||||||
$yesno[0]="no";
|
$yesno[0]="no";
|
||||||
|
|||||||
@ -31,14 +31,11 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\class Societe
|
\class Societe
|
||||||
\brief Classe permettant la gestion des societes
|
\brief Classe permettant la gestion des societes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Societe
|
class Societe
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
@ -982,6 +979,8 @@ class Societe
|
|||||||
|
|
||||||
if ($this->id)
|
if ($this->id)
|
||||||
{
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||||
|
|
||||||
$discount = new DiscountAbsolute($this->db);
|
$discount = new DiscountAbsolute($this->db);
|
||||||
$discount->fk_soc=$this->id;
|
$discount->fk_soc=$this->id;
|
||||||
$discount->amount_ht=price2num($remise,'MT');
|
$discount->amount_ht=price2num($remise,'MT');
|
||||||
@ -1012,8 +1011,10 @@ class Societe
|
|||||||
{
|
{
|
||||||
if ($this->id)
|
if ($this->id)
|
||||||
{
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||||
|
|
||||||
$discount = new DiscountAbsolute($this->db);
|
$discount = new DiscountAbsolute($this->db);
|
||||||
$discount->fetch($id);
|
$result=$discount->fetch($id);
|
||||||
$result=$discount->delete();
|
$result=$discount->delete();
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,6 +28,8 @@
|
|||||||
\version $Revision$
|
\version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
|
||||||
|
|
||||||
// C'est un wrapper, donc header vierge
|
// C'est un wrapper, donc header vierge
|
||||||
function llxHeader() { }
|
function llxHeader() { }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user