Qual: Some fixes to make working with PHP option error_reporting

E_STRICT
This commit is contained in:
Laurent Destailleur 2011-10-29 19:50:25 +02:00
parent fd9619f4cd
commit 784f696c85
10 changed files with 49 additions and 43 deletions

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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"];

View File

@ -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 "<td align=\"right\">".$langs->trans("Invoices")."</td>";
print "<td align=\"right\">".$langs->trans("TotalToPay")."</td>";
print "</tr>\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 "<tr class=\"liste_titre\"><td colspan=\"8\">".$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").")</td></tr>";
$var=true;

View File

@ -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<br>\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;

View File

@ -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."'";

View File

@ -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

View File

@ -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;