diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index a5c566391e9..9d24bbe3c48 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -87,7 +87,7 @@ else } // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->compta->mode; +$modecompta = $conf->global->COMPTA_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 2af686bdec7..35f3e1aedfe 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -44,7 +44,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta accessforbidden(); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->compta->mode; +$modecompta = $conf->global->COMPTA_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 4b02a954fac..da20dd3a7cd 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -34,7 +34,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta accessforbidden(); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->compta->mode; +$modecompta = $conf->global->COMPTA_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 7962b3f1059..4fbdbd7eaed 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -31,7 +31,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"); $langs->load("companies"); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->compta->mode; +$modecompta = $conf->global->COMPTA_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; $sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 2942b62c912..a243cfedc34 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -45,7 +45,7 @@ if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->compta accessforbidden(); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->compta->mode; +$modecompta = $conf->global->COMPTA_MODE; if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; diff --git a/htdocs/compta/tva/quadri.php b/htdocs/compta/tva/quadri.php index d02ebf630d6..3154c5de299 100644 --- a/htdocs/compta/tva/quadri.php +++ b/htdocs/compta/tva/quadri.php @@ -49,7 +49,8 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); * Gets VAT to collect for the given month of the given year * The function gets the VAT in split results, as the VAT declaration asks * to report the amounts for different VAT rates as different lines. - * This function also accounts recurrent invoices + * This function also accounts recurrent invoices. + * * @param db Database handler * @param y Year * @param q Year quarter (1-4) @@ -57,7 +58,8 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); function tva_coll($db,$y,$q) { global $conf; - if ($conf->compta->mode == "CREANCES-DETTES") + + if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") { // if vat paid on due invoices $sql = "SELECT d.fk_facture as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.total_tva as amount"; @@ -124,7 +126,7 @@ function tva_paye($db, $y,$q) { global $conf; - if ($conf->compta->mode == "CREANCES-DETTES") + if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") { // Si on paye la tva sur les factures dues (non brouillon) $sql = "SELECT d.fk_facture_fourn as facid, f.facnumber as facnum, d.tva_tx as rate, d.total_ht as totalht, d.tva as amount"; @@ -208,10 +210,9 @@ print "".$langs->trans("Invoices").""; print "".$langs->trans("TotalToPay").""; print "\n"; -if ($conf->compta->mode == "CREANCES-DETTES") +if ($conf->global->COMPTA_MODE == "CREANCES-DETTES") { - $y = $year_current ; - + $y = $year_current; $total = 0; $subtotal = 0; $i=0; @@ -219,7 +220,7 @@ if ($conf->compta->mode == "CREANCES-DETTES") $subtot_coll_vat = 0; $subtot_paye_total = 0; $subtot_paye_vat = 0; - for ($q = 1 ; $q <= 4 ; $q++ ) + for ($q = 1 ; $q <= 4 ; $q++) { print "".$langs->trans("Quadri")." $q (".dol_print_date(dol_mktime(0,0,0,(($q-1)*3)+1,1,$y),"%b %Y").' - '.dol_print_date(dol_mktime(0,0,0,($q*3),1,$y),"%b %Y").")"; $var=true; diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 44a366f876c..5895d3a8c45 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -38,6 +38,9 @@ class Conf var $db; //! To store properties found in conf file var $file; + //! To store properties found into database + var $global; + //! To store if javascript/ajax is enabked var $use_javascript_ajax; @@ -73,10 +76,15 @@ class Conf */ function Conf() { - //! Charset for HTML output and for storing data in memory - $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 - - // $this->agendas_modules['comm/action'][]= 'ActionAgenda'; + // Avoid warnings when filling this->xxx + $this->file=(object) array(); + $this->db=(object) array(); + $this->global=(object) array(); + $this->mycompany=(object) array(); + $this->admin=(object) array(); + $this->user=(object) array(); + //! Charset for HTML output and for storing data in memory + $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 } @@ -172,6 +180,7 @@ class Conf { $module=strtolower($reg[1]); //print "Module ".$module." is enabled
\n"; + $this->$module=(object) array(); $this->$module->enabled=true; // Add this module in list of enabled modules $this->modules[]=$module; @@ -231,7 +240,6 @@ class Conf // For backward compatibility // TODO Replace this->xxx->enabled by this->modulename->enabled to remove this code - if (isset($this->comptabilite->enabled)) $this->compta->enabled=$this->comptabilite->enabled; if (isset($this->propale->enabled)) $this->propal->enabled=$this->propale->enabled; // Define default dir_output and dir_temp for directories of modules @@ -313,10 +321,8 @@ class Conf $this->monnaie=$this->global->MAIN_MONNAIE; // TODO deprecated $this->currency=$this->global->MAIN_MONNAIE; - // $this->compta->mode = Option du module Comptabilite (simple ou expert): - // Defini le mode de calcul des etats comptables (CA,...) - $this->compta->mode = 'RECETTES-DEPENSES'; // By default - if (isset($this->global->COMPTA_MODE)) $this->compta->mode = $this->global->COMPTA_MODE; // Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' + // $this->global->COMPTA_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...) + if (empty($this->global->COMPTA_MODE)) $this->global->COMPTA_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES' // $this->liste_limit = constante de taille maximale des listes if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25; diff --git a/htdocs/core/lib/accountancy.lib.php b/htdocs/core/lib/accountancy.lib.php index a1500797866..f0586fc50d7 100644 --- a/htdocs/core/lib/accountancy.lib.php +++ b/htdocs/core/lib/accountancy.lib.php @@ -50,10 +50,11 @@ function get_ca_propal ($db, $year, $socid) function get_ca ($db, $year, $socid) { global $conf; - + $sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f"; $sql .= " WHERE f.fk_statut in (1,2)"; - if ($conf->compta->mode != 'CREANCES-DETTES') { + if ($conf->global->COMPTA_MODE != 'CREANCES-DETTES') + { $sql .= " AND f.paye = 1"; } $sql .= " AND date_format(f.datef , '%Y') = '".$year."'"; diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 8695e9d6004..b01d7dc61b9 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -33,30 +33,29 @@ if (! defined('DOL_VERSION')) define('DOL_VERSION','3.2.0-alpha'); // Also defin if (! defined('EURO')) define('EURO',chr(128)); // Definition des constantes syslog -if (function_exists("define_syslog_variables")) +if (! defined('LOG_DEBUG')) { - if (version_compare(PHP_VERSION, '5.3.0', '<')) - { - define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized - } + if (function_exists("define_syslog_variables")) + { + define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized + } + else + { + // Pour PHP sans syslog (comme sous Windows) + define('LOG_EMERG',0); + define('LOG_ALERT',1); + define('LOG_CRIT',2); + define('LOG_ERR',3); + define('LOG_WARNING',4); + define('LOG_NOTICE',5); + define('LOG_INFO',6); + define('LOG_DEBUG',7); + } } -else -{ - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); -} - // Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL) error_reporting(E_ALL ^ E_NOTICE); -//error_reporting(E_ALL); +//error_reporting(E_ALL | E_STRICT); // Define vars diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 1f223fc38f9..c56ded1c2aa 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -42,7 +42,6 @@ require_once("filefunc.inc.php"); // May have been already require by main.inc.p require_once(DOL_DOCUMENT_ROOT."/core/class/conf.class.php"); $conf = new Conf(); - // Identifiant propres au serveur base de donnee $conf->db->host = $dolibarr_main_db_host; $conf->db->port = $dolibarr_main_db_port;