diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b8ddcebf18c..79b16bdbf55 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 26e2c7bec90..4b7b31b6b13 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -439,14 +439,15 @@ class Mailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete targets emailing * * @return int 1 if OK, 0 if error */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$this->id; @@ -464,15 +465,16 @@ class Mailing extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change status of each recipient * * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " SET statut = 0"; $sql.= " WHERE fk_mailing = ".$this->id; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d2039a200cb..958924c4da5 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -38,12 +38,12 @@ class Don extends CommonObject * @var string ID to identify managed object */ public $element='don'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='don'; - + public $fk_element = 'fk_donation'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $picto = 'generic'; @@ -96,6 +96,7 @@ class Don extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -103,9 +104,9 @@ class Don extends CommonObject * @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 Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable if (empty($this->labelstatut) || empty($this->labelstatushort)) { global $langs; @@ -124,39 +125,39 @@ class Don extends CommonObject { return $this->labelstatut[$statut]; } - if ($mode == 1) + elseif ($mode == 1) { return $this->labelstatutshort[$statut]; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatutshort[$statut]; if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatut[$statut]; if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); @@ -694,6 +695,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Validate a promise of donation * @@ -702,9 +704,9 @@ class Don extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function valid_promesse($id, $userid, $notrigger=0) { + // phpcs:enable global $langs, $user; $error=0; @@ -745,6 +747,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the donation as paid, the donation was received * @@ -752,9 +755,9 @@ class Don extends CommonObject * @param int $modepayment mode of payment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $modepayment=0) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; if ($modepayment) { @@ -781,15 +784,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set donation to status cancelled * * @param int $id id of donation * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($id) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id; $resql=$this->db->query($sql); @@ -811,15 +815,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Sum of donations * * @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses * @return int Summ of donations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function sum_donations($param) { + // phpcs:enable global $conf; $result=0; @@ -839,14 +844,15 @@ class Don extends CommonObject return $result; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 3a839c2e759..575a5355877 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -453,6 +453,7 @@ class PaymentDonation extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -460,10 +461,10 @@ class PaymentDonation extends CommonObject * @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 Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { - global $langs; + // phpcs:enable + global $langs; return ''; } @@ -577,15 +578,16 @@ class PaymentDonation extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between the donation payment and the generated line in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 7ccb88d82ee..9f5fdc485e3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -547,6 +547,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the expense report as paid * @@ -555,9 +556,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $fuser, $notrigger = 0) { + // phpcs:enable $error = 0; $this->db->begin(); @@ -619,6 +620,7 @@ class ExpenseReport extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -626,30 +628,30 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) return $langs->transnoentities($this->statuts[$status]); - if ($mode == 1) + elseif ($mode == 1) return $langs->transnoentities($this->statuts_short[$status]); - if ($mode == 2) + elseif ($mode == 2) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]); - if ($mode == 3) + elseif ($mode == 3) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - if ($mode == 4) + elseif ($mode == 4) return img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]); - if ($mode == 5) + elseif ($mode == 5) return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); - if ($mode == 6) + elseif ($mode == 6) return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); } @@ -794,6 +796,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_line_by_project * @@ -801,9 +804,9 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_line_by_project($projectid,$user='') { + // phpcs:enable global $conf,$db,$langs; $langs->load('trips'); @@ -951,14 +954,15 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_lines * * @return int <0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1195,15 +1199,16 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_save_from_refuse * * @param User $fuser User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_save_from_refuse($fuser) { + // phpcs:enable global $conf,$langs; // Sélection de la date de début de la NDF @@ -1368,6 +1373,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_unpaid * @@ -1375,9 +1381,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($fuser, $notrigger = 0) { + // phpcs:enable $error = 0; if ($this->fk_c_deplacement_statuts != 5) @@ -1428,6 +1434,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_cancel * @@ -1436,9 +1443,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($fuser,$detail, $notrigger=0) { + // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(gmmktime()); if ($this->fk_statut != 4) @@ -1613,6 +1620,7 @@ class ExpenseReport extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you add a line. * @@ -1620,9 +1628,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_add($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht + $ligne_total_ht; $this->total_tva = $this->total_tva + $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -1642,6 +1650,7 @@ class ExpenseReport extends CommonObject endif; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you delete a line. * @@ -1649,9 +1658,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_del($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht - $ligne_total_ht; $this->total_tva = $this->total_tva - $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -2058,6 +2067,7 @@ class ExpenseReport extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * periode_existe * @@ -2066,9 +2076,9 @@ class ExpenseReport extends CommonObject * @param Date $date_fin End date * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function periode_existe($fuser, $date_debut, $date_fin) { + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE fk_user_author = '{$fuser->id}'"; @@ -2115,15 +2125,16 @@ class ExpenseReport extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of people with permission to validate expense reports. * Search for permission "approve expense report" * * @return array Array of user ids */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_expensereport() { + // phpcs:enable $users_validator=array(); $sql = "SELECT DISTINCT ur.fk_user"; @@ -2222,14 +2233,15 @@ class ExpenseReport extends CommonObject return $ret; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -2257,6 +2269,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2264,9 +2277,9 @@ class ExpenseReport extends CommonObject * @param string $option 'topay' or 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $option='topay') { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -2696,6 +2709,7 @@ class ExpenseReportLine } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des differents etats d'une note de frais. * Les valeurs de la liste sont les id de la table c_expensereport_statuts @@ -2706,9 +2720,9 @@ class ExpenseReportLine * @param int $useshortlabel Use short labels * @return string HTML select with status */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1, $useshortlabel=0) { + // phpcs:enable global $db, $langs; $tmpep=new ExpenseReport($db); @@ -2733,6 +2747,7 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt print ''; } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes with select value = id * @@ -2742,9 +2757,9 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt * @param int $active 1=Active only, 0=Unactive only, -1=All * @return string Select html */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees_id($selected='',$htmlname='type',$showempty=0, $active=1) { + // phpcs:enable global $db,$langs,$user; $langs->load("trips"); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 21e8df59efc..a37f9d35c18 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -36,22 +36,22 @@ class MyObject extends CommonObject * @var string ID to identify managed object */ public $element = 'myobject'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'mymodule_myobject'; - + /** * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var int Does myobject support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 1; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -122,22 +122,22 @@ class MyObject extends CommonObject * @var int Name of subtable line */ //public $table_element_line = 'myobjectdet'; - + /** * @var int Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_myobject'; - + /** * @var int Name of subtable class that manage subtable lines */ //public $class_element_line = 'MyObjectline'; - + /** * @var array Array of child tables (child tables to delete before deleting a record) */ //protected $childtables=array('myobjectdet'); - + /** * @var MyObjectLine[] Array of subtable lines */ @@ -368,6 +368,7 @@ class MyObject extends CommonObject return $this->LibStatut($this->status, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -375,9 +376,9 @@ class MyObject extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status, $mode=0) { + // phpcs:enable if (empty($this->labelstatus)) { global $langs;