From 3c794967c3835447dabfae349a7eba2b5c490145 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 23 Mar 2012 17:18:33 +0100 Subject: [PATCH] Fix: multiple avoid warning with php strict mode --- htdocs/admin/commande.php | 2 +- htdocs/admin/propal.php | 2 +- htdocs/core/class/conf.class.php | 89 ++++++++++--------- .../modules/commande/modules_commande.php | 34 ++++--- .../modules/propale/mod_propale_marbre.php | 2 +- .../core/modules/propale/modules_propale.php | 6 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/price.php | 4 +- 8 files changed, 77 insertions(+), 64 deletions(-) diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 852c8751d5c..7472191a48a 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; + $commande->type=0; $nextval=$module->getNextValue($mysoc,$commande); if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval { diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 10ebb20ebb8..4e186d24db9 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -344,7 +344,7 @@ foreach ($dirmodels as $reldir) // Info $htmltooltip=''; $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
'; - $facture->type=0; + $propal->type=0; $nextval=$module->getNextValue($mysoc,$propal); if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e8dc3fbbe80..71cabf3f68d 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -84,49 +84,36 @@ class Conf */ function Conf() { - // 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(); - $this->syslog = (object) array(); - $this->browser = (object) array(); - $this->multicompany = (object) array(); - - $this->expedition_bon = (object) array(); - $this->livraison_bon = (object) array(); - $this->fournisseur = (object) array(); - $this->fournisseur->commande = (object) array(); - $this->fournisseur->facture = (object) array(); - $this->product = (object) array(); - $this->service = (object) array(); - $this->contrat = (object) array(); - $this->actions = (object) array(); - $this->commande = (object) array(); - $this->commande->client = (object) array(); - $this->commande->fournisseur = (object) array(); - $this->propal = (object) array(); - $this->propal->cloture = (object) array(); - $this->propal->facturation = (object) array(); - $this->facture = (object) array(); - $this->facture->client = (object) array(); - $this->facture->fournisseur = (object) array(); - $this->contrat = (object) array(); - $this->contrat->services = (object) array(); - $this->contrat->services->inactifs = (object) array(); - $this->contrat->services->expires = (object) array(); - $this->adherent = (object) array(); - $this->adherent->cotisation = (object) array(); - $this->bank = (object) array(); - $this->bank->rappro = (object) array(); - $this->bank->cheque = (object) array(); - $this->notification = (object) array(); - $this->mailing = (object) array(); - - //! Charset for HTML output and for storing data in memory - $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 + // 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(); + $this->syslog = (object) array(); + $this->browser = (object) array(); + $this->multicompany = (object) array(); + + // First level object + $this->expedition_bon = (object) array(); + $this->livraison_bon = (object) array(); + $this->fournisseur = (object) array(); + $this->product = (object) array(); + $this->service = (object) array(); + $this->contrat = (object) array(); + $this->actions = (object) array(); + $this->commande = (object) array(); + $this->propal = (object) array(); + $this->facture = (object) array(); + $this->contrat = (object) array(); + $this->adherent = (object) array(); + $this->bank = (object) array(); + $this->notification = (object) array(); + $this->mailing = (object) array(); + + //! Charset for HTML output and for storing data in memory + $this->file->character_set_client='UTF-8'; // UTF-8, ISO-8859-1 } @@ -225,6 +212,22 @@ class Conf } //var_dump($this->modules); //var_dump($this->modules_parts); + + // Second or others levels object + $this->propal->cloture = (object) array(); + $this->propal->facturation = (object) array(); + $this->commande->client = (object) array(); + $this->commande->fournisseur = (object) array(); + $this->facture->client = (object) array(); + $this->facture->fournisseur = (object) array(); + $this->fournisseur->commande = (object) array(); + $this->fournisseur->facture = (object) array(); + $this->contrat->services = (object) array(); + $this->contrat->services->inactifs = (object) array(); + $this->contrat->services->expires = (object) array(); + $this->adherent->cotisation = (object) array(); + $this->bank->rappro = (object) array(); + $this->bank->cheque = (object) array(); // Clean some variables if (empty($this->global->MAIN_MENU_STANDARD)) $this->global->MAIN_MENU_STANDARD="eldy_backoffice.php"; diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index 5baecd279bf..a70c1a8d97f 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -73,18 +73,20 @@ abstract class ModeleNumRefCommandes { var $error=''; - /** Return if a module can be used or not + /** + * Return if a module can be used or not * - * @return boolean true if module can be used + * @return boolean true if module can be used */ function isEnabled() { return true; } - /** Renvoie la description par defaut du modele de numerotation + /** + * Renvoie la description par defaut du modele de numerotation * - * @return string Texte descripif + * @return string Texte descripif */ function info() { @@ -93,9 +95,10 @@ abstract class ModeleNumRefCommandes return $langs->trans("NoDescription"); } - /** Renvoie un exemple de numerotation + /** + * Renvoie un exemple de numerotation * - * @return string Example + * @return string Example */ function getExample() { @@ -104,28 +107,33 @@ abstract class ModeleNumRefCommandes return $langs->trans("NoExample"); } - /** Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner. + /** + * Test si les numeros deja en vigueur dans la base ne provoquent pas de conflits qui empecheraient cette numerotation de fonctionner. * - * @return boolean false si conflit, true si ok + * @return boolean false si conflit, true si ok */ function canBeActivated() { return true; } - /** Renvoie prochaine valeur attribuee + /** + * Renvoie prochaine valeur attribuee * - * @return string Valeur + * @param Societe $objsoc Object thirdparty + * @param Object $object Object we need next value for + * @return string Valeur */ - function getNextValue() + function getNextValue($objsoc,$object) { global $langs; return $langs->trans("NotAvailable"); } - /** Renvoie version du module numerotation + /** + * Renvoie version du module numerotation * - * @return string Valeur + * @return string Valeur */ function getVersion() { diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index e30770cf9ce..31289342198 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2012 Regis Houssin * * 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 diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 5957640c76c..92ecc83cbd6 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -115,9 +115,11 @@ abstract class ModeleNumRefPropales /** * Renvoi prochaine valeur attribuee * - * @return string Valeur + * @param Societe $objsoc Object third party + * @param Propal $propal Object commercial proposal + * @return string Valeur */ - function getNextValue() + function getNextValue($objsoc,$propal) { global $langs; return $langs->trans("NotAvailable"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ff3b788f80b..fe16b356b00 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -885,7 +885,7 @@ class Product extends CommonObject * @param int $newnpr 0=Standard vat rate, 1=Special vat rate for French NPR VAT * @return int <0 if KO, >0 if OK */ - function update_price($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0) + function updatePrice($id, $newprice, $newpricebase, $user, $newvat='',$newminprice='', $level=0, $newnpr=0) { global $conf,$langs; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6e47c543265..f26346c14ce 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -84,7 +84,7 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit-> $newvat=str_replace('*','',$_POST["tva_tx"]); } - if ($object->update_price($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr) > 0) + if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr) > 0) { $action = ''; $mesg = '
'.$langs->trans("RecordSaved").'
'; @@ -446,7 +446,7 @@ if ($result) // Il doit au moins y avoir la ligne de prix initial. // On l'ajoute donc pour remettre a niveau (pb vieilles versions) - $object->update_price($object->id, $object->price, 'HT', $user, $newprice_min); + $object->updatePrice($object->id, $object->price, 'HT', $user, $newprice_min); $result = $db->query($sql); $num = $db->num_rows($result);