From 9b69ef27baaef201688c8df7d0b5eeba8040a97f Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 20 Sep 2011 16:56:53 +0000 Subject: [PATCH 01/85] Fix: sql error --- htdocs/fourn/class/fournisseur.facture.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index daf2e07364b..0d98c3ef5ed 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1206,7 +1206,7 @@ class FactureFournisseur extends Facture */ function initAsSpecimen() { - global $user,$langs,$conf; + global $langs,$conf; $now = dol_now(); @@ -1215,7 +1215,7 @@ class FactureFournisseur extends Facture $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."product"; - $sql.= " AND entity = ".$conf->entity; + $sql.= " WHERE entity = ".$conf->entity; $resql = $this->db->query($sql); if ($resql) From be6286c4b856dc3197515d87ea52aa95c399664c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 17:19:46 +0000 Subject: [PATCH 02/85] Qual: More POO. Qual: Doxygen --- htdocs/adherents/class/adherent.class.php | 15 +++++------ .../adherents/class/adherent_type.class.php | 5 +--- .../adherents/class/adherentstats.class.php | 3 +-- htdocs/adherents/class/cotisation.class.php | 9 +++---- htdocs/categories/class/categorie.class.php | 20 +++++++-------- htdocs/comm/action/class/actioncomm.class.php | 9 +++---- htdocs/comm/mailing/class/mailing.class.php | 6 ++--- htdocs/comm/propal/class/propal.class.php | 19 +++++++------- .../comm/propal/class/propalestats.class.php | 3 +-- htdocs/commande/class/commande.class.php | 25 ++++++++++--------- htdocs/commande/class/commandestats.class.php | 3 +-- htdocs/compta/bank/class/account.class.php | 12 +++++---- htdocs/compta/bank/class/bankcateg.class.php | 17 ++++++------- .../deplacement/class/deplacement.class.php | 12 ++++----- .../class/deplacementstats.class.php | 3 +-- htdocs/compta/dons/class/don.class.php | 13 +++++----- .../facture/class/facture-rec.class.php | 11 ++++---- htdocs/compta/facture/class/facture.class.php | 20 +++++++-------- .../facture/class/facturestats.class.php | 4 +-- .../facture/class/paymentterm.class.php | 13 +++++----- .../cheque/class/remisecheque.class.php | 6 ++--- .../compta/paiement/class/paiement.class.php | 6 ++--- .../sociales/class/chargesociales.class.php | 15 +++++------ .../class/paymentsocialcontribution.class.php | 14 +++++------ htdocs/compta/tva/class/tva.class.php | 16 ++++++------ htdocs/contact/class/contact.class.php | 14 +++++------ htdocs/contrat/class/contrat.class.php | 16 ++++++------ htdocs/core/class/discount.class.php | 9 ++++--- htdocs/core/class/events.class.php | 14 +++++------ htdocs/core/class/menubase.class.php | 7 ++++-- htdocs/core/class/stats.class.php | 17 +++++++++++-- htdocs/ecm/class/ecmdirectory.class.php | 14 +++++------ htdocs/expedition/class/expedition.class.php | 15 +++++------ htdocs/fichinter/class/fichinter.class.php | 16 ++++++------ .../class/fournisseur.commande.class.php | 21 ++++++++-------- .../fourn/class/fournisseur.facture.class.php | 21 ++++++++-------- htdocs/fourn/class/paiementfourn.class.php | 8 +++--- htdocs/livraison/class/livraison.class.php | 14 ++++++----- htdocs/product/class/product.class.php | 16 +++++------- htdocs/product/stock/class/entrepot.class.php | 6 ++--- htdocs/projet/class/project.class.php | 15 ++++++----- htdocs/projet/class/task.class.php | 12 ++++----- htdocs/societe/class/societe.class.php | 9 ++++--- htdocs/user/class/user.class.php | 17 +++++++------ htdocs/user/class/usergroup.class.php | 17 ++++++------- 45 files changed, 274 insertions(+), 283 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 44a4e37922a..2ac33a71796 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -38,12 +38,9 @@ require_once(DOL_DOCUMENT_ROOT."/lib/date.lib.php"); */ class Adherent extends CommonObject { - var $db; - var $error; - var $errors=array(); - var $element='member'; - var $table_element='adherent'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='member'; + public $table_element='adherent'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; var $ref; @@ -1938,7 +1935,11 @@ class Adherent extends CommonObject /** - * Initialise le membre avec valeurs fictives aleatoire + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index de78dcb5b3c..aa08f2cbbe3 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -33,10 +33,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class AdherentType extends CommonObject { - var $error; - var $errors=array(); - var $db; - var $table_element = 'adherent_type'; + public $table_element = 'adherent_type'; var $id; var $libelle; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 5ea122c80d3..24f2450dd19 100755 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/adherents/class/cotisation.class.php"; */ class AdherentStats extends Stats { - var $db; + public $table_element; var $socid; var $userid; - var $table_element; var $from; var $field; var $where; diff --git a/htdocs/adherents/class/cotisation.class.php b/htdocs/adherents/class/cotisation.class.php index 75c7749e465..0ac1523f6d5 100644 --- a/htdocs/adherents/class/cotisation.class.php +++ b/htdocs/adherents/class/cotisation.class.php @@ -31,13 +31,10 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class Cotisation extends CommonObject { - var $id; - var $db; - var $error; - var $errors; - var $element='subscription'; - var $table_element='cotisation'; + public $element='subscription'; + public $table_element='cotisation'; + var $id; var $datec; var $datem; var $dateh; // Subscription start date diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 6613ada6ae8..e1e68db7a58 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -36,11 +36,8 @@ require_once(DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php"); */ class Categorie { - var $error; - var $db; - - var $element='category'; - var $table_element='category'; + public $element='category'; + public $table_element='category'; var $id; var $id_mere; @@ -550,7 +547,7 @@ class Categorie /** * Retourne les filles de la categorie - * + * * @return void */ function get_filles() @@ -936,7 +933,7 @@ class Categorie /** * Retourne les chemin de la categorie, avec les noms des categories * separes par $sep (" >> " par defaut) - * + * * @param string $sep Separator * @param string $url Url * @return void @@ -1053,7 +1050,7 @@ class Categorie /** * Retourne dans un tableau tous les chemins possibles pour arriver a la categorie * en partant des categories principales, representes par des tableaux de categories - * + * * @return void */ function get_all_ways () @@ -1344,9 +1341,10 @@ class Categorie /** - * Initialise an example of instance with random values - * Used to build previews or test instances - * + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * * @return void */ function initAsSpecimen() diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 93f40c13a77..8b5658fcf93 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -32,12 +32,9 @@ require_once(DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'); */ class ActionComm extends CommonObject { - var $db; - var $error; - var $errors=array(); - var $element='action'; - var $table_element = 'actioncomm'; - var $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='action'; + public $table_element = 'actioncomm'; + protected $ismultientitymanaged = 2; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $type_id; var $type_code; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 5b27032918e..60fe869aa97 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Mailing extends CommonObject { - var $db; - var $error; - var $element='mailing'; - var $table_element='mailing'; + public $element='mailing'; + public $table_element='mailing'; var $id; var $statut; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 84b0d47377a..6adbc8f94d1 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -42,13 +42,11 @@ require_once(DOL_DOCUMENT_ROOT ."/contact/class/contact.class.php"); */ class Propal extends CommonObject { - var $db; - var $error; - var $element='propal'; - var $table_element='propal'; - var $table_element_line='propaldet'; - var $fk_element='fk_propal'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='propal'; + public $table_element='propal'; + public $table_element_line='propaldet'; + public $fk_element='fk_propal'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; @@ -2128,8 +2126,11 @@ class Propal extends CommonObject /** - * Initialise an example of instance with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index 018dff2c73c..b817c000646 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php"; */ class PropaleStats extends Stats { - var $db; + public $table_element; var $socid; var $userid; - var $table_element; var $from; var $field; var $where; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 09ae19b4991..409df18639f 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -35,16 +35,14 @@ require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); */ class Commande extends CommonObject { - var $db; - var $error; - var $element='commande'; - var $table_element='commande'; - var $table_element_line = 'commandedet'; - var $class_element_line = 'OrderLine'; - var $fk_element = 'fk_commande'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='commande'; + public $table_element='commande'; + public $table_element_line = 'commandedet'; + public $class_element_line = 'OrderLine'; + public $fk_element = 'fk_commande'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $id ; + var $id; var $socid; // Id client var $client; // Objet societe client (a charger par fetch_client) @@ -2325,7 +2323,7 @@ class Commande extends CommonObject dol_syslog("CustomerOrder::delete error", LOG_ERR); $err++; } - + // On efface le repertoire de pdf provisoire $comref = dol_sanitizeFileName($this->ref); if ($conf->commande->dir_output) @@ -2598,8 +2596,11 @@ class Commande extends CommonObject /** - * Initialise an example of instance with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index e30a2c645a8..294e3d52260 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -33,12 +33,11 @@ include_once DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php"; */ class CommandeStats extends Stats { - var $db ; + public $table_element; var $socid; var $userid; - var $table_element; var $from; var $field; var $where; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index d5d14e9e816..40362bb5f70 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -34,10 +34,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Account extends CommonObject { - var $db; - var $error; - var $element='bank_account'; - var $table_element='bank_account'; + public $element='bank_account'; + public $table_element='bank_account'; var $rowid; var $ref; @@ -987,7 +985,11 @@ class Account extends CommonObject } /** - * Initialize properties with test values + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/bank/class/bankcateg.class.php b/htdocs/compta/bank/class/bankcateg.class.php index 32b341c3276..061d7055637 100644 --- a/htdocs/compta/bank/class/bankcateg.class.php +++ b/htdocs/compta/bank/class/bankcateg.class.php @@ -36,14 +36,10 @@ */ class BankCateg // extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - //var $element='bank_categ'; //!< Id that identify managed objects - //var $table_element='bank_categ'; //!< Name of table without prefix where object is stored + //public $element='bank_categ'; //!< Id that identify managed objects + //public $table_element='bank_categ'; //!< Name of table without prefix where object is stored var $id; - var $label; @@ -345,16 +341,17 @@ class BankCateg // extends CommonObject /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { $this->id=0; $this->label=''; - - } } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index e2cbc28f14e..f7182869870 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -31,13 +31,11 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Deplacement extends CommonObject { - var $db; - var $error; - var $element='deplacement'; - var $table_element='deplacement'; - var $table_element_line = ''; - var $fk_element = ''; - var $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='deplacement'; + public $table_element='deplacement'; + public $table_element_line = ''; + public $fk_element = ''; + protected $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index 3e212918849..f6569ca10ae 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -31,12 +31,11 @@ include_once DOL_DOCUMENT_ROOT . "/compta/deplacement/class/deplacement.class.ph */ class DeplacementStats extends Stats { - var $db; + public $table_element; var $socid; var $userid; - var $table_element; var $from; var $field; var $where; diff --git a/htdocs/compta/dons/class/don.class.php b/htdocs/compta/dons/class/don.class.php index a714a650585..71ead3c64d1 100644 --- a/htdocs/compta/dons/class/don.class.php +++ b/htdocs/compta/dons/class/don.class.php @@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Don extends CommonObject { - var $db; - var $error; - var $element='don'; - var $table_element='don'; + public $element='don'; + public $table_element='don'; var $id; var $date; @@ -142,8 +140,11 @@ class Don extends CommonObject /** - * \brief Initialise le don avec valeurs fictives alaatoire - * Sert a generer un recu de don pour l'aperu des modeles ou demo + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 3535470dd90..f9baebbe540 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -35,13 +35,12 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); */ class FactureRec extends Facture { - var $db ; - var $element='facturerec'; - var $table_element='facture_rec'; - var $table_element_line='facturedet_rec'; - var $fk_element='fk_facture'; + public $element='facturerec'; + public $table_element='facture_rec'; + public $table_element_line='facturedet_rec'; + public $fk_element='fk_facture'; - var $id ; + var $id; //! Id customer var $socid; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 02874e46bdf..c65623d2cfe 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -40,14 +40,11 @@ require_once(DOL_DOCUMENT_ROOT ."/societe/class/client.class.php"); */ class Facture extends CommonObject { - var $db; - var $error; - var $errors=array(); - var $element='facture'; - var $table_element='facture'; - var $table_element_line = 'facturedet'; - var $fk_element = 'fk_facture'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='facture'; + public $table_element='facture'; + public $table_element_line = 'facturedet'; + public $fk_element = 'fk_facture'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; //! Id client @@ -3062,8 +3059,11 @@ class Facture extends CommonObject /** - * Initialise an example of invoice with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 136121faabd..c4fc13c00a5 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -33,12 +33,10 @@ include_once DOL_DOCUMENT_ROOT . "/lib/date.lib.php"; */ class FactureStats extends Stats { - var $db; - var $socid; var $userid; - var $table_element; + public $table_element; var $from; var $field; var $where; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index e8425698343..a2e74b9d1f1 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -33,8 +33,8 @@ class PaymentTerm // extends CommonObject var $db; //!< To store db handler var $error; //!< To return error code (or message) var $errors=array(); //!< To return several error codes (or messages) - //var $element='c_payment_term'; //!< Id that identify managed objects - //var $table_element='c_payment_term'; //!< Name of table without prefix where object is stored + //public $element='c_payment_term'; //!< Id that identify managed objects + //public $table_element='c_payment_term'; //!< Name of table without prefix where object is stored var $id; @@ -455,10 +455,11 @@ class PaymentTerm // extends CommonObject /** - * Initialise object with example values - * id must be 0 if object instance is a specimen - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 37151fa5302..e7890ec980a 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class RemiseCheque extends CommonObject { - var $db; - var $error; - var $element='chequereceipt'; - var $table_element='bordereau_cheque'; + public $element='chequereceipt'; + public $table_element='bordereau_cheque'; var $id; var $num; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 5f300710892..3c673da95d0 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -30,10 +30,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Paiement extends CommonObject { - var $db; - var $error; - var $element='payment'; - var $table_element='paiement'; + public $element='payment'; + public $table_element='paiement'; var $id; var $ref; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index d6590108419..fc6f468637a 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -31,11 +31,9 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class ChargeSociales extends CommonObject { - var $db; - var $error; - var $element='rowid'; - var $table='chargesociales'; - var $table_element='chargesociales'; + public $element='rowid'; + public $table='chargesociales'; + public $table_element='chargesociales'; var $id; var $date_ech; @@ -397,8 +395,11 @@ class ChargeSociales extends CommonObject } /** - * Initialise an example of social contribution with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index a344f8fb774..9e8c08c8e03 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class PaymentSocialContribution extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='paiementcharge'; //!< Id that identify managed objects - var $table_element='paiementcharge'; //!< Name of table without prefix where object is stored + public $element='paiementcharge'; //!< Id that identify managed objects + public $table_element='paiementcharge'; //!< Name of table without prefix where object is stored var $id; var $ref; @@ -428,8 +425,11 @@ class PaymentSocialContribution extends CommonObject /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a7915ae9d8a..13bd7a5d0f4 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -33,11 +33,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Tva extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - //var $element='tva'; //!< Id that identify managed objects - //var $table_element='tva'; //!< Name of table without prefix where object is stored + //public $element='tva'; //!< Id that identify managed objects + //public $table_element='tva'; //!< Name of table without prefix where object is stored var $id; var $ref; @@ -302,8 +299,11 @@ class Tva extends CommonObject /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { @@ -318,8 +318,6 @@ class Tva extends CommonObject $this->fk_bank=''; $this->fk_user_creat=''; $this->fk_user_modif=''; - - } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 112fdf22833..18e021b15be 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -34,10 +34,8 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Contact extends CommonObject { - var $db; - var $error; - var $element='contact'; - var $table_element='socpeople'; + public $element='contact'; + public $table_element='socpeople'; var $id; var $civilite_id; // In fact we stor civility_code @@ -999,9 +997,11 @@ class Contact extends CommonObject /** - * Initialise le contact avec valeurs fictives aleatoire - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4680d47cd51..cefaf94c63e 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -37,12 +37,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/price.lib.php"); */ class Contrat extends CommonObject { - var $db; - var $error; - var $element='contrat'; - var $table_element='contrat'; - var $table_element_line='contratdet'; - var $fk_element='fk_contrat'; + public $element='contrat'; + public $table_element='contrat'; + public $table_element_line='contratdet'; + public $fk_element='fk_contrat'; var $id; var $ref; @@ -1424,7 +1422,11 @@ class Contrat extends CommonObject /** - * \brief Initialise le membre avec valeurs fictives aleatoire + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index aa01c56bce8..093a227ced0 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -462,10 +462,11 @@ class DiscountAbsolute /** - * Initializes the intervention with random values - * Used to generate a intervention for the preview or demo models - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 4e1ec677cef..3cebdc74504 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -36,11 +36,8 @@ */ class Events // extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='events'; //!< Id that identify managed objects - var $table_element='events'; //!< Name of table without prefix where object is stored + public $element='events'; //!< Id that identify managed objects + public $table_element='events'; //!< Name of table without prefix where object is stored var $id; @@ -265,8 +262,11 @@ class Events // extends CommonObject /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 88698b61a6e..c2855b42514 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -328,8 +328,11 @@ class Menubase /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index c302b215d66..df1f7404e76 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -1,6 +1,6 @@ - * Copyright (c) 2008-2010 Laurent Destailleur + * Copyright (c) 2008-2011 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 @@ -28,8 +28,15 @@ */ abstract class Stats { - var $db ; + protected $db; + + /** + * Constructor + * + * @param DoliDB $DB Database handler + * @return Stats + */ function Stats($DB) { $this->db = $DB; @@ -37,6 +44,7 @@ abstract class Stats /** * Return nb of entity by month for several years + * * @param endyear Start year * @param startyear End year * @return array Array of values @@ -110,6 +118,7 @@ abstract class Stats /** * Return nb of elements by year + * * @param sql SQL request * @return array */ @@ -139,6 +148,7 @@ abstract class Stats /** * Return nb of elements, total amount and avg amount by year + * * @param sql SQL request * @return array */ @@ -171,6 +181,7 @@ abstract class Stats /** * Renvoie le nombre de proposition par mois pour une annee donnee + * * @param year Year * @param sql SQL */ @@ -218,6 +229,7 @@ abstract class Stats /** * Renvoie le nombre d'element par mois pour une annee donnee + * * @param year Year * @param sql SQL */ @@ -262,6 +274,7 @@ abstract class Stats /** * Renvoie le montant moyen par mois pour une annee donnee + * * @param year Year * @param sql SQL */ diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 0e2fd4e7259..ac8429d0c0d 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -30,11 +30,8 @@ */ class EcmDirectory // extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - //var $element='ecm_directories'; //!< Id that identify managed objects - //var $table_element='ecm_directories'; //!< Name of table without prefix where object is stored + //public $element='ecm_directories'; //!< Id that identify managed objects + //public $table_element='ecm_directories'; //!< Name of table without prefix where object is stored var $id; @@ -377,8 +374,11 @@ class EcmDirectory // extends CommonObject /** - * \brief Initialise object with example values - * \remarks id must be 0 if object instance is a specimen. + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8b267a173ed..036040ed06d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -36,11 +36,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co */ class Expedition extends CommonObject { - var $db; - var $error; - var $element="shipping"; - var $fk_element="fk_expedition"; - var $table_element="expedition"; + public $element="shipping"; + public $fk_element="fk_expedition"; + public $table_element="expedition"; var $id; var $socid; @@ -973,8 +971,11 @@ class Expedition extends CommonObject } /** - * \brief Initialise la facture avec valeurs fictives aleatoire - * Sert a generer une facture pour l'aperu des modeles ou dem + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index b1b8ad1ebce..6d240bfb31d 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -32,11 +32,10 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Fichinter extends CommonObject { - var $db; - var $element='fichinter'; - var $table_element='fichinter'; - var $fk_element='fk_fichinter'; - var $table_element_line='fichinterdet'; + public $element='fichinter'; + public $table_element='fichinter'; + public $fk_element='fk_fichinter'; + public $table_element_line='fichinterdet'; var $id; @@ -751,8 +750,11 @@ class Fichinter extends CommonObject /** - * Initializes the intervention with random values - * Used to generate a intervention for the preview or demo models + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index c82680ce46b..7ee68dd62e2 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -36,15 +36,11 @@ require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); */ class CommandeFournisseur extends Commande { - var $id ; - var $db ; - var $error; - - var $element='order_supplier'; - var $table_element='commande_fournisseur'; - var $table_element_line = 'commande_fournisseurdet'; - var $fk_element = 'fk_commande'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='order_supplier'; + public $table_element='commande_fournisseur'; + public $table_element_line = 'commande_fournisseurdet'; + public $fk_element = 'fk_commande'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $ref; // TODO deprecated var $product_ref; @@ -1666,8 +1662,11 @@ class CommandeFournisseur extends Commande /** - * Initialise an example of instance with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 0d98c3ef5ed..1f529dcedc4 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -35,15 +35,11 @@ include_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"); */ class FactureFournisseur extends Facture { - var $id; - var $db; - var $error; - - var $element='invoice_supplier'; - var $table_element='facture_fourn'; - var $table_element_line='facture_fourn_det'; - var $fk_element='fk_facture_fourn'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='invoice_supplier'; + public $table_element='facture_fourn'; + public $table_element_line='facture_fourn_det'; + public $fk_element='fk_facture_fourn'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $ref; // TODO deprecated var $product_ref; @@ -1201,8 +1197,11 @@ class FactureFournisseur extends Facture /** - * Initialise an example of instance with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index 066073f953a..ec97237457f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -32,10 +32,8 @@ require_once(DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'); */ class PaiementFourn extends Paiement { - var $db; - var $error; - var $element='payment_supplier'; - var $table_element='paiementfourn'; + public $element='payment_supplier'; + public $table_element='paiementfourn'; var $id; var $ref; @@ -188,7 +186,7 @@ class PaiementFourn extends Paiement dol_syslog('Paiement::Create Erreur INSERT dans paiement_facture '.$facid); $error++; } - + } else { diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 8ec3d0c9a1d..97c3a72d4b2 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -37,11 +37,9 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/class/co */ class Livraison extends CommonObject { - var $db; - var $error; - var $element="delivery"; - var $fk_element="fk_livraison"; - var $table_element="livraison"; + public $element="delivery"; + public $fk_element="fk_livraison"; + public $table_element="livraison"; var $id; var $brouillon; @@ -713,7 +711,11 @@ class Livraison extends CommonObject /** - * \brief Initialise object with default value to be used as example + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c6b2f1f3f91..ec4cc4b49aa 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -34,16 +34,12 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class Product extends CommonObject { - var $db; - var $error; - var $errno = 0; - - var $element='product'; - var $table_element='product'; - var $fk_element='fk_product'; - var $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur'); - var $isnolinkedbythird = 1; // No field fk_soc - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='product'; + public $table_element='product'; + public $fk_element='fk_product'; + public $childtables=array('propaldet','commandedet','facturedet','contratdet','product_fournisseur'); + protected $isnolinkedbythird = 1; // No field fk_soc + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe //! Identifiant unique var $id ; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 0492718625d..5046fb47e28 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -33,10 +33,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); class Entrepot extends CommonObject { - var $db; - var $error; - var $element='label'; - var $table_element='entrepot'; + public $element='label'; + public $table_element='entrepot'; var $id; var $libelle; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 1f63031869e..b12edb2fb37 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -30,11 +30,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class Project extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='project'; //!< Id that identify managed objects - var $table_element='projet'; //!< Name of table without prefix where object is stored + public $element='project'; //!< Id that identify managed objects + public $table_element='projet'; //!< Name of table without prefix where object is stored var $id; var $ref; @@ -666,9 +663,11 @@ class Project extends CommonObject } /** - * Initialise object with default value to be used as example - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 82b9631c852..462edcb1f25 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -32,11 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); */ class Task extends CommonObject { - var $db; //!< To store db handler - var $error; //!< To return error code (or message) - var $errors=array(); //!< To return several error codes (or messages) - var $element='project_task'; //!< Id that identify managed objects - var $table_element='projet_task'; //!< Name of table without prefix where object is stored + public $element='project_task'; //!< Id that identify managed objects + public $table_element='projet_task'; //!< Name of table without prefix where object is stored var $id; @@ -437,10 +434,11 @@ class Task extends CommonObject } /** - * Initialise object with example values + * Initialise an instance with random values. + * Used to build previews or test instances. * id must be 0 if object instance is a specimen. * - * @return void + * @return void */ function initAsSpecimen() { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 3551c72537a..c85f5bb1e46 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1341,7 +1341,7 @@ class Societe extends CommonObject if ($this->id) { $now=dol_now(); - + $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; $sql .= " SET price_level = '".$price_level."'"; $sql .= " WHERE rowid = " . $this->id; @@ -2481,8 +2481,11 @@ class Societe extends CommonObject /** - * Initialise an example of company with random values - * Used to build previews or test instances + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 1ffc4000316..a67d5ed69bd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -36,12 +36,9 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php"); */ class User extends CommonObject { - var $db; - var $error; - var $errors=array(); - var $element='user'; - var $table_element='user'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='user'; + public $table_element='user'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id=0; var $ldap_sid; @@ -1231,7 +1228,7 @@ class User extends CommonObject { global $conf, $langs; require_once(DOL_DOCUMENT_ROOT ."/lib/security.lib.php"); - + $error=0; dol_syslog("User::setPassword user=".$user->id." password=".preg_replace('/./i','*',$password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG); @@ -1871,7 +1868,11 @@ class User extends CommonObject /** - * Initialize user with default values + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index cf2faaaa451..fcc6b9c667b 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -33,12 +33,9 @@ if ($conf->ldap->enabled) require_once (DOL_DOCUMENT_ROOT."/lib/ldap.class.php") */ class UserGroup extends CommonObject { - var $db; // Database handler - var $error; - var $errors=array(); - var $element='usergroup'; - var $table_element='usergroup'; - var $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element='usergroup'; + public $table_element='usergroup'; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $id; // Group id var $entity; // Entity of group @@ -679,9 +676,11 @@ class UserGroup extends CommonObject /** - * Initialise le groupe avec valeurs fictives aleatoire - * - * @return void + * Initialise an instance with random values. + * Used to build previews or test instances. + * id must be 0 if object instance is a specimen. + * + * @return void */ function initAsSpecimen() { From 9efd2fcf459b39ab09dc03756112aea5316b3db9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 17:34:15 +0000 Subject: [PATCH 03/85] Qual: More POO. Qual: Doxygen --- htdocs/user/class/user.class.php | 202 +++++++++++++++++-------------- 1 file changed, 110 insertions(+), 92 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a67d5ed69bd..e4aa3962323 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -116,11 +116,11 @@ class User extends CommonObject /** * Load a user from database with its id or ref (login) * - * @param id Si defini, id a utiliser pour recherche - * @param login Si defini, login a utiliser pour recherche - * @param sid Si defini, sid a utiliser pour recherche - * @param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) - * @return int <0 if KO, 0 not found, >0 if OK + * @param int $id Si defini, id a utiliser pour recherche + * @param string $login Si defini, login a utiliser pour recherche + * @param strinf $sid Si defini, sid a utiliser pour recherche + * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) + * @return int <0 if KO, 0 not found, >0 if OK */ function fetch($id='', $login='',$sid='',$loadpersonalconf=1) { @@ -267,12 +267,12 @@ class User extends CommonObject } /** - * Ajoute un droit a l'utilisateur + * Ajoute un droit a l'utilisateur * - * @param rid id du droit a ajouter - * @param allmodule Ajouter tous les droits du module allmodule - * @param allperms Ajouter tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param int $rid id du droit a ajouter + * @param string $allmodule Ajouter tous les droits du module allmodule + * @param string $allperms Ajouter tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function addrights($rid,$allmodule='',$allperms='') { @@ -366,12 +366,12 @@ class User extends CommonObject /** - * Retire un droit a l'utilisateur + * Retire un droit a l'utilisateur * - * @param rid id du droit a retirer - * @param allmodule Retirer tous les droits du module allmodule - * @param allperms Retirer tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param int $rid Id du droit a retirer + * @param string $allmodule Retirer tous les droits du module allmodule + * @param string $allperms Retirer tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function delrights($rid,$allmodule='',$allperms='') { @@ -462,7 +462,9 @@ class User extends CommonObject /** - * Clear all permissions array of user + * Clear all permissions array of user + * + * @return void */ function clearrights() { @@ -476,7 +478,8 @@ class User extends CommonObject /** * Load permissions granted to user into object user * - * @param moduletag Limit permission for a particular module ('' by default means load all permissions) + * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) + * @return void */ function getrights($moduletag='') { @@ -597,9 +600,10 @@ class User extends CommonObject } /** - * Change status of a user + * Change status of a user * - * @return int <0 if KO, 0 if nothing is done, >0 if OK + * @param int $statut Status to set + * @return int <0 if KO, 0 if nothing is done, >0 if OK */ function setstatus($statut) { @@ -706,9 +710,9 @@ class User extends CommonObject /** * Create a user into database * - * @param user Objet user qui demande la creation - * @param notrigger 1 ne declenche pas les triggers, 0 sinon - * @return int <0 si KO, id compte cree si OK + * @param User $user Objet user qui demande la creation + * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon + * @return int <0 si KO, id compte cree si OK */ function create($user,$notrigger=0) { @@ -832,12 +836,12 @@ class User extends CommonObject /** - * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external + * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * - * @param contact Object for source contact - * @param login Login to force - * @param password Password to force - * @return int <0 if error, if OK returns id of created user + * @param Contact $contact Object for source contact + * @param string $login Login to force + * @param string $password Password to force + * @return int <0 if error, if OK returns id of created user */ function create_from_contact($contact,$login='',$password='') { @@ -900,11 +904,11 @@ class User extends CommonObject } /** - * Create a user into database from a member object + * Create a user into database from a member object * - * @param member Object member source - * @param login Login to force - * @return int <0 if KO, if OK, return id of created account + * @param Adherent $member Object member source + * @param string $login Login to force + * @return int <0 if KO, if OK, return id of created account */ function create_from_member($member,$login='') { @@ -1005,11 +1009,11 @@ class User extends CommonObject /** * Update a user into databse (and also password if this->pass is defined) * - * @param user User qui fait la mise a jour - * @param notrigger 1 ne declenche pas les triggers, 0 sinon - * @param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member - * @param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member - * @return int <0 si KO, >=0 si OK + * @param User $user User qui fait la mise a jour + * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon + * @param int $nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member + * @param int $nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member + * @return int <0 si KO, >=0 si OK */ function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0) { @@ -1198,7 +1202,7 @@ class User extends CommonObject $sql.= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion $sql.= " WHERE rowid = ".$this->id; - dol_syslog ("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); + dol_syslog("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1217,12 +1221,12 @@ class User extends CommonObject /** * Change password of a user * - * @param user Object user of user making change - * @param password New password in clear text (to generate if not provided) - * @param changelater 1=Change password only after clicking on confirm email - * @param notrigger 1=Does not launch triggers - * @param nosyncmember Do not synchronize linked member - * @return string If OK return clear password, 0 if no change, < 0 if error + * @param User $user Object user of user making change + * @param string $password New password in clear text (to generate if not provided) + * @param int $changelater 1=Change password only after clicking on confirm email + * @param int $notrigger 1=Does not launch triggers + * @param int $nosyncmember Do not synchronize linked member + * @return string If OK return clear password, 0 if no change, < 0 if error */ function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0) { @@ -1344,12 +1348,12 @@ class User extends CommonObject /** - * Envoie mot de passe par mail + * Envoie mot de passe par mail * - * @param user Object user de l'utilisateur qui fait l'envoi - * @param password Nouveau mot de passe - * @param changelater 1=Change password only after clicking on confirm email - * @return int < 0 si erreur, > 0 si ok + * @param User $user Object user de l'utilisateur qui fait l'envoi + * @param string $password Nouveau mot de passe + * @param int $changelater 1=Change password only after clicking on confirm email + * @return int < 0 si erreur, > 0 si ok */ function send_password($user, $password='', $changelater=0) { @@ -1411,8 +1415,19 @@ class User extends CommonObject $mesg.= "If you didn't ask anything, just forget this email\n\n"; dol_syslog("User::send_password url=".$url); } - $mailfile = new CMailFile($subject,$this->email,$conf->notification->email_from,$mesg, - array(),array(),array(),'', '', 0, $msgishtml); + $mailfile = new CMailFile( + $subject, + $this->email, + $conf->notification->email_from, + $mesg, + array(), + array(), + array(), + '', + '', + 0, + $msgishtml + ); if ($mailfile->sendfile()) { @@ -1473,7 +1488,9 @@ class User extends CommonObject } /** - * Update clicktodial info + * Update clicktodial info + * + * @return void */ function update_clicktodial() { @@ -1508,12 +1525,12 @@ class User extends CommonObject /** - * Add user into a group + * Add user into a group * - * @param group Id of group - * @param entity Entity - * @param notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param Group $group Id of group + * @param int $entity Entity + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function SetInGroup($group, $entity, $notrigger=0) { @@ -1569,12 +1586,12 @@ class User extends CommonObject } /** - * Remove a user from a group + * Remove a user from a group * - * @param group Id of group - * @param entity Entity - * @param notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param Group $group Id of group + * @param int $entity Entity + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function RemoveFromGroup($group, $entity, $notrigger=0) { @@ -1625,12 +1642,12 @@ class User extends CommonObject } /** - * Return a link to the user card (with optionnaly the picto) - * Use this->id,this->nom, this->prenom + * Return a link to the user card (with optionnaly the picto) + * Use this->id,this->nom, this->prenom * - * @param withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) - * @param option On what the link point to - * @return string String with URL + * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) + * @param string $option On what the link point to + * @return string String with URL */ function getNomUrl($withpicto=0,$option='') { @@ -1654,11 +1671,11 @@ class User extends CommonObject } /** - * Renvoie login clicable (avec eventuellement le picto) + * Renvoie login clicable (avec eventuellement le picto) * - * @param withpicto Inclut le picto dans le lien - * @param option Sur quoi pointe le lien - * @return string Chaine avec URL + * @param int $withpicto Inclut le picto dans le lien + * @param string $option Sur quoi pointe le lien + * @return string Chaine avec URL */ function getLoginUrl($withpicto=0,$option='') { @@ -1681,12 +1698,12 @@ class User extends CommonObject } /** - * Return full name (civility+' '+name+' '+lastname) + * Return full name (civility+' '+name+' '+lastname) * - * @param langs Language object for translation of civility - * @param option 0=No option, 1=Add civility - * @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname - * @return string String with full name + * @param Translate $langs Language object for translation of civility + * @param int $option 0=No option, 1=Add civility + * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname + * @return string String with full name */ function getFullName($langs,$option=0,$nameorder=-1) { @@ -1720,10 +1737,10 @@ class User extends CommonObject /** - * Retourne le libelle du statut d'un user (actif, inactif) + * Retourne le libelle du statut d'un user (actif, inactif) * - * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long - * @return string Label of status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @return string Label of status */ function getLibStatut($mode=0) { @@ -1731,11 +1748,11 @@ class User extends CommonObject } /** - * Renvoi le libelle d'un statut donne + * Renvoi le libelle d'un statut donne * - * @param statut Id statut - * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ function LibStatut($statut,$mode=0) { @@ -1779,11 +1796,11 @@ class User extends CommonObject /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * - * @param info Info string loaded by _load_ldap_info - * @param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) - * 1= - * 2=Return key only (uid=qqq) - * @return string DN + * @param string $info Info string loaded by _load_ldap_info + * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) + * 1= + * 2=Return key only (uid=qqq) + * @return string DN */ function _load_ldap_dn($info,$mode=0) { @@ -1905,9 +1922,10 @@ class User extends CommonObject } /** - * Load info of user object + * Load info of user object * - * @param id id of user to load + * @param int $id Id of user to load + * @return void */ function info($id) { @@ -1969,10 +1987,10 @@ class User extends CommonObject } /** - * Return number of existing users + * Return number of existing users * - * @param limitTo limit to 'active' or 'superadmin' users - * @return int Number of users + * @param string $limitTo Limit to 'active' or 'superadmin' users + * @return int Number of users */ function getNbOfUsers($limitTo='') { From 43c2bfb54963099cfc5b3c36c9a7b815a50f35f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 18:19:04 +0000 Subject: [PATCH 04/85] Qual: Removed false warnings --- dev/codesniffer/ruleset.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/codesniffer/ruleset.xml b/dev/codesniffer/ruleset.xml index a1c5265ff55..0a88c6d6d98 100755 --- a/dev/codesniffer/ruleset.xml +++ b/dev/codesniffer/ruleset.xml @@ -8,7 +8,7 @@ - 0 + 0 From 889a263cdc631a219dbb38b23c97a8353eb1a63a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 18:27:35 +0000 Subject: [PATCH 05/85] Qual: Removed errors --- htdocs/core/class/menubase.class.php | 79 +++++++++++++++------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index c2855b42514..156067a0b23 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -58,9 +58,9 @@ class Menubase /** * Constructor * - * @param DoliDB $DB Database handler - * @param string $menu_handler - * @param string $type + * @param DoliDB $DB Database handler + * @param string $menu_handler Menu handler + * @param string $type Type */ function Menubase($DB,$menu_handler='',$type='') { @@ -167,10 +167,11 @@ class Menubase } /** - * Update menu entry into database - * @param user User that modify - * @param notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK + * Update menu entry into database. + * + * @param User $user User that modify + * @param int $notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -302,10 +303,11 @@ class Menubase } - /* - * \brief Delete object in database - * \param user User that delete - * \return int <0 if KO, >0 if OK + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK */ function delete($user) { @@ -358,12 +360,13 @@ class Menubase /** - * Complete this->newmenu with menu entry found in $tab + * Complete this->newmenu with menu entry found in $tab * - * @param $tab - * @param $pere - * @param $rang - * @param $myleftmenu Value for left that defined leftmenu + * @param array $tab Tab array + * @param int $pere Id of parent + * @param int $rang Rang + * @param string $myleftmenu Value for left that defined leftmenu + * @return void */ function recur($tab, $pere, $rang, $myleftmenu) { @@ -400,12 +403,14 @@ class Menubase } /** - * Load tabMenu array - * @param type_user 0=Internal,1=External,2=All - * @param mainmenu Value for mainmenu that defined top menu - * @param menu_handler Name of menu_handler used (auguria, eldy...) - * @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Return array with menu entries for top menu + * Load tabMenu array + * + * @param string $mainmenu Value for mainmenu that defined top menu + * @param string $myleftmenu Left menu name + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Return array with menu entries for top menu */ function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -449,14 +454,15 @@ class Menubase } /** - * Load entries found in database in a menu array - * @param $newmenu Menu array to complete - * @param $mainmenu Value for mainmenu that defined top menu of left menu - * @param $myleftmenu Value that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Menu array for particular mainmenu value or full tabArray + * Load entries found in database in a menu array. + * + * @param array $newmenu Menu array to complete + * @param string $mainmenu Value for mainmenu that defined top menu of left menu + * @param string $myleftmenu Value that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -496,12 +502,13 @@ class Menubase /** - * Load entries found in database in a menu array - * @param $myleftmenu Value for left that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) - * @return int >0 if OK, <0 if KO + * Load entries found in database in a menu array. + * + * @param string $myleftmenu Value for left that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) + * @return int >0 if OK, <0 if KO */ function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) { From 4aa089806687773f91ff798386fe38403f1bca1c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 17:19:46 +0000 Subject: [PATCH 06/85] Qual: More POO. Qual: Doxygen --- htdocs/core/class/menubase.class.php | 79 +++++------ htdocs/user/class/user.class.php | 202 ++++++++++++--------------- 2 files changed, 128 insertions(+), 153 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 156067a0b23..c2855b42514 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -58,9 +58,9 @@ class Menubase /** * Constructor * - * @param DoliDB $DB Database handler - * @param string $menu_handler Menu handler - * @param string $type Type + * @param DoliDB $DB Database handler + * @param string $menu_handler + * @param string $type */ function Menubase($DB,$menu_handler='',$type='') { @@ -167,11 +167,10 @@ class Menubase } /** - * Update menu entry into database. - * - * @param User $user User that modify - * @param int $notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK + * Update menu entry into database + * @param user User that modify + * @param notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -303,11 +302,10 @@ class Menubase } - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK + /* + * \brief Delete object in database + * \param user User that delete + * \return int <0 if KO, >0 if OK */ function delete($user) { @@ -360,13 +358,12 @@ class Menubase /** - * Complete this->newmenu with menu entry found in $tab + * Complete this->newmenu with menu entry found in $tab * - * @param array $tab Tab array - * @param int $pere Id of parent - * @param int $rang Rang - * @param string $myleftmenu Value for left that defined leftmenu - * @return void + * @param $tab + * @param $pere + * @param $rang + * @param $myleftmenu Value for left that defined leftmenu */ function recur($tab, $pere, $rang, $myleftmenu) { @@ -403,14 +400,12 @@ class Menubase } /** - * Load tabMenu array - * - * @param string $mainmenu Value for mainmenu that defined top menu - * @param string $myleftmenu Left menu name - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Return array with menu entries for top menu + * Load tabMenu array + * @param type_user 0=Internal,1=External,2=All + * @param mainmenu Value for mainmenu that defined top menu + * @param menu_handler Name of menu_handler used (auguria, eldy...) + * @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Return array with menu entries for top menu */ function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -454,15 +449,14 @@ class Menubase } /** - * Load entries found in database in a menu array. - * - * @param array $newmenu Menu array to complete - * @param string $mainmenu Value for mainmenu that defined top menu of left menu - * @param string $myleftmenu Value that defined leftmenu - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Menu array for particular mainmenu value or full tabArray + * Load entries found in database in a menu array + * @param $newmenu Menu array to complete + * @param $mainmenu Value for mainmenu that defined top menu of left menu + * @param $myleftmenu Value that defined leftmenu + * @param $type_user 0=Internal,1=External,2=All + * @param $menu_handler Name of menu_handler used (auguria, eldy...) + * @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -502,13 +496,12 @@ class Menubase /** - * Load entries found in database in a menu array. - * - * @param string $myleftmenu Value for left that defined leftmenu - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) - * @return int >0 if OK, <0 if KO + * Load entries found in database in a menu array + * @param $myleftmenu Value for left that defined leftmenu + * @param $type_user 0=Internal,1=External,2=All + * @param $menu_handler Name of menu_handler used (auguria, eldy...) + * @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) + * @return int >0 if OK, <0 if KO */ function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e4aa3962323..a67d5ed69bd 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -116,11 +116,11 @@ class User extends CommonObject /** * Load a user from database with its id or ref (login) * - * @param int $id Si defini, id a utiliser pour recherche - * @param string $login Si defini, login a utiliser pour recherche - * @param strinf $sid Si defini, sid a utiliser pour recherche - * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) - * @return int <0 if KO, 0 not found, >0 if OK + * @param id Si defini, id a utiliser pour recherche + * @param login Si defini, login a utiliser pour recherche + * @param sid Si defini, sid a utiliser pour recherche + * @param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) + * @return int <0 if KO, 0 not found, >0 if OK */ function fetch($id='', $login='',$sid='',$loadpersonalconf=1) { @@ -267,12 +267,12 @@ class User extends CommonObject } /** - * Ajoute un droit a l'utilisateur + * Ajoute un droit a l'utilisateur * - * @param int $rid id du droit a ajouter - * @param string $allmodule Ajouter tous les droits du module allmodule - * @param string $allperms Ajouter tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param rid id du droit a ajouter + * @param allmodule Ajouter tous les droits du module allmodule + * @param allperms Ajouter tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function addrights($rid,$allmodule='',$allperms='') { @@ -366,12 +366,12 @@ class User extends CommonObject /** - * Retire un droit a l'utilisateur + * Retire un droit a l'utilisateur * - * @param int $rid Id du droit a retirer - * @param string $allmodule Retirer tous les droits du module allmodule - * @param string $allperms Retirer tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param rid id du droit a retirer + * @param allmodule Retirer tous les droits du module allmodule + * @param allperms Retirer tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function delrights($rid,$allmodule='',$allperms='') { @@ -462,9 +462,7 @@ class User extends CommonObject /** - * Clear all permissions array of user - * - * @return void + * Clear all permissions array of user */ function clearrights() { @@ -478,8 +476,7 @@ class User extends CommonObject /** * Load permissions granted to user into object user * - * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) - * @return void + * @param moduletag Limit permission for a particular module ('' by default means load all permissions) */ function getrights($moduletag='') { @@ -600,10 +597,9 @@ class User extends CommonObject } /** - * Change status of a user + * Change status of a user * - * @param int $statut Status to set - * @return int <0 if KO, 0 if nothing is done, >0 if OK + * @return int <0 if KO, 0 if nothing is done, >0 if OK */ function setstatus($statut) { @@ -710,9 +706,9 @@ class User extends CommonObject /** * Create a user into database * - * @param User $user Objet user qui demande la creation - * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon - * @return int <0 si KO, id compte cree si OK + * @param user Objet user qui demande la creation + * @param notrigger 1 ne declenche pas les triggers, 0 sinon + * @return int <0 si KO, id compte cree si OK */ function create($user,$notrigger=0) { @@ -836,12 +832,12 @@ class User extends CommonObject /** - * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external + * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * - * @param Contact $contact Object for source contact - * @param string $login Login to force - * @param string $password Password to force - * @return int <0 if error, if OK returns id of created user + * @param contact Object for source contact + * @param login Login to force + * @param password Password to force + * @return int <0 if error, if OK returns id of created user */ function create_from_contact($contact,$login='',$password='') { @@ -904,11 +900,11 @@ class User extends CommonObject } /** - * Create a user into database from a member object + * Create a user into database from a member object * - * @param Adherent $member Object member source - * @param string $login Login to force - * @return int <0 if KO, if OK, return id of created account + * @param member Object member source + * @param login Login to force + * @return int <0 if KO, if OK, return id of created account */ function create_from_member($member,$login='') { @@ -1009,11 +1005,11 @@ class User extends CommonObject /** * Update a user into databse (and also password if this->pass is defined) * - * @param User $user User qui fait la mise a jour - * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon - * @param int $nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member - * @param int $nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member - * @return int <0 si KO, >=0 si OK + * @param user User qui fait la mise a jour + * @param notrigger 1 ne declenche pas les triggers, 0 sinon + * @param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member + * @param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member + * @return int <0 si KO, >=0 si OK */ function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0) { @@ -1202,7 +1198,7 @@ class User extends CommonObject $sql.= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion $sql.= " WHERE rowid = ".$this->id; - dol_syslog("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); + dol_syslog ("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1221,12 +1217,12 @@ class User extends CommonObject /** * Change password of a user * - * @param User $user Object user of user making change - * @param string $password New password in clear text (to generate if not provided) - * @param int $changelater 1=Change password only after clicking on confirm email - * @param int $notrigger 1=Does not launch triggers - * @param int $nosyncmember Do not synchronize linked member - * @return string If OK return clear password, 0 if no change, < 0 if error + * @param user Object user of user making change + * @param password New password in clear text (to generate if not provided) + * @param changelater 1=Change password only after clicking on confirm email + * @param notrigger 1=Does not launch triggers + * @param nosyncmember Do not synchronize linked member + * @return string If OK return clear password, 0 if no change, < 0 if error */ function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0) { @@ -1348,12 +1344,12 @@ class User extends CommonObject /** - * Envoie mot de passe par mail + * Envoie mot de passe par mail * - * @param User $user Object user de l'utilisateur qui fait l'envoi - * @param string $password Nouveau mot de passe - * @param int $changelater 1=Change password only after clicking on confirm email - * @return int < 0 si erreur, > 0 si ok + * @param user Object user de l'utilisateur qui fait l'envoi + * @param password Nouveau mot de passe + * @param changelater 1=Change password only after clicking on confirm email + * @return int < 0 si erreur, > 0 si ok */ function send_password($user, $password='', $changelater=0) { @@ -1415,19 +1411,8 @@ class User extends CommonObject $mesg.= "If you didn't ask anything, just forget this email\n\n"; dol_syslog("User::send_password url=".$url); } - $mailfile = new CMailFile( - $subject, - $this->email, - $conf->notification->email_from, - $mesg, - array(), - array(), - array(), - '', - '', - 0, - $msgishtml - ); + $mailfile = new CMailFile($subject,$this->email,$conf->notification->email_from,$mesg, + array(),array(),array(),'', '', 0, $msgishtml); if ($mailfile->sendfile()) { @@ -1488,9 +1473,7 @@ class User extends CommonObject } /** - * Update clicktodial info - * - * @return void + * Update clicktodial info */ function update_clicktodial() { @@ -1525,12 +1508,12 @@ class User extends CommonObject /** - * Add user into a group + * Add user into a group * - * @param Group $group Id of group - * @param int $entity Entity - * @param int $notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param group Id of group + * @param entity Entity + * @param notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function SetInGroup($group, $entity, $notrigger=0) { @@ -1586,12 +1569,12 @@ class User extends CommonObject } /** - * Remove a user from a group + * Remove a user from a group * - * @param Group $group Id of group - * @param int $entity Entity - * @param int $notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param group Id of group + * @param entity Entity + * @param notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function RemoveFromGroup($group, $entity, $notrigger=0) { @@ -1642,12 +1625,12 @@ class User extends CommonObject } /** - * Return a link to the user card (with optionnaly the picto) - * Use this->id,this->nom, this->prenom + * Return a link to the user card (with optionnaly the picto) + * Use this->id,this->nom, this->prenom * - * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) - * @param string $option On what the link point to - * @return string String with URL + * @param withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) + * @param option On what the link point to + * @return string String with URL */ function getNomUrl($withpicto=0,$option='') { @@ -1671,11 +1654,11 @@ class User extends CommonObject } /** - * Renvoie login clicable (avec eventuellement le picto) + * Renvoie login clicable (avec eventuellement le picto) * - * @param int $withpicto Inclut le picto dans le lien - * @param string $option Sur quoi pointe le lien - * @return string Chaine avec URL + * @param withpicto Inclut le picto dans le lien + * @param option Sur quoi pointe le lien + * @return string Chaine avec URL */ function getLoginUrl($withpicto=0,$option='') { @@ -1698,12 +1681,12 @@ class User extends CommonObject } /** - * Return full name (civility+' '+name+' '+lastname) + * Return full name (civility+' '+name+' '+lastname) * - * @param Translate $langs Language object for translation of civility - * @param int $option 0=No option, 1=Add civility - * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname - * @return string String with full name + * @param langs Language object for translation of civility + * @param option 0=No option, 1=Add civility + * @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname + * @return string String with full name */ function getFullName($langs,$option=0,$nameorder=-1) { @@ -1737,10 +1720,10 @@ class User extends CommonObject /** - * Retourne le libelle du statut d'un user (actif, inactif) + * Retourne le libelle du statut d'un user (actif, inactif) * - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long - * @return string Label of status + * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @return string Label of status */ function getLibStatut($mode=0) { @@ -1748,11 +1731,11 @@ class User extends CommonObject } /** - * Renvoi le libelle d'un statut donne + * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut - * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param statut Id statut + * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ function LibStatut($statut,$mode=0) { @@ -1796,11 +1779,11 @@ class User extends CommonObject /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * - * @param string $info Info string loaded by _load_ldap_info - * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) - * 1= - * 2=Return key only (uid=qqq) - * @return string DN + * @param info Info string loaded by _load_ldap_info + * @param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) + * 1= + * 2=Return key only (uid=qqq) + * @return string DN */ function _load_ldap_dn($info,$mode=0) { @@ -1922,10 +1905,9 @@ class User extends CommonObject } /** - * Load info of user object + * Load info of user object * - * @param int $id Id of user to load - * @return void + * @param id id of user to load */ function info($id) { @@ -1987,10 +1969,10 @@ class User extends CommonObject } /** - * Return number of existing users + * Return number of existing users * - * @param string $limitTo Limit to 'active' or 'superadmin' users - * @return int Number of users + * @param limitTo limit to 'active' or 'superadmin' users + * @return int Number of users */ function getNbOfUsers($limitTo='') { From e11ca0f95a4a3f2d9713f7caf7b1a758cede8434 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:07:29 +0000 Subject: [PATCH 07/85] Qual: Reduce cyclomatic complexity --- htdocs/core/class/menubase.class.php | 79 +++++----- htdocs/imports/class/import.class.php | 153 ++++++++++--------- htdocs/user/class/user.class.php | 202 ++++++++++++++------------ 3 files changed, 226 insertions(+), 208 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index c2855b42514..156067a0b23 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -58,9 +58,9 @@ class Menubase /** * Constructor * - * @param DoliDB $DB Database handler - * @param string $menu_handler - * @param string $type + * @param DoliDB $DB Database handler + * @param string $menu_handler Menu handler + * @param string $type Type */ function Menubase($DB,$menu_handler='',$type='') { @@ -167,10 +167,11 @@ class Menubase } /** - * Update menu entry into database - * @param user User that modify - * @param notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK + * Update menu entry into database. + * + * @param User $user User that modify + * @param int $notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -302,10 +303,11 @@ class Menubase } - /* - * \brief Delete object in database - * \param user User that delete - * \return int <0 if KO, >0 if OK + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK */ function delete($user) { @@ -358,12 +360,13 @@ class Menubase /** - * Complete this->newmenu with menu entry found in $tab + * Complete this->newmenu with menu entry found in $tab * - * @param $tab - * @param $pere - * @param $rang - * @param $myleftmenu Value for left that defined leftmenu + * @param array $tab Tab array + * @param int $pere Id of parent + * @param int $rang Rang + * @param string $myleftmenu Value for left that defined leftmenu + * @return void */ function recur($tab, $pere, $rang, $myleftmenu) { @@ -400,12 +403,14 @@ class Menubase } /** - * Load tabMenu array - * @param type_user 0=Internal,1=External,2=All - * @param mainmenu Value for mainmenu that defined top menu - * @param menu_handler Name of menu_handler used (auguria, eldy...) - * @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Return array with menu entries for top menu + * Load tabMenu array + * + * @param string $mainmenu Value for mainmenu that defined top menu + * @param string $myleftmenu Left menu name + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Return array with menu entries for top menu */ function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -449,14 +454,15 @@ class Menubase } /** - * Load entries found in database in a menu array - * @param $newmenu Menu array to complete - * @param $mainmenu Value for mainmenu that defined top menu of left menu - * @param $myleftmenu Value that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Menu array for particular mainmenu value or full tabArray + * Load entries found in database in a menu array. + * + * @param array $newmenu Menu array to complete + * @param string $mainmenu Value for mainmenu that defined top menu of left menu + * @param string $myleftmenu Value that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -496,12 +502,13 @@ class Menubase /** - * Load entries found in database in a menu array - * @param $myleftmenu Value for left that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) - * @return int >0 if OK, <0 if KO + * Load entries found in database in a menu array. + * + * @param string $myleftmenu Value for left that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) + * @return int >0 if OK, <0 if KO */ function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) { diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index c6a835fedb5..1676ba73de1 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -73,99 +73,92 @@ class Import $dir = $dirroot.'/includes/modules'; // Search available exports - $handle=@opendir($dir); - if (is_resource($handle)) + $handle=@opendir(dol_osencode($dir)); + if (! is_resource($handle)) continue; + + // Search module files + while (($file = readdir($handle))!==false) { - // Search module files - while (($file = readdir($handle))!==false) + if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue; + + $modulename=$reg[1]; + + // Defined if module is enabled + $enabled=true; + $part=strtolower(preg_replace('/^mod/i','',$modulename)); + if (empty($conf->$part->enabled)) $enabled=false; + + if (empty($enabled)) continue; + + // Init load class + $file = $dir."/".$modulename.".class.php"; + $classname = $modulename; + require_once($file); + $module = new $classname($this->db); + + if (is_array($module->import_code)) { - if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) + foreach($module->import_code as $r => $value) { - $modulename=$reg[1]; + if ($filter && ($filter != $module->import_code[$r])) continue; - // Defined if module is enabled - $enabled=true; - $part=strtolower(preg_replace('/^mod/i','',$modulename)); - if (empty($conf->$part->enabled)) $enabled=false; - - if ($enabled) + // Test if permissions are ok + /*$perm=$module->import_permission[$r][0]; + //print_r("$perm[0]-$perm[1]-$perm[2]
"); + if ($perm[2]) { - // Chargement de la classe - $file = $dir."/".$modulename.".class.php"; - $classname = $modulename; - require_once($file); - $module = new $classname($this->db); + $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + } + else + { + $bool=$user->rights->$perm[0]->$perm[1]; + } + if ($perm[0]=='user' && $user->admin) $bool=true; + //print $bool." $perm[0]"."
"; + */ - if (is_array($module->import_code)) + // Load lang file + $langtoload=$module->getLangFilesArray(); + if (is_array($langtoload)) + { + foreach($langtoload as $key) { - foreach($module->import_code as $r => $value) - { - if ($filter && ($filter != $module->import_code[$r])) continue; - - // Test if permissions are ok - /*$perm=$module->import_permission[$r][0]; - //print_r("$perm[0]-$perm[1]-$perm[2]
"); - if ($perm[2]) - { - $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; - } - else - { - $bool=$user->rights->$perm[0]->$perm[1]; - } - if ($perm[0]=='user' && $user->admin) $bool=true; - //print $bool." $perm[0]"."
"; - */ - - // Permissions ok - // if ($bool) - // { - // Charge fichier lang en rapport - $langtoload=$module->getLangFilesArray(); - if (is_array($langtoload)) - { - foreach($langtoload as $key) - { - $langs->load($key); - } - } - - // Module - $this->array_import_module[$i]=$module; - // Permission - $this->array_import_perms[$i]=$user->rights->import->run; - // Icon - $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); - // Code du dataset export - $this->array_import_code[$i]=$module->import_code[$r]; - // Libelle du dataset export - $this->array_import_label[$i]=$module->getImportDatasetLabel($r); - // Array of tables to import (key=alias, value=tablename) - $this->array_import_tables[$i]=$module->import_tables_array[$r]; - // Array of tables creator field to import (key=alias, value=creator field) - $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; - // Array of fiels to import (key=field, value=label) - $this->array_import_fields[$i]=$module->import_fields_array[$r]; - // Tableau des entites a exporter (cle=champ, valeur=entite) - $this->array_import_entities[$i]=$module->import_entities_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=alias) - $this->array_import_regex[$i]=$module->import_regex_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=exemple) - $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; - // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) - $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; - - dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); - $i++; - // } - } + $langs->load($key); } } + + // Module + $this->array_import_module[$i]=$module; + // Permission + $this->array_import_perms[$i]=$user->rights->import->run; + // Icon + $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); + // Code du dataset export + $this->array_import_code[$i]=$module->import_code[$r]; + // Libelle du dataset export + $this->array_import_label[$i]=$module->getImportDatasetLabel($r); + // Array of tables to import (key=alias, value=tablename) + $this->array_import_tables[$i]=$module->import_tables_array[$r]; + // Array of tables creator field to import (key=alias, value=creator field) + $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; + // Array of fiels to import (key=field, value=label) + $this->array_import_fields[$i]=$module->import_fields_array[$r]; + // Tableau des entites a exporter (cle=champ, valeur=entite) + $this->array_import_entities[$i]=$module->import_entities_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=alias) + $this->array_import_regex[$i]=$module->import_regex_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=exemple) + $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; + // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) + $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; + + dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); + $i++; } } } + closedir($handle); } - closedir($handle); return 1; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index a67d5ed69bd..e4aa3962323 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -116,11 +116,11 @@ class User extends CommonObject /** * Load a user from database with its id or ref (login) * - * @param id Si defini, id a utiliser pour recherche - * @param login Si defini, login a utiliser pour recherche - * @param sid Si defini, sid a utiliser pour recherche - * @param $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) - * @return int <0 if KO, 0 not found, >0 if OK + * @param int $id Si defini, id a utiliser pour recherche + * @param string $login Si defini, login a utiliser pour recherche + * @param strinf $sid Si defini, sid a utiliser pour recherche + * @param int $loadpersonalconf Also load personal conf of user (in $user->conf->xxx) + * @return int <0 if KO, 0 not found, >0 if OK */ function fetch($id='', $login='',$sid='',$loadpersonalconf=1) { @@ -267,12 +267,12 @@ class User extends CommonObject } /** - * Ajoute un droit a l'utilisateur + * Ajoute un droit a l'utilisateur * - * @param rid id du droit a ajouter - * @param allmodule Ajouter tous les droits du module allmodule - * @param allperms Ajouter tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param int $rid id du droit a ajouter + * @param string $allmodule Ajouter tous les droits du module allmodule + * @param string $allperms Ajouter tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function addrights($rid,$allmodule='',$allperms='') { @@ -366,12 +366,12 @@ class User extends CommonObject /** - * Retire un droit a l'utilisateur + * Retire un droit a l'utilisateur * - * @param rid id du droit a retirer - * @param allmodule Retirer tous les droits du module allmodule - * @param allperms Retirer tous les droits du module allmodule, perms allperms - * @return int > 0 si ok, < 0 si erreur + * @param int $rid Id du droit a retirer + * @param string $allmodule Retirer tous les droits du module allmodule + * @param string $allperms Retirer tous les droits du module allmodule, perms allperms + * @return int > 0 si ok, < 0 si erreur */ function delrights($rid,$allmodule='',$allperms='') { @@ -462,7 +462,9 @@ class User extends CommonObject /** - * Clear all permissions array of user + * Clear all permissions array of user + * + * @return void */ function clearrights() { @@ -476,7 +478,8 @@ class User extends CommonObject /** * Load permissions granted to user into object user * - * @param moduletag Limit permission for a particular module ('' by default means load all permissions) + * @param string $moduletag Limit permission for a particular module ('' by default means load all permissions) + * @return void */ function getrights($moduletag='') { @@ -597,9 +600,10 @@ class User extends CommonObject } /** - * Change status of a user + * Change status of a user * - * @return int <0 if KO, 0 if nothing is done, >0 if OK + * @param int $statut Status to set + * @return int <0 if KO, 0 if nothing is done, >0 if OK */ function setstatus($statut) { @@ -706,9 +710,9 @@ class User extends CommonObject /** * Create a user into database * - * @param user Objet user qui demande la creation - * @param notrigger 1 ne declenche pas les triggers, 0 sinon - * @return int <0 si KO, id compte cree si OK + * @param User $user Objet user qui demande la creation + * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon + * @return int <0 si KO, id compte cree si OK */ function create($user,$notrigger=0) { @@ -832,12 +836,12 @@ class User extends CommonObject /** - * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external + * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * - * @param contact Object for source contact - * @param login Login to force - * @param password Password to force - * @return int <0 if error, if OK returns id of created user + * @param Contact $contact Object for source contact + * @param string $login Login to force + * @param string $password Password to force + * @return int <0 if error, if OK returns id of created user */ function create_from_contact($contact,$login='',$password='') { @@ -900,11 +904,11 @@ class User extends CommonObject } /** - * Create a user into database from a member object + * Create a user into database from a member object * - * @param member Object member source - * @param login Login to force - * @return int <0 if KO, if OK, return id of created account + * @param Adherent $member Object member source + * @param string $login Login to force + * @return int <0 if KO, if OK, return id of created account */ function create_from_member($member,$login='') { @@ -1005,11 +1009,11 @@ class User extends CommonObject /** * Update a user into databse (and also password if this->pass is defined) * - * @param user User qui fait la mise a jour - * @param notrigger 1 ne declenche pas les triggers, 0 sinon - * @param nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member - * @param nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member - * @return int <0 si KO, >=0 si OK + * @param User $user User qui fait la mise a jour + * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon + * @param int $nosyncmember 0=Synchronize linked member (standard info), 1=Do not synchronize linked member + * @param int $nosyncmemberpass 0=Synchronize linked member (password), 1=Do not synchronize linked member + * @return int <0 si KO, >=0 si OK */ function update($user,$notrigger=0,$nosyncmember=0,$nosyncmemberpass=0) { @@ -1198,7 +1202,7 @@ class User extends CommonObject $sql.= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion $sql.= " WHERE rowid = ".$this->id; - dol_syslog ("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); + dol_syslog("Update last login date for user->id=".$this->id." ".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -1217,12 +1221,12 @@ class User extends CommonObject /** * Change password of a user * - * @param user Object user of user making change - * @param password New password in clear text (to generate if not provided) - * @param changelater 1=Change password only after clicking on confirm email - * @param notrigger 1=Does not launch triggers - * @param nosyncmember Do not synchronize linked member - * @return string If OK return clear password, 0 if no change, < 0 if error + * @param User $user Object user of user making change + * @param string $password New password in clear text (to generate if not provided) + * @param int $changelater 1=Change password only after clicking on confirm email + * @param int $notrigger 1=Does not launch triggers + * @param int $nosyncmember Do not synchronize linked member + * @return string If OK return clear password, 0 if no change, < 0 if error */ function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0) { @@ -1344,12 +1348,12 @@ class User extends CommonObject /** - * Envoie mot de passe par mail + * Envoie mot de passe par mail * - * @param user Object user de l'utilisateur qui fait l'envoi - * @param password Nouveau mot de passe - * @param changelater 1=Change password only after clicking on confirm email - * @return int < 0 si erreur, > 0 si ok + * @param User $user Object user de l'utilisateur qui fait l'envoi + * @param string $password Nouveau mot de passe + * @param int $changelater 1=Change password only after clicking on confirm email + * @return int < 0 si erreur, > 0 si ok */ function send_password($user, $password='', $changelater=0) { @@ -1411,8 +1415,19 @@ class User extends CommonObject $mesg.= "If you didn't ask anything, just forget this email\n\n"; dol_syslog("User::send_password url=".$url); } - $mailfile = new CMailFile($subject,$this->email,$conf->notification->email_from,$mesg, - array(),array(),array(),'', '', 0, $msgishtml); + $mailfile = new CMailFile( + $subject, + $this->email, + $conf->notification->email_from, + $mesg, + array(), + array(), + array(), + '', + '', + 0, + $msgishtml + ); if ($mailfile->sendfile()) { @@ -1473,7 +1488,9 @@ class User extends CommonObject } /** - * Update clicktodial info + * Update clicktodial info + * + * @return void */ function update_clicktodial() { @@ -1508,12 +1525,12 @@ class User extends CommonObject /** - * Add user into a group + * Add user into a group * - * @param group Id of group - * @param entity Entity - * @param notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param Group $group Id of group + * @param int $entity Entity + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function SetInGroup($group, $entity, $notrigger=0) { @@ -1569,12 +1586,12 @@ class User extends CommonObject } /** - * Remove a user from a group + * Remove a user from a group * - * @param group Id of group - * @param entity Entity - * @param notrigger Disable triggers - * @return int <0 if KO, >0 if OK + * @param Group $group Id of group + * @param int $entity Entity + * @param int $notrigger Disable triggers + * @return int <0 if KO, >0 if OK */ function RemoveFromGroup($group, $entity, $notrigger=0) { @@ -1625,12 +1642,12 @@ class User extends CommonObject } /** - * Return a link to the user card (with optionnaly the picto) - * Use this->id,this->nom, this->prenom + * Return a link to the user card (with optionnaly the picto) + * Use this->id,this->nom, this->prenom * - * @param withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) - * @param option On what the link point to - * @return string String with URL + * @param int $withpicto Include picto in link (0=No picto, 1=Inclut le picto dans le lien, 2=Picto seul) + * @param string $option On what the link point to + * @return string String with URL */ function getNomUrl($withpicto=0,$option='') { @@ -1654,11 +1671,11 @@ class User extends CommonObject } /** - * Renvoie login clicable (avec eventuellement le picto) + * Renvoie login clicable (avec eventuellement le picto) * - * @param withpicto Inclut le picto dans le lien - * @param option Sur quoi pointe le lien - * @return string Chaine avec URL + * @param int $withpicto Inclut le picto dans le lien + * @param string $option Sur quoi pointe le lien + * @return string Chaine avec URL */ function getLoginUrl($withpicto=0,$option='') { @@ -1681,12 +1698,12 @@ class User extends CommonObject } /** - * Return full name (civility+' '+name+' '+lastname) + * Return full name (civility+' '+name+' '+lastname) * - * @param langs Language object for translation of civility - * @param option 0=No option, 1=Add civility - * @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname - * @return string String with full name + * @param Translate $langs Language object for translation of civility + * @param int $option 0=No option, 1=Add civility + * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname + * @return string String with full name */ function getFullName($langs,$option=0,$nameorder=-1) { @@ -1720,10 +1737,10 @@ class User extends CommonObject /** - * Retourne le libelle du statut d'un user (actif, inactif) + * Retourne le libelle du statut d'un user (actif, inactif) * - * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long - * @return string Label of status + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long + * @return string Label of status */ function getLibStatut($mode=0) { @@ -1731,11 +1748,11 @@ class User extends CommonObject } /** - * Renvoi le libelle d'un statut donne + * Renvoi le libelle d'un statut donne * - * @param statut Id statut - * @param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto - * @return string Label of status + * @param int $statut Id statut + * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto + * @return string Label of status */ function LibStatut($statut,$mode=0) { @@ -1779,11 +1796,11 @@ class User extends CommonObject /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * - * @param info Info string loaded by _load_ldap_info - * @param mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) - * 1= - * 2=Return key only (uid=qqq) - * @return string DN + * @param string $info Info string loaded by _load_ldap_info + * @param int $mode 0=Return full DN (uid=qqq,ou=xxx,dc=aaa,dc=bbb) + * 1= + * 2=Return key only (uid=qqq) + * @return string DN */ function _load_ldap_dn($info,$mode=0) { @@ -1905,9 +1922,10 @@ class User extends CommonObject } /** - * Load info of user object + * Load info of user object * - * @param id id of user to load + * @param int $id Id of user to load + * @return void */ function info($id) { @@ -1969,10 +1987,10 @@ class User extends CommonObject } /** - * Return number of existing users + * Return number of existing users * - * @param limitTo limit to 'active' or 'superadmin' users - * @return int Number of users + * @param string $limitTo Limit to 'active' or 'superadmin' users + * @return int Number of users */ function getNbOfUsers($limitTo='') { From 70521b63ee5411d5a7d7284e0f75e63b64f42384 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 17:34:15 +0000 Subject: [PATCH 08/85] Qual: More POO. Qual: Doxygen --- htdocs/core/class/menubase.class.php | 79 ++++++------- htdocs/imports/class/import.class.php | 153 ++++++++++++++------------ 2 files changed, 116 insertions(+), 116 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index 156067a0b23..c2855b42514 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -58,9 +58,9 @@ class Menubase /** * Constructor * - * @param DoliDB $DB Database handler - * @param string $menu_handler Menu handler - * @param string $type Type + * @param DoliDB $DB Database handler + * @param string $menu_handler + * @param string $type */ function Menubase($DB,$menu_handler='',$type='') { @@ -167,11 +167,10 @@ class Menubase } /** - * Update menu entry into database. - * - * @param User $user User that modify - * @param int $notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK + * Update menu entry into database + * @param user User that modify + * @param notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -303,11 +302,10 @@ class Menubase } - /** - * Delete object in database - * - * @param User $user User that delete - * @return int <0 if KO, >0 if OK + /* + * \brief Delete object in database + * \param user User that delete + * \return int <0 if KO, >0 if OK */ function delete($user) { @@ -360,13 +358,12 @@ class Menubase /** - * Complete this->newmenu with menu entry found in $tab + * Complete this->newmenu with menu entry found in $tab * - * @param array $tab Tab array - * @param int $pere Id of parent - * @param int $rang Rang - * @param string $myleftmenu Value for left that defined leftmenu - * @return void + * @param $tab + * @param $pere + * @param $rang + * @param $myleftmenu Value for left that defined leftmenu */ function recur($tab, $pere, $rang, $myleftmenu) { @@ -403,14 +400,12 @@ class Menubase } /** - * Load tabMenu array - * - * @param string $mainmenu Value for mainmenu that defined top menu - * @param string $myleftmenu Left menu name - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Return array with menu entries for top menu + * Load tabMenu array + * @param type_user 0=Internal,1=External,2=All + * @param mainmenu Value for mainmenu that defined top menu + * @param menu_handler Name of menu_handler used (auguria, eldy...) + * @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Return array with menu entries for top menu */ function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -454,15 +449,14 @@ class Menubase } /** - * Load entries found in database in a menu array. - * - * @param array $newmenu Menu array to complete - * @param string $mainmenu Value for mainmenu that defined top menu of left menu - * @param string $myleftmenu Value that defined leftmenu - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Menu array for particular mainmenu value or full tabArray + * Load entries found in database in a menu array + * @param $newmenu Menu array to complete + * @param $mainmenu Value for mainmenu that defined top menu of left menu + * @param $myleftmenu Value that defined leftmenu + * @param $type_user 0=Internal,1=External,2=All + * @param $menu_handler Name of menu_handler used (auguria, eldy...) + * @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -502,13 +496,12 @@ class Menubase /** - * Load entries found in database in a menu array. - * - * @param string $myleftmenu Value for left that defined leftmenu - * @param int $type_user 0=Internal,1=External,2=All - * @param string $menu_handler Name of menu_handler used (auguria, eldy...) - * @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) - * @return int >0 if OK, <0 if KO + * Load entries found in database in a menu array + * @param $myleftmenu Value for left that defined leftmenu + * @param $type_user 0=Internal,1=External,2=All + * @param $menu_handler Name of menu_handler used (auguria, eldy...) + * @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) + * @return int >0 if OK, <0 if KO */ function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) { diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 1676ba73de1..c6a835fedb5 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -73,92 +73,99 @@ class Import $dir = $dirroot.'/includes/modules'; // Search available exports - $handle=@opendir(dol_osencode($dir)); - if (! is_resource($handle)) continue; - - // Search module files - while (($file = readdir($handle))!==false) + $handle=@opendir($dir); + if (is_resource($handle)) { - if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue; - - $modulename=$reg[1]; - - // Defined if module is enabled - $enabled=true; - $part=strtolower(preg_replace('/^mod/i','',$modulename)); - if (empty($conf->$part->enabled)) $enabled=false; - - if (empty($enabled)) continue; - - // Init load class - $file = $dir."/".$modulename.".class.php"; - $classname = $modulename; - require_once($file); - $module = new $classname($this->db); - - if (is_array($module->import_code)) + // Search module files + while (($file = readdir($handle))!==false) { - foreach($module->import_code as $r => $value) + if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) { - if ($filter && ($filter != $module->import_code[$r])) continue; + $modulename=$reg[1]; - // Test if permissions are ok - /*$perm=$module->import_permission[$r][0]; - //print_r("$perm[0]-$perm[1]-$perm[2]
"); - if ($perm[2]) - { - $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; - } - else - { - $bool=$user->rights->$perm[0]->$perm[1]; - } - if ($perm[0]=='user' && $user->admin) $bool=true; - //print $bool." $perm[0]"."
"; - */ + // Defined if module is enabled + $enabled=true; + $part=strtolower(preg_replace('/^mod/i','',$modulename)); + if (empty($conf->$part->enabled)) $enabled=false; - // Load lang file - $langtoload=$module->getLangFilesArray(); - if (is_array($langtoload)) + if ($enabled) { - foreach($langtoload as $key) + // Chargement de la classe + $file = $dir."/".$modulename.".class.php"; + $classname = $modulename; + require_once($file); + $module = new $classname($this->db); + + if (is_array($module->import_code)) { - $langs->load($key); + foreach($module->import_code as $r => $value) + { + if ($filter && ($filter != $module->import_code[$r])) continue; + + // Test if permissions are ok + /*$perm=$module->import_permission[$r][0]; + //print_r("$perm[0]-$perm[1]-$perm[2]
"); + if ($perm[2]) + { + $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + } + else + { + $bool=$user->rights->$perm[0]->$perm[1]; + } + if ($perm[0]=='user' && $user->admin) $bool=true; + //print $bool." $perm[0]"."
"; + */ + + // Permissions ok + // if ($bool) + // { + // Charge fichier lang en rapport + $langtoload=$module->getLangFilesArray(); + if (is_array($langtoload)) + { + foreach($langtoload as $key) + { + $langs->load($key); + } + } + + // Module + $this->array_import_module[$i]=$module; + // Permission + $this->array_import_perms[$i]=$user->rights->import->run; + // Icon + $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); + // Code du dataset export + $this->array_import_code[$i]=$module->import_code[$r]; + // Libelle du dataset export + $this->array_import_label[$i]=$module->getImportDatasetLabel($r); + // Array of tables to import (key=alias, value=tablename) + $this->array_import_tables[$i]=$module->import_tables_array[$r]; + // Array of tables creator field to import (key=alias, value=creator field) + $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; + // Array of fiels to import (key=field, value=label) + $this->array_import_fields[$i]=$module->import_fields_array[$r]; + // Tableau des entites a exporter (cle=champ, valeur=entite) + $this->array_import_entities[$i]=$module->import_entities_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=alias) + $this->array_import_regex[$i]=$module->import_regex_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=exemple) + $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; + // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) + $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; + + dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); + $i++; + // } + } } } - - // Module - $this->array_import_module[$i]=$module; - // Permission - $this->array_import_perms[$i]=$user->rights->import->run; - // Icon - $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); - // Code du dataset export - $this->array_import_code[$i]=$module->import_code[$r]; - // Libelle du dataset export - $this->array_import_label[$i]=$module->getImportDatasetLabel($r); - // Array of tables to import (key=alias, value=tablename) - $this->array_import_tables[$i]=$module->import_tables_array[$r]; - // Array of tables creator field to import (key=alias, value=creator field) - $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; - // Array of fiels to import (key=field, value=label) - $this->array_import_fields[$i]=$module->import_fields_array[$r]; - // Tableau des entites a exporter (cle=champ, valeur=entite) - $this->array_import_entities[$i]=$module->import_entities_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=alias) - $this->array_import_regex[$i]=$module->import_regex_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=exemple) - $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; - // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) - $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; - - dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); - $i++; } } } - closedir($handle); } + closedir($handle); return 1; } From 2f706c7400c3ec964118918ccf2152f5facd6ed0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 18:19:04 +0000 Subject: [PATCH 09/85] Qual: Removed false warnings From 72ed513091b154d5f6236218dd0fa93796a52d74 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 18:27:35 +0000 Subject: [PATCH 10/85] Qual: Removed errors --- htdocs/core/class/menubase.class.php | 79 +++++++++++++++------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index c2855b42514..156067a0b23 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -58,9 +58,9 @@ class Menubase /** * Constructor * - * @param DoliDB $DB Database handler - * @param string $menu_handler - * @param string $type + * @param DoliDB $DB Database handler + * @param string $menu_handler Menu handler + * @param string $type Type */ function Menubase($DB,$menu_handler='',$type='') { @@ -167,10 +167,11 @@ class Menubase } /** - * Update menu entry into database - * @param user User that modify - * @param notrigger 0=no, 1=yes (no update trigger) - * @return int <0 if KO, >0 if OK + * Update menu entry into database. + * + * @param User $user User that modify + * @param int $notrigger 0=no, 1=yes (no update trigger) + * @return int <0 if KO, >0 if OK */ function update($user=0, $notrigger=0) { @@ -302,10 +303,11 @@ class Menubase } - /* - * \brief Delete object in database - * \param user User that delete - * \return int <0 if KO, >0 if OK + /** + * Delete object in database + * + * @param User $user User that delete + * @return int <0 if KO, >0 if OK */ function delete($user) { @@ -358,12 +360,13 @@ class Menubase /** - * Complete this->newmenu with menu entry found in $tab + * Complete this->newmenu with menu entry found in $tab * - * @param $tab - * @param $pere - * @param $rang - * @param $myleftmenu Value for left that defined leftmenu + * @param array $tab Tab array + * @param int $pere Id of parent + * @param int $rang Rang + * @param string $myleftmenu Value for left that defined leftmenu + * @return void */ function recur($tab, $pere, $rang, $myleftmenu) { @@ -400,12 +403,14 @@ class Menubase } /** - * Load tabMenu array - * @param type_user 0=Internal,1=External,2=All - * @param mainmenu Value for mainmenu that defined top menu - * @param menu_handler Name of menu_handler used (auguria, eldy...) - * @param tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Return array with menu entries for top menu + * Load tabMenu array + * + * @param string $mainmenu Value for mainmenu that defined top menu + * @param string $myleftmenu Left menu name + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Return array with menu entries for top menu */ function menuTopCharger($mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -449,14 +454,15 @@ class Menubase } /** - * Load entries found in database in a menu array - * @param $newmenu Menu array to complete - * @param $mainmenu Value for mainmenu that defined top menu of left menu - * @param $myleftmenu Value that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) - * @return array Menu array for particular mainmenu value or full tabArray + * Load entries found in database in a menu array. + * + * @param array $newmenu Menu array to complete + * @param string $mainmenu Value for mainmenu that defined top menu of left menu + * @param string $myleftmenu Value that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty) + * @return array Menu array for particular mainmenu value or full tabArray */ function menuLeftCharger($newmenu, $mainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu=null) { @@ -496,12 +502,13 @@ class Menubase /** - * Load entries found in database in a menu array - * @param $myleftmenu Value for left that defined leftmenu - * @param $type_user 0=Internal,1=External,2=All - * @param $menu_handler Name of menu_handler used (auguria, eldy...) - * @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) - * @return int >0 if OK, <0 if KO + * Load entries found in database in a menu array. + * + * @param string $myleftmenu Value for left that defined leftmenu + * @param int $type_user 0=Internal,1=External,2=All + * @param string $menu_handler Name of menu_handler used (auguria, eldy...) + * @param array &$tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty) + * @return int >0 if OK, <0 if KO */ function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array()) { From e20038708c6704c6fcfec492e62552c30c6b394e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:21:04 +0000 Subject: [PATCH 11/85] Qual: Removed warnings --- htdocs/imports/class/import.class.php | 168 ++++++++++++-------------- htdocs/imports/emptyexample.php | 2 +- htdocs/societe/notify/fiche.php | 8 +- 3 files changed, 83 insertions(+), 95 deletions(-) diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index c6a835fedb5..af0ae64074a 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -62,7 +62,7 @@ class Import { global $langs,$conf; - dol_syslog("Import::load_arrays user=".$user->id." filter=".$filter); + dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); $var=true; $i=0; @@ -73,99 +73,92 @@ class Import $dir = $dirroot.'/includes/modules'; // Search available exports - $handle=@opendir($dir); - if (is_resource($handle)) + $handle=@opendir(dol_osencode($dir)); + if (! is_resource($handle)) continue; + + // Search module files + while (($file = readdir($handle))!==false) { - // Search module files - while (($file = readdir($handle))!==false) + if (! preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) continue; + + $modulename=$reg[1]; + + // Defined if module is enabled + $enabled=true; + $part=strtolower(preg_replace('/^mod/i','',$modulename)); + if (empty($conf->$part->enabled)) $enabled=false; + + if (empty($enabled)) continue; + + // Init load class + $file = $dir."/".$modulename.".class.php"; + $classname = $modulename; + require_once($file); + $module = new $classname($this->db); + + if (is_array($module->import_code)) { - if (preg_match("/^(mod.*)\.class\.php/i",$file,$reg)) + foreach($module->import_code as $r => $value) { - $modulename=$reg[1]; + if ($filter && ($filter != $module->import_code[$r])) continue; - // Defined if module is enabled - $enabled=true; - $part=strtolower(preg_replace('/^mod/i','',$modulename)); - if (empty($conf->$part->enabled)) $enabled=false; - - if ($enabled) + // Test if permissions are ok + /*$perm=$module->import_permission[$r][0]; + //print_r("$perm[0]-$perm[1]-$perm[2]
"); + if ($perm[2]) { - // Chargement de la classe - $file = $dir."/".$modulename.".class.php"; - $classname = $modulename; - require_once($file); - $module = new $classname($this->db); + $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; + } + else + { + $bool=$user->rights->$perm[0]->$perm[1]; + } + if ($perm[0]=='user' && $user->admin) $bool=true; + //print $bool." $perm[0]"."
"; + */ - if (is_array($module->import_code)) + // Load lang file + $langtoload=$module->getLangFilesArray(); + if (is_array($langtoload)) + { + foreach($langtoload as $key) { - foreach($module->import_code as $r => $value) - { - if ($filter && ($filter != $module->import_code[$r])) continue; - - // Test if permissions are ok - /*$perm=$module->import_permission[$r][0]; - //print_r("$perm[0]-$perm[1]-$perm[2]
"); - if ($perm[2]) - { - $bool=$user->rights->$perm[0]->$perm[1]->$perm[2]; - } - else - { - $bool=$user->rights->$perm[0]->$perm[1]; - } - if ($perm[0]=='user' && $user->admin) $bool=true; - //print $bool." $perm[0]"."
"; - */ - - // Permissions ok - // if ($bool) - // { - // Charge fichier lang en rapport - $langtoload=$module->getLangFilesArray(); - if (is_array($langtoload)) - { - foreach($langtoload as $key) - { - $langs->load($key); - } - } - - // Module - $this->array_import_module[$i]=$module; - // Permission - $this->array_import_perms[$i]=$user->rights->import->run; - // Icon - $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); - // Code du dataset export - $this->array_import_code[$i]=$module->import_code[$r]; - // Libelle du dataset export - $this->array_import_label[$i]=$module->getImportDatasetLabel($r); - // Array of tables to import (key=alias, value=tablename) - $this->array_import_tables[$i]=$module->import_tables_array[$r]; - // Array of tables creator field to import (key=alias, value=creator field) - $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; - // Array of fiels to import (key=field, value=label) - $this->array_import_fields[$i]=$module->import_fields_array[$r]; - // Tableau des entites a exporter (cle=champ, valeur=entite) - $this->array_import_entities[$i]=$module->import_entities_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=alias) - $this->array_import_regex[$i]=$module->import_regex_array[$r]; - // Tableau des alias a exporter (cle=champ, valeur=exemple) - $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; - // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) - $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; - - dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); - $i++; - // } - } + $langs->load($key); } } + + // Module + $this->array_import_module[$i]=$module; + // Permission + $this->array_import_perms[$i]=$user->rights->import->run; + // Icon + $this->array_import_icon[$i]=(isset($module->import_icon[$r])?$module->import_icon[$r]:$module->picto); + // Code du dataset export + $this->array_import_code[$i]=$module->import_code[$r]; + // Libelle du dataset export + $this->array_import_label[$i]=$module->getImportDatasetLabel($r); + // Array of tables to import (key=alias, value=tablename) + $this->array_import_tables[$i]=$module->import_tables_array[$r]; + // Array of tables creator field to import (key=alias, value=creator field) + $this->array_import_tables_creator[$i]=$module->import_tables_creator_array[$r]; + // Array of fiels to import (key=field, value=label) + $this->array_import_fields[$i]=$module->import_fields_array[$r]; + // Tableau des entites a exporter (cle=champ, valeur=entite) + $this->array_import_entities[$i]=$module->import_entities_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=alias) + $this->array_import_regex[$i]=$module->import_regex_array[$r]; + // Tableau des alias a exporter (cle=champ, valeur=exemple) + $this->array_import_examplevalues[$i]=$module->import_examplevalues_array[$r]; + // Tableau des regles de conversion d'une valeur depuis une autre source (cle=champ, valeur=tableau des regles) + $this->array_import_convertvalue[$i]=$module->import_convertvalue_array[$r]; + + dol_syslog("Import loaded for module ".$modulename." with index ".$i.", dataset=".$module->import_code[$r].", nb of fields=".count($module->import_fields_code[$r])); + $i++; } } } + closedir($handle); } - closedir($handle); return 1; } @@ -175,19 +168,18 @@ class Import * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport * - * @param User $user User qui exporte - * @param string $model Modele d'export + * @param string $model Name of import engine ('csv', ...) * @param string $headerlinefields Array of values for first line of example file * @param string $contentlinevalues Array of values for content line of example file * @return string <0 if KO, >0 if OK */ - function build_example_file($user, $model, $headerlinefields, $contentlinevalues) + function build_example_file($model, $headerlinefields, $contentlinevalues) { global $conf,$langs; $indice=0; - dol_syslog("Import::build_example_file ".$model); + dol_syslog(get_class($this)."::build_example_file ".$model); // Creation de la classe d'import du model Import_XXX $dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/"; @@ -238,7 +230,7 @@ class Import $sql.= ')'; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; - dol_syslog("Import::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -249,7 +241,7 @@ class Import { $this->error=$this->db->lasterror(); $this->errno=$this->db->lasterrno(); - dol_syslog("Import::create error ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -267,7 +259,7 @@ class Import $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog("Import::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index 2acf78e557a..1421d116343 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label) //var_dump($headerlinefields); //var_dump($contentlinevalues); -print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues); +print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues); ?> diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 13f9dd0dcc0..0b4870d91f2 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -86,11 +86,7 @@ if ($action == 'add') $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; - if ($db->query($sql)) - { - - } - else + if (! $db->query($sql)) { $error++; dol_print_error($db); @@ -115,7 +111,7 @@ if ($action == 'add') // Remove a notification if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; $db->query($sql); } From 6cd38ecbb83de5805f083606969f462b49a86e82 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:07:29 +0000 Subject: [PATCH 12/85] Qual: Reduce cyclomatic complexity --- htdocs/imports/class/import.class.php | 15 ++++++++------- htdocs/imports/emptyexample.php | 2 +- htdocs/societe/notify/fiche.php | 8 ++++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index af0ae64074a..1676ba73de1 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -62,7 +62,7 @@ class Import { global $langs,$conf; - dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); + dol_syslog("Import::load_arrays user=".$user->id." filter=".$filter); $var=true; $i=0; @@ -168,18 +168,19 @@ class Import * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport * - * @param string $model Name of import engine ('csv', ...) + * @param User $user User qui exporte + * @param string $model Modele d'export * @param string $headerlinefields Array of values for first line of example file * @param string $contentlinevalues Array of values for content line of example file * @return string <0 if KO, >0 if OK */ - function build_example_file($model, $headerlinefields, $contentlinevalues) + function build_example_file($user, $model, $headerlinefields, $contentlinevalues) { global $conf,$langs; $indice=0; - dol_syslog(get_class($this)."::build_example_file ".$model); + dol_syslog("Import::build_example_file ".$model); // Creation de la classe d'import du model Import_XXX $dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/"; @@ -230,7 +231,7 @@ class Import $sql.= ')'; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + dol_syslog("Import::create sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -241,7 +242,7 @@ class Import { $this->error=$this->db->lasterror(); $this->errno=$this->db->lasterrno(); - dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); + dol_syslog("Import::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -259,7 +260,7 @@ class Import $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + dol_syslog("Import::fetch sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index 1421d116343..2acf78e557a 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label) //var_dump($headerlinefields); //var_dump($contentlinevalues); -print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues); +print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues); ?> diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 0b4870d91f2..13f9dd0dcc0 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -86,7 +86,11 @@ if ($action == 'add') $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; - if (! $db->query($sql)) + if ($db->query($sql)) + { + + } + else { $error++; dol_print_error($db); @@ -111,7 +115,7 @@ if ($action == 'add') // Remove a notification if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; $db->query($sql); } From 53d8bf2f179a1feb32bd919fb8e53fa8327b5c66 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:29:13 +0000 Subject: [PATCH 13/85] Qual: Removed warnings --- htdocs/imports/class/import.class.php | 15 ++++----- htdocs/imports/emptyexample.php | 2 +- htdocs/societe/class/client.class.php | 47 +++++---------------------- htdocs/societe/notify/fiche.php | 8 ++--- 4 files changed, 18 insertions(+), 54 deletions(-) diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 1676ba73de1..af0ae64074a 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -62,7 +62,7 @@ class Import { global $langs,$conf; - dol_syslog("Import::load_arrays user=".$user->id." filter=".$filter); + dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); $var=true; $i=0; @@ -168,19 +168,18 @@ class Import * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport * - * @param User $user User qui exporte - * @param string $model Modele d'export + * @param string $model Name of import engine ('csv', ...) * @param string $headerlinefields Array of values for first line of example file * @param string $contentlinevalues Array of values for content line of example file * @return string <0 if KO, >0 if OK */ - function build_example_file($user, $model, $headerlinefields, $contentlinevalues) + function build_example_file($model, $headerlinefields, $contentlinevalues) { global $conf,$langs; $indice=0; - dol_syslog("Import::build_example_file ".$model); + dol_syslog(get_class($this)."::build_example_file ".$model); // Creation de la classe d'import du model Import_XXX $dir = DOL_DOCUMENT_ROOT . "/includes/modules/import/"; @@ -231,7 +230,7 @@ class Import $sql.= ')'; $sql.= " VALUES (".($user->id > 0 ? $user->id : 0).", '".$this->db->escape($this->model_name)."', '".$this->datatoimport."', '".$this->hexa."')"; - dol_syslog("Import::create sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); $resql=$this->db->query($sql); if ($resql) { @@ -242,7 +241,7 @@ class Import { $this->error=$this->db->lasterror(); $this->errno=$this->db->lasterrno(); - dol_syslog("Import::create error ".$this->error, LOG_ERR); + dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -1; } @@ -260,7 +259,7 @@ class Import $sql.= ' FROM '.MAIN_DB_PREFIX.'import_model as em'; $sql.= ' WHERE em.rowid = '.$id; - dol_syslog("Import::fetch sql=".$sql, LOG_DEBUG); + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); $result = $this->db->query($sql); if ($result) { diff --git a/htdocs/imports/emptyexample.php b/htdocs/imports/emptyexample.php index 2acf78e557a..1421d116343 100644 --- a/htdocs/imports/emptyexample.php +++ b/htdocs/imports/emptyexample.php @@ -86,6 +86,6 @@ foreach($fieldstarget as $code=>$label) //var_dump($headerlinefields); //var_dump($contentlinevalues); -print $objimport->build_example_file($user,$format,$headerlinefields,$contentlinevalues); +print $objimport->build_example_file($format,$headerlinefields,$contentlinevalues); ?> diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 6670540d1a3..1d8d9c57213 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -30,55 +30,24 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); */ class Client extends Societe { - var $db; - + var $nb; /** - * \brief Constructeur de la classe - * \param DB handler acces base de donnees - * \param id id societe (0 par defaut) + * Constructor + * + * @param DoliDB $DB Database handler */ - function Client($DB, $id=0) + function Client($DB) { global $config; $this->db = $DB; - $this->id = $id; - $this->factures = array(); - - return 0; } - function read_factures() - { - $sql = "SELECT rowid, facnumber"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_soc = ".$this->id; - $sql .= " ORDER BY datef DESC"; - - $i = 0; - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - while ($i < $num ) - { - $row = $this->db->fetch_row($resql); - - $this->factures[$i][0] = $row[0]; - $this->factures[$i][1] = $row[1]; - - $i++; - } - } - return $result; - } - - /** - * \brief Charge indicateurs this->nb de tableaux de bord - * \return int <0 si ko, >0 si ok + * Load indicators into this->nb for board + * + * @return int <0 if KO, >0 if OK */ function load_state_board() { diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 13f9dd0dcc0..0b4870d91f2 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -86,11 +86,7 @@ if ($action == 'add') $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify_def (datec,fk_soc, fk_contact, fk_action)"; $sql .= " VALUES ('".$db->idate($now)."',".$socid.",".$contactid.",".$actionid.")"; - if ($db->query($sql)) - { - - } - else + if (! $db->query($sql)) { $error++; dol_print_error($db); @@ -115,7 +111,7 @@ if ($action == 'add') // Remove a notification if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"].";"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def where rowid=".$_GET["actid"]; $db->query($sql); } From ce0a72c546106ea326dbd3456726ca6601f2ad84 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:44:24 +0000 Subject: [PATCH 14/85] Qual: Postgresql compatibility Qual: W3C --- .../class/companybankaccount.class.php | 17 +++++--- htdocs/societe/rib.php | 41 ++++++++++--------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 0c3a029574e..d9a76064256 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -65,10 +65,14 @@ class CompanyBankAccount extends Account /** * Create bank information record + * + * @return int <0 if KO, >= 0 if OK */ function create() { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; + $now=dol_now(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')"; $resql=$this->db->query($sql); if ($resql) { @@ -85,12 +89,13 @@ class CompanyBankAccount extends Account } /** + * Update bank account * - * + * @param User $user Object user + * @return int <=0 if KO, >0 if OK */ function update($user='') { - $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql .= " WHERE fk_soc = ".$this->socid; @@ -135,8 +140,10 @@ class CompanyBankAccount extends Account /** * Load record from database - * @param id Id of record - * @param socid Id of company + * + * @param int $id Id of record + * @param int $socid Id of company + * @return int <0 if KO, >0 if OK */ function fetch($id,$socid=0) { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 2ccd64112ae..d10353e2be5 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -106,12 +106,6 @@ if (empty($account->socid)) $account->socid=$soc->id; if ($_GET["socid"] && $_GET["action"] != 'edit') { - // Check BBAN - if (! checkBanForAccount($account)) - { - print '
'.$langs->trans("RIBControlError").'

'; - } - print ''; print ''; @@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '
'.$langs->trans("Bank").'
'; - print ''; - - - - /* - * Barre d'actions - */ - print '
'; - - if ($user->rights->societe->creer) + // Check BBAN + if (! checkBanForAccount($account)) { - print ''.$langs->trans("Modify").''; + print '
'.$langs->trans("RIBControlError").'
'; } - print '
'; - } /* ************************************************************************** */ @@ -194,7 +178,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer $form = new Form($db); - if ($message) { print "$message

\n"; } + dol_htmloutput_mesg($message); print '
'; print ''; @@ -268,6 +252,23 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer dol_fiche_end(); + +if ($_GET["socid"] && $_GET["action"] != 'edit') +{ + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) + { + print ''.$langs->trans("Modify").''; + } + + print '
'; +} + + $db->close(); From 925fc692b92f381b80bc6841534055367c8cf2c5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:21:04 +0000 Subject: [PATCH 15/85] Qual: Removed warnings --- htdocs/societe/class/client.class.php | 47 +++++++++++++++---- .../class/companybankaccount.class.php | 17 ++----- htdocs/societe/rib.php | 41 ++++++++-------- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 1d8d9c57213..6670540d1a3 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -30,24 +30,55 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); */ class Client extends Societe { - var $nb; + var $db; + /** - * Constructor - * - * @param DoliDB $DB Database handler + * \brief Constructeur de la classe + * \param DB handler acces base de donnees + * \param id id societe (0 par defaut) */ - function Client($DB) + function Client($DB, $id=0) { global $config; $this->db = $DB; + $this->id = $id; + $this->factures = array(); + + return 0; } + function read_factures() + { + $sql = "SELECT rowid, facnumber"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql .= " WHERE f.fk_soc = ".$this->id; + $sql .= " ORDER BY datef DESC"; + + $i = 0; + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + + while ($i < $num ) + { + $row = $this->db->fetch_row($resql); + + $this->factures[$i][0] = $row[0]; + $this->factures[$i][1] = $row[1]; + + $i++; + } + } + return $result; + } + + /** - * Load indicators into this->nb for board - * - * @return int <0 if KO, >0 if OK + * \brief Charge indicateurs this->nb de tableaux de bord + * \return int <0 si ko, >0 si ok */ function load_state_board() { diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index d9a76064256..0c3a029574e 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -65,14 +65,10 @@ class CompanyBankAccount extends Account /** * Create bank information record - * - * @return int <0 if KO, >= 0 if OK */ function create() { - $now=dol_now(); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; $resql=$this->db->query($sql); if ($resql) { @@ -89,13 +85,12 @@ class CompanyBankAccount extends Account } /** - * Update bank account * - * @param User $user Object user - * @return int <=0 if KO, >0 if OK + * */ function update($user='') { + $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql .= " WHERE fk_soc = ".$this->socid; @@ -140,10 +135,8 @@ class CompanyBankAccount extends Account /** * Load record from database - * - * @param int $id Id of record - * @param int $socid Id of company - * @return int <0 if KO, >0 if OK + * @param id Id of record + * @param socid Id of company */ function fetch($id,$socid=0) { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index d10353e2be5..2ccd64112ae 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -106,6 +106,12 @@ if (empty($account->socid)) $account->socid=$soc->id; if ($_GET["socid"] && $_GET["action"] != 'edit') { + // Check BBAN + if (! checkBanForAccount($account)) + { + print '
'.$langs->trans("RIBControlError").'

'; + } + print ''; print ''; @@ -159,12 +165,22 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '
'.$langs->trans("Bank").'
'; - // Check BBAN - if (! checkBanForAccount($account)) + print ''; + + + + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) { - print '
'.$langs->trans("RIBControlError").'
'; + print ''.$langs->trans("Modify").''; } + print '
'; + } /* ************************************************************************** */ @@ -178,7 +194,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer $form = new Form($db); - dol_htmloutput_mesg($message); + if ($message) { print "$message

\n"; } print ''; print ''; @@ -252,23 +268,6 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer dol_fiche_end(); - -if ($_GET["socid"] && $_GET["action"] != 'edit') -{ - /* - * Barre d'actions - */ - print '
'; - - if ($user->rights->societe->creer) - { - print ''.$langs->trans("Modify").''; - } - - print '
'; -} - - $db->close(); From 7902ee30651180d17930bd73e6d94339aeec1e28 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:29:13 +0000 Subject: [PATCH 16/85] Qual: Removed warnings --- htdocs/societe/class/client.class.php | 47 +++++---------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 6670540d1a3..1d8d9c57213 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -30,55 +30,24 @@ include_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php"); */ class Client extends Societe { - var $db; - + var $nb; /** - * \brief Constructeur de la classe - * \param DB handler acces base de donnees - * \param id id societe (0 par defaut) + * Constructor + * + * @param DoliDB $DB Database handler */ - function Client($DB, $id=0) + function Client($DB) { global $config; $this->db = $DB; - $this->id = $id; - $this->factures = array(); - - return 0; } - function read_factures() - { - $sql = "SELECT rowid, facnumber"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql .= " WHERE f.fk_soc = ".$this->id; - $sql .= " ORDER BY datef DESC"; - - $i = 0; - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - - while ($i < $num ) - { - $row = $this->db->fetch_row($resql); - - $this->factures[$i][0] = $row[0]; - $this->factures[$i][1] = $row[1]; - - $i++; - } - } - return $result; - } - - /** - * \brief Charge indicateurs this->nb de tableaux de bord - * \return int <0 si ko, >0 si ok + * Load indicators into this->nb for board + * + * @return int <0 if KO, >0 if OK */ function load_state_board() { From 5a2b22223517aea74e371a805fcf0c8d8c2da84a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 21:44:24 +0000 Subject: [PATCH 17/85] Qual: Postgresql compatibility Qual: W3C --- .../class/companybankaccount.class.php | 17 +++++--- htdocs/societe/rib.php | 41 ++++++++++--------- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 0c3a029574e..d9a76064256 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -65,10 +65,14 @@ class CompanyBankAccount extends Account /** * Create bank information record + * + * @return int <0 if KO, >= 0 if OK */ function create() { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, ".$this->db->idate(mktime()).")"; + $now=dol_now(); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, '".$this->db->idate($now)."')"; $resql=$this->db->query($sql); if ($resql) { @@ -85,12 +89,13 @@ class CompanyBankAccount extends Account } /** + * Update bank account * - * + * @param User $user Object user + * @return int <=0 if KO, >0 if OK */ function update($user='') { - $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib"; $sql .= " WHERE fk_soc = ".$this->socid; @@ -135,8 +140,10 @@ class CompanyBankAccount extends Account /** * Load record from database - * @param id Id of record - * @param socid Id of company + * + * @param int $id Id of record + * @param int $socid Id of company + * @return int <0 if KO, >0 if OK */ function fetch($id,$socid=0) { diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index 2ccd64112ae..d10353e2be5 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -106,12 +106,6 @@ if (empty($account->socid)) $account->socid=$soc->id; if ($_GET["socid"] && $_GET["action"] != 'edit') { - // Check BBAN - if (! checkBanForAccount($account)) - { - print '
'.$langs->trans("RIBControlError").'

'; - } - print ''; print ''; @@ -165,22 +159,12 @@ if ($_GET["socid"] && $_GET["action"] != 'edit') print '
'.$langs->trans("Bank").'
'; - print ''; - - - - /* - * Barre d'actions - */ - print '
'; - - if ($user->rights->societe->creer) + // Check BBAN + if (! checkBanForAccount($account)) { - print ''.$langs->trans("Modify").''; + print '
'.$langs->trans("RIBControlError").'
'; } - print '
'; - } /* ************************************************************************** */ @@ -194,7 +178,7 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer $form = new Form($db); - if ($message) { print "$message

\n"; } + dol_htmloutput_mesg($message); print ''; print ''; @@ -268,6 +252,23 @@ if ($_GET["socid"] && $_GET["action"] == 'edit' && $user->rights->societe->creer dol_fiche_end(); + +if ($_GET["socid"] && $_GET["action"] != 'edit') +{ + /* + * Barre d'actions + */ + print '
'; + + if ($user->rights->societe->creer) + { + print ''.$langs->trans("Modify").''; + } + + print '
'; +} + + $db->close(); From 3fca369e298c639b012e659626dcabec87580515 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 22:12:59 +0000 Subject: [PATCH 18/85] Qual: Uniformize code. Removed dead code. --- .../actions_contactcard_default.class.php | 24 +++++++ .../default/dao_contact_default.class.php | 57 ---------------- .../product/actions_card_product.class.php | 21 ++++-- .../service/actions_card_service.class.php | 25 +++++-- .../canvas/actions_card_common.class.php | 2 - .../company/actions_card_company.class.php | 3 +- .../company/dao_thirdparty_company.class.php | 66 +----------------- .../actions_card_individual.class.php | 1 - .../dao_thirdparty_individual.class.php | 68 ++----------------- 9 files changed, 64 insertions(+), 203 deletions(-) diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 71fe2484dd3..ae33c4e0d78 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -93,8 +93,32 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['actionsdone']=show_actions_done($conf,$langs,$db,$objsoc,$this->object,1); } + + if ($action == 'list') + { + $this->LoadListDatas($GLOBALS['limit'], $GLOBALS['offset'], $GLOBALS['sortfield'], $GLOBALS['sortorder']); + } + } + + /** + * Fetch datas list + * + * @param int $limit Limit number of responses + * @param int $offset Offset for first response + * @param string $sortfield Sort field + * @param string $sortorder Sort order ('ASC' or 'DESC') + * @return void + */ + function LoadListDatas($limit, $offset, $sortfield, $sortorder) + { + global $conf, $langs; + + //$this->getFieldList(); + + $this->list_datas = array(); + } } ?> \ No newline at end of file diff --git a/htdocs/contact/canvas/default/dao_contact_default.class.php b/htdocs/contact/canvas/default/dao_contact_default.class.php index a8fc5715254..dbfab60e45d 100644 --- a/htdocs/contact/canvas/default/dao_contact_default.class.php +++ b/htdocs/contact/canvas/default/dao_contact_default.class.php @@ -27,11 +27,6 @@ */ class DaoContactDefault extends Contact { - var $db; - - //! Numero d'erreur Plage 1280-1535 - var $errno = 0; - /** * Constructor * @@ -42,58 +37,6 @@ class DaoContactDefault extends Contact $this->db = $DB; } - /** - * Create third party in database - * - * @param User $user Object of user that ask creation - * @return int >= 0 if OK, < 0 if KO - */ - function create($user='') - { - $result = parent::create($user); - - return $result; - } - - /** - * Update parameters of third party - * - * @param int $id Id societe - * @param User $user Utilisateur qui demande la mise a jour - * @param int $call_trigger 0=non, 1=oui - * @param int $allowmodcodeclient Inclut modif code client et code compta - * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur - * @return int <0 if KO, >=0 if OK - */ - function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0) - { - $result = parent::update($id, $user, $call_trigger, $allowmodcodeclient, $allowmodcodefournisseur); - - return $result; - } - - /** - * Delete third party in database - * - * @return int <0 if KO, >=0 if OK - */ - function delete() - { - $result = parent::delete(); - - return $result; - } - - /** - * Fetch datas list - */ - function LoadListDatas($limit, $offset, $sortfield, $sortorder) - { - global $conf, $langs; - - $this->list_datas = array(); - } - } ?> \ No newline at end of file diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 7e17a84272a..10384ca0086 100755 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -28,7 +28,6 @@ include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); */ class ActionsCardProduct extends Product { - var $db; var $targetmodule; var $canvas; var $card; @@ -38,6 +37,7 @@ class ActionsCardProduct extends Product // List of fiels for action=list var $field_list =array(); + public $list_datas = array(); /** @@ -48,7 +48,7 @@ class ActionsCardProduct extends Product * @param string $canvas Name of canvas * @param string $card Name of tab (sub-canvas) */ - function ActionsCardIndividual($DB,$targetmodule,$canvas,$card) + function ActionsCardProduct($DB,$targetmodule,$canvas,$card) { $this->db = $DB; $this->targetmodule = $targetmodule; @@ -64,6 +64,8 @@ class ActionsCardProduct extends Product /** * Return the title of card + * + * @return string Label of card */ private function getTitle() { @@ -75,7 +77,8 @@ class ActionsCardProduct extends Product /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param action Type of action + * @param string $action Type of action + * @return void */ function assign_values($action) { @@ -141,7 +144,7 @@ class ActionsCardProduct extends Product $this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); $this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); } - + $this->tpl['finished'] = $this->object->finished; $this->tpl['ref'] = $this->object->ref; $this->tpl['label'] = $this->object->label; @@ -249,6 +252,8 @@ class ActionsCardProduct extends Product /** * Fetch field list + * + * @return void */ private function getFieldList() { @@ -299,6 +304,12 @@ class ActionsCardProduct extends Product /** * Fetch datas list + * + * @param int $limit Limit number of responses + * @param int $offset Offset for first response + * @param string $sortfield Sort field + * @param string $sortorder Sort order ('ASC' or 'DESC') + * @return void */ function LoadListDatas($limit, $offset, $sortfield, $sortorder) { @@ -372,7 +383,7 @@ class ActionsCardProduct extends Product $sql.= " AND p.canvas = '".$this->db->escape($_GET["canvas"])."'"; } $sql.= $this->db->order($sortfield,$sortorder); - $sql.= $this->db->plimit($limit + 1 ,$offset); + $sql.= $this->db->plimit($limit+1, $offset); //print $sql; $resql = $this->db->query($sql); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index fb23f213c71..7706a5827db 100755 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -23,12 +23,11 @@ include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php'); /** - * \class ProductService + * \class ActionsCardService * \brief Class with controller methods for product canvas */ class ActionsCardService extends Product { - var $db; var $targetmodule; var $canvas; var $card; @@ -38,6 +37,7 @@ class ActionsCardService extends Product // List of fiels for action=list var $field_list =array(); + public $list_datas = array(); /** @@ -48,7 +48,7 @@ class ActionsCardService extends Product * @param string $canvas Name of canvas * @param string $card Name of tab (sub-canvas) */ - function ActionsCardIndividual($DB,$targetmodule,$canvas,$card) + function ActionsCardService($DB,$targetmodule,$canvas,$card) { $this->db = $DB; $this->targetmodule = $targetmodule; @@ -64,6 +64,8 @@ class ActionsCardService extends Product /** * Return the title of card + * + * @return string Label of card */ private function getTitle() { @@ -75,7 +77,8 @@ class ActionsCardService extends Product /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * - * @param action Type of action + * @param string $action Type of action + * @return void */ function assign_values($action) { @@ -141,7 +144,7 @@ class ActionsCardService extends Product $this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); $this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer); } - + $this->tpl['finished'] = $this->object->finished; $this->tpl['ref'] = $this->object->ref; $this->tpl['label'] = $this->object->label; @@ -229,6 +232,8 @@ class ActionsCardService extends Product /** * Fetch field list + * + * @return void */ private function getFieldList() { @@ -277,7 +282,13 @@ class ActionsCardService extends Product } /** - * \brief Fetch datas list + * Fetch datas list + * + * @param int $limit Limit number of responses + * @param int $offset Offset for first response + * @param string $sortfield Sort field + * @param string $sortorder Sort order ('ASC' or 'DESC') + * @return void */ function LoadListDatas($limit, $offset, $sortfield, $sortorder) { @@ -327,7 +338,7 @@ class ActionsCardService extends Product $sql .= " AND cp.fk_categorie = ".$this->db->escape($search_categ); } $sql.= $this->db->order($sortfield,$sortorder); - $sql.= $this->db->plimit($limit + 1 ,$offset); + $sql.= $this->db->plimit($limit+1, $offset); $this->list_datas = array(); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 226a4553c07..68fd3c1d99f 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -33,8 +33,6 @@ abstract class ActionsCardCommon var $canvas; var $card; - //! Numero d'erreur Plage 1280-1535 - var $errno = 0; //! Template container var $tpl = array(); //! Object container diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 3f8d828b7b8..9c700bdf1d0 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -29,7 +29,6 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php'); */ class ActionsCardCompany extends ActionsCardCommon { - var $db; var $targetmodule; var $canvas; var $card; @@ -96,7 +95,7 @@ class ActionsCardCompany extends ActionsCardCommon $this->tpl['profid3'] = $this->object->ape; $this->tpl['profid4'] = $this->object->idprof4; - if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) + if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK)) { $js = "\n"; $js.= '