From bcef81a45307e073d7be27a0698c3f93e9939cc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 21 Jan 2009 15:06:34 +0000 Subject: [PATCH] Removed PHP warnings with E_ALL level --- htdocs/adherents/index.php | 12 +++--- htdocs/contrat/index.php | 32 +++++++------- .../menus/barre_left/eldy_backoffice.php | 12 +++--- htdocs/lib/databases/mysql.lib.php | 42 +++++++++---------- htdocs/lib/functions.lib.php | 3 +- htdocs/master.inc.php | 2 +- 6 files changed, 53 insertions(+), 50 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 533d32ec65d..5cc0479ad61 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2007 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * * 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 @@ -97,7 +97,7 @@ if ($result) else { $Cotisants[$objp->rowid]=0; // Calculé plus loin - } + } $i++; } $db->free($result); @@ -110,7 +110,7 @@ $sql.= " WHERE d.statut = 1 AND d.datefin >= ".$db->idate(mktime()); $sql.= " GROUP BY d.fk_adherent_type"; $result = $db->query($sql); -if ($result) +if ($result) { $num = $db->num_rows($result); $i = 0; @@ -247,7 +247,7 @@ if(isset($date_select) && $date_select != '') $sql .= " AND dateadh LIKE '$date_select%'"; } $result = $db->query($sql); -if ($result) +if ($result) { $num = $db->num_rows($result); $i = 0; @@ -255,8 +255,8 @@ if ($result) { $objp = $db->fetch_object($result); $year=dolibarr_print_date($objp->dateadh,"%Y"); - $Total[$year]+=$objp->cotisation; - $Number[$year]+=1; + $Total[$year]=(isset($Total[$year])?$Total[$year]:0)+$objp->cotisation; + $Number[$year]=(isset($Number[$year])?$Number[$year]:0)+1; $tot+=$objp->cotisation; $numb+=1; $i++; diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index b75e5650c6d..d0747eb0938 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2008 Laurent Destailleur + * Copyright (C) 2004-2009 Laurent Destailleur * * 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,13 +30,14 @@ require_once (DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); $langs->load("products"); $langs->load("companies"); -$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; -$page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; +$sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:(isset($_POST["sortfield"])?$_POST["sortfield"]:''); +$sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:(isset($_POST["sortorder"])?$_POST["sortorder"]:''); +$page = isset($_GET["page"])?$_GET["page"]:(isset($_POST["page"])?$_POST["page"]:''); $statut=isset($_GET["statut"])?$_GET["statut"]:1; // Security check +$socid=0; $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contrat',$contratid,''); @@ -122,7 +123,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) $companystatic=new Societe($db); $i = 0; - $tot_ttc = 0; + //$tot_ttc = 0; while ($i < $num && $i < 20) { $obj = $db->fetch_object($resql); @@ -138,7 +139,7 @@ if ($conf->contrat->enabled && $user->rights->contrat->lire) print $companystatic->getNomUrl(1,'',16); print ''; print ''; - $tot_ttc+=$obj->total_ttc; + //$tot_ttc+=$obj->total_ttc; $i++; $var=!$var; } @@ -163,8 +164,8 @@ print ''; $max=5; $sql = 'SELECT '; $sql.= ' sum('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,'; -$sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > ".$db->idate(mktime()),1,0).') as nb_running,'; -$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= ".$db->idate(mktime()).")",1,0).') as nb_late,'; +$sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > ".$db->idate(gmmktime()),1,0).') as nb_running,'; +$sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= ".$db->idate(gmmktime()).")",1,0).') as nb_late,'; $sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= " c.rowid as cid, c.ref, c.datec, c.tms, c.statut, s.nom, s.rowid as socid"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; @@ -179,26 +180,27 @@ $sql.= " GROUP BY c.rowid, c.datec, c.statut, s.nom, s.rowid"; $sql.= " ORDER BY c.tms DESC"; $sql.= " LIMIT ".$max; +dolibarr_syslog("contrat/index.php sql=".$sql, LOG_DEBUG); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); $i = 0; - + print ''; - + print ''; print ''; //print ''; print ''; print "\n"; - + $var=True; while ($i < $num) { $obj = $db->fetch_object($result); $var=!$var; - + print ""; print "
'.$langs->trans("LastContracts",5).''.$langs->trans("DateModification").''.$langs->trans("Status").''.$langs->trans("Services").'
"; $staticcontrat->ref=($obj->ref?$obj->ref:$obj->cid); @@ -220,9 +222,9 @@ if ($result) $i++; } $db->free($result); - + print "
"; - + } else { @@ -327,7 +329,7 @@ if ($resql) $staticcontrat->ref=($obj->ref?$obj->ref:$obj->fk_contrat); $staticcontrat->id=$obj->fk_contrat; print $staticcontrat->getNomUrl(1,16); - if ($obj->nb_late) print img_warning($langs->trans("Late")); + //if (1 == 1) print img_warning($langs->trans("Late")); print ''; print ''.img_object($langs->trans("ShowService"),"service"); if ($obj->label) print ' '.dolibarr_trunc($obj->label,20).''; diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 58e92869c44..d52da976707 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -301,7 +301,7 @@ class MenuLeft { $newmenu->add_submenu(DOL_URL_ROOT."/contact/index.php?leftmenu=contacts&type=o", $langs->trans("Others"), 2, $user->rights->societe->contact->lire); // Propal - if ($conf->propal->enabled) + if (! empty($conf->propal->enabled)) { $langs->load("propal"); $newmenu->add(DOL_URL_ROOT."/comm/propal.php?leftmenu=propals", $langs->trans("Prop"), 0 ,$user->rights->propale->lire); @@ -317,7 +317,7 @@ class MenuLeft { } // Customers orders - if ($conf->commande->enabled) + if (! empty($conf->commande->enabled)) { $langs->load("orders"); $newmenu->add(DOL_URL_ROOT."/commande/index.php?leftmenu=orders", $langs->trans("CustomersOrders"), 0 ,$user->rights->commande->lire); @@ -331,11 +331,11 @@ class MenuLeft { if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/liste.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1 ,$user->rights->commande->lire); // Statistiques de vente perso - if ($conf->global->COMMANDE_SHOWMYSTATS && $leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/comm/stats.php?leftmenu=orders", $langs->trans("Stats"), 1, $user->rights->commande->lire); + if (! empty($conf->global->COMMANDE_SHOWMYSTATS) && $leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/comm/stats.php?leftmenu=orders", $langs->trans("Stats"), 1, $user->rights->commande->lire); } // Suppliers orders - if ($conf->fournisseur->enabled) + if (! empty($conf->fournisseur->enabled)) { $langs->load("orders"); $newmenu->add(DOL_URL_ROOT."/fourn/commande/index.php?leftmenu=orders_suppliers",$langs->trans("SuppliersOrders"), 0, $user->rights->fournisseur->commande->lire); @@ -345,7 +345,7 @@ class MenuLeft { } // Contrat - if ($conf->contrat->enabled) + if (! empty($conf->contrat->enabled)) { $langs->load("contracts"); $newmenu->add(DOL_URL_ROOT."/contrat/index.php?leftmenu=contracts", $langs->trans("Contracts"), 0 ,$user->rights->contrat->lire); @@ -359,7 +359,7 @@ class MenuLeft { } // Interventions - if ($conf->ficheinter->enabled) + if (! empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $newmenu->add(DOL_URL_ROOT."/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire); diff --git a/htdocs/lib/databases/mysql.lib.php b/htdocs/lib/databases/mysql.lib.php index 4d2146d744c..39a4642bda2 100644 --- a/htdocs/lib/databases/mysql.lib.php +++ b/htdocs/lib/databases/mysql.lib.php @@ -160,7 +160,7 @@ class DoliDb { // Pas de selection de base demandee, ok ou ko $this->database_selected = 0; - + if ($this->connected) { // If client connected with different charset than Dolibarr HTML output @@ -456,10 +456,10 @@ class DoliDb /** - \brief D�fini les limites de la requ�te. - \param limit nombre maximum de lignes retourn�es - \param offset num�ro de la ligne � partir de laquelle recup�rer les ligne - \return string chaine exprimant la syntax sql de la limite + * \brief Defini les limites de la requete. + * \param limit nombre maximum de lignes retournees + * \param offset numero de la ligne a partir de laquelle recuperer les ligne + * \return string chaine exprimant la syntax sql de la limite */ function plimit($limit=0,$offset=0) { @@ -471,12 +471,12 @@ class DoliDb /** - \brief D�fini le tri de la requ�te. - \param sortfield liste des champ de tri - \param sortorder ordre du tri - \return string chaine exprimant la syntax sql de l'ordre de tri - \TODO A mutualiser dans classe mere - */ + * \brief Defini le tri de la requete. + * \param sortfield liste des champ de tri + * \param sortorder ordre du tri + * \return string chaine exprimant la syntax sql de l'ordre de tri + * \TODO A mutualiser dans classe mere + */ function order($sortfield=0,$sortorder=0) { if ($sortfield) @@ -512,9 +512,9 @@ class DoliDb /** - * \brief Formatage (par la base de donn�es) d'un champ de la base au format TMS ou Date (YYYY-MM-DD HH:MM:SS) - * afin de retourner une donn�e toujours au format universel date TMS unix. - * Fonction � utiliser pour g�n�rer les SELECT. + * \brief Formatage (par la base de donnees) d'un champ de la base au format TMS ou Date (YYYY-MM-DD HH:MM:SS) + * afin de retourner une donnee toujours au format universel date TMS unix. + * Fonction a utiliser pour generer les SELECT. * \param param Nom champ base de type date ou chaine 'YYYY-MM-DD HH:MM:SS' * \return date Date au format TMS. * \TODO Remove unix_timestamp functions so use jdate instead @@ -525,7 +525,7 @@ class DoliDb } /** - * \brief Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field. + * \brief Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. * Function to use to build INSERT, UPDATE or WHERE predica * \param param Date TMS to convert * \return string Date in a string YYYYMMDDHHMMSS @@ -534,7 +534,7 @@ class DoliDb { return adodb_strftime("%Y%m%d%H%M%S",$param); } - + /** * \brief Convert (by PHP) a PHP server TZ string date into a GM Timestamps date * \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) @@ -548,7 +548,7 @@ class DoliDb $date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4)); return $date; } - + /** * \brief Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field. * Function to use to build INSERT, UPDATE or WHERE predica @@ -559,7 +559,7 @@ class DoliDb { return adodb_strftime("%Y%m%d%H%M%S",$param,true); }*/ - + /** * \brief Convert (by PHP) a GM string date into a GM Timestamps date * \param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS) @@ -573,7 +573,7 @@ class DoliDb $date=dolibarr_mktime(substr($tmp,8,2),substr($tmp,10,2),substr($tmp,12,2),substr($tmp,4,2),substr($tmp,6,2),substr($tmp,0,4),1); return $date; }*/ - + /** * \brief Formatage d'un if SQL @@ -663,7 +663,7 @@ class DoliDb 1217 => 'DB_ERROR_CHILD_EXISTS', 1451 => 'DB_ERROR_CHILD_EXISTS' ); - + if (isset($errorcode_map[mysql_errno($this->db)])) { return $errorcode_map[mysql_errno($this->db)]; @@ -730,7 +730,7 @@ class DoliDb { if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->collation; - + // ALTER DATABASE dolibarr_db DEFAULT CHARACTER SET latin DEFAULT COLLATE latin1_swedish_ci $sql = 'CREATE DATABASE '.$database; $sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation; diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php index e4242e79b7c..924069fff60 100644 --- a/htdocs/lib/functions.lib.php +++ b/htdocs/lib/functions.lib.php @@ -1392,7 +1392,8 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='', // Check write permission from module $createok=1; - if ($_GET["action"] == 'create' || $_POST["action"] == 'create') + if ( (isset($_GET["action"]) && $_GET["action"] == 'create') + || (isset($_POST["action"]) && $_POST["action"] == 'create') ) { if ($feature == 'societe') { diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 94d6ef2570c..e8a0990fc17 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -58,7 +58,7 @@ else // 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); // Include configuration