diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 036aa8dc0ba..f94fa4b8a12 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -338,6 +338,7 @@ class Asset extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -345,43 +346,37 @@ class Asset 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 static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index e6b95d7ad37..7aa9beda627 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -33,12 +33,12 @@ class AssetType extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'asset_type'; - + /** * @var string ID to identify managed object */ public $element = 'asset_type'; - + public $picto = 'group'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -282,14 +282,15 @@ class AssetType extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of asset's type * * @return array List of types of members */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { + // phpcs:enable global $conf,$langs; $assettypes = array(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 433b05aceeb..32910c3ed8a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -640,6 +640,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link an object to the category * @@ -647,9 +648,9 @@ class Categorie extends CommonObject * @param string $type Type of category ('product', ...) * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_type($obj, $type) { + // phpcs:enable global $user,$langs,$conf; $error=0; @@ -742,6 +743,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object from category * @@ -750,9 +752,9 @@ class Categorie extends CommonObject * * @return int 1 if OK, -1 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_type($obj,$type) { + // phpcs:enable global $user,$langs,$conf; $error=0; @@ -966,14 +968,15 @@ class Categorie extends CommonObject return $categories; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return childs of a category * * @return array|int <0 KO, array ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_filles() { + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql.= " WHERE fk_parent = ".$this->id; @@ -996,14 +999,15 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load this->motherof that is array(id_son=>id_parent, ...) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function load_motherof() { + // phpcs:enable global $conf; $this->motherof=array(); @@ -1031,6 +1035,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Rebuilding the category tree as an array * Return an array of table('id','id_mere',...) trie selon arbre et avec: @@ -1046,9 +1051,9 @@ class Categorie extends CommonObject * * @return array Array of categories. this->cats and this->motherof are set. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($type, $markafterid=0) { + // phpcs:enable global $conf, $langs; if (! is_numeric($type)) $type = $this->MAP_ID[$type]; @@ -1123,6 +1128,7 @@ class Categorie extends CommonObject return $this->cats; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * @@ -1130,9 +1136,9 @@ class Categorie extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=1000) { + // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); if (! empty($this->cats[$id_categ]['fullpath'])) @@ -1166,14 +1172,15 @@ class Categorie extends CommonObject return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display content of $this->cats * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function debug_cats() { + // phpcs:enable // Display $this->cats foreach($this->cats as $key => $val) { @@ -1188,6 +1195,7 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns all categories * @@ -1195,9 +1203,9 @@ class Categorie extends CommonObject * @param boolean $parent Just parent categories if true * @return array Table of Object Category */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_categories($type=null, $parent=false) { + // phpcs:enable if (! is_numeric($type)) $type = $this->MAP_ID[$type]; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; @@ -1226,14 +1234,15 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check if no category with same label already exists for this cat's parent or root and for this cat's type * * @return integer 1 if already exist, 0 otherwise, -1 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function already_exists() { + // phpcs:enable $type=$this->type; if (! is_numeric($type)) $type=$this->MAP_ID[$type]; @@ -1276,18 +1285,20 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the top level categories (which are not girls) * * @param int $type Type of category (0, 1, ...) * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_main_categories($type=null) { + // phpcs:enable return $this->get_all_categories($type, true); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the path of the category, with the names of the categories * separated by $sep (" >> " by default) @@ -1297,9 +1308,9 @@ class Categorie extends CommonObject * @param int $nocolor 0 * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_all_ways($sep = " >> ", $url='', $nocolor=0) { + // phpcs:enable $ways = array(); $allways = $this->get_all_ways(); // Load array of categories @@ -1346,14 +1357,15 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array containing the list of parent categories * * @return int|array <0 KO, array OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_meres() { + // phpcs:enable $parents = array(); $sql = "SELECT fk_parent FROM ".MAIN_DB_PREFIX."categorie"; @@ -1381,15 +1393,16 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns in a table all possible paths to get to the category * starting with the major categories represented by Tables of categories * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_ways() { + // phpcs:enable $ways = array(); $parents=$this->get_meres(); @@ -1596,6 +1609,7 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Deplace fichier uploade sous le nom $files dans le repertoire sdir * @@ -1603,9 +1617,9 @@ class Categorie extends CommonObject * @param string $file Nom du fichier uploade * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dir = $sdir .'/'. get_exdir($this->id,2,0,0,$this,'category') . $this->id ."/"; @@ -1646,6 +1660,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tableau de toutes les photos de la categorie * @@ -1653,9 +1668,9 @@ class Categorie extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $nbphoto=0; @@ -1702,15 +1717,16 @@ class Categorie extends CommonObject return $tabobj; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Efface la photo de la categorie et sa vignette * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine @@ -1731,15 +1747,16 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load size of image file * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { + // phpcs:enable $infoImg = getimagesize($file); // Recuperation des infos de l'image $this->imgWidth = $infoImg[0]; // Largeur de l'image $this->imgHeight = $infoImg[1]; // Hauteur de l'image diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index fa7a9a1bc9e..26e2c7bec90 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -35,12 +35,12 @@ class Mailing extends CommonObject * @var string ID to identify managed object */ public $element='mailing'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='mailing'; - + public $picto='email'; var $titre; @@ -444,7 +444,7 @@ class Mailing extends CommonObject * * @return int 1 if OK, 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; @@ -470,7 +470,7 @@ class Mailing extends CommonObject * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; @@ -536,6 +536,7 @@ class Mailing extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -543,42 +544,38 @@ class Mailing 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 Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('mails'); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) - { - return $langs->trans($this->statuts[$statut]); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3'); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); @@ -606,39 +603,39 @@ class Mailing extends CommonObject { return $langs->trans('MailingStatusError'); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans('MailingStatusSent'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ba82e007086..76225ff8902 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -34,7 +34,7 @@ class MouvementStock extends CommonObject * @var string Id to identify managed objects */ public $element = 'stockmouvement'; - + /** * @var string Name of table without prefix where object is stored */ @@ -858,6 +858,7 @@ class MouvementStock extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Url link of origin object * @@ -865,9 +866,9 @@ class MouvementStock extends CommonObject * @param int $origintype Type origin * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_origin($fk_origin, $origintype) { + // phpcs:enable $origin=''; switch ($origintype) { @@ -1012,38 +1013,35 @@ class MouvementStock extends CommonObject return $this->LibStatut($mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * * @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 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans('StatusNotApplicable'); } - if ($mode == 1) - { - return $langs->trans('StatusNotApplicable'); - } - if ($mode == 2) + elseif ($mode == 2) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 3) + elseif ($mode == 3) { return img_picto($langs->trans('StatusNotApplicable'),'statut9'); } - if ($mode == 4) + elseif ($mode == 4) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 5) + elseif ($mode == 5) { return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0c501a1a09f..2cee8f7a2a1 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -39,7 +39,7 @@ class Productlot extends CommonObject * @var string Id to identify managed objects */ public $element = 'productlot'; - + /** * @var string Name of table without prefix where object is stored */ @@ -475,6 +475,7 @@ class Productlot extends CommonObject return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -482,9 +483,9 @@ class Productlot 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 * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; //$langs->load('stocks'); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a9b44339930..f690cdd8625 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -49,12 +49,12 @@ class SupplierProposal extends CommonObject * @var string ID to identify managed object */ public $element='supplier_proposal'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='supplier_proposal'; - + public $table_element_line='supplier_proposaldet'; public $fk_element='fk_supplier_proposal'; public $picto='propal'; @@ -203,9 +203,10 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array products - * $this->client doit etre charge + * $this->client doit etre charge * * @param int $idproduct Product Id to add * @param int $qty Quantity @@ -215,9 +216,9 @@ class SupplierProposal extends CommonObject * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -259,15 +260,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1074,6 +1076,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert into DB a supplier_proposal object completely defined by its data members (ex, results from copy). * @@ -1081,9 +1084,9 @@ class SupplierProposal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { + // phpcs:enable $this->products=$this->lines; return $this->create($user); @@ -1504,6 +1507,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1511,9 +1515,9 @@ class SupplierProposal extends CommonObject * @param int $date_livraison Delivery date * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { + // phpcs:enable if (! empty($user->rights->supplier_proposal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; @@ -1534,6 +1538,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -1541,9 +1546,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1568,6 +1573,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -1575,9 +1581,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1841,15 +1847,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Set draft status + * Set draft status * * @param User $user Object user that modify * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user) { + // phpcs:enable global $conf,$langs; $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal SET fk_statut = 0"; @@ -1868,6 +1875,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of askprice (eventually filtered on user) into an array * @@ -1881,9 +1889,9 @@ class SupplierProposal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -2133,16 +2141,17 @@ class SupplierProposal extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return label of a status (draft, validated, ...) + * Return label of a status (draft, validated, ...) * - * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label + * @param int $statut id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { + // phpcs:enable // Init/load array of translation of status if (empty($this->labelstatut) || empty($this->labelstatut_short)) { @@ -2162,21 +2171,22 @@ class SupplierProposal extends CommonObject $statuttrans=''; if ($statut==0) $statuttrans='statut0'; - if ($statut==1) $statuttrans='statut1'; - if ($statut==2) $statuttrans='statut3'; - if ($statut==3) $statuttrans='statut5'; - if ($statut==4) $statuttrans='statut6'; + elseif ($statut==1) $statuttrans='statut1'; + elseif ($statut==2) $statuttrans='statut3'; + elseif ($statut==3) $statuttrans='statut5'; + elseif ($statut==4) $statuttrans='statut6'; if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); - if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 1) return $this->labelstatut_short[$statut]; + elseif ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + elseif ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + elseif ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2184,9 +2194,9 @@ class SupplierProposal extends CommonObject * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $user, $langs; $now=dol_now(); @@ -2338,14 +2348,15 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de 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, $user; $this->nb=array(); @@ -2658,7 +2669,7 @@ class SupplierProposalLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -2668,7 +2679,7 @@ class SupplierProposalLine extends CommonObjectLine * @var string ID to identify managed object */ public $element='supplier_proposaldet'; - + /** * @var string Name of table without prefix where object is stored */ @@ -2678,12 +2689,12 @@ class SupplierProposalLine extends CommonObjectLine // From llx_supplier_proposaldet var $rowid; // deprecated - + /** * @var int ID */ public $id; - + var $fk_supplier_proposal; var $fk_parent_line; var $desc; // Description ligne @@ -3185,15 +3196,16 @@ class SupplierProposalLine extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update DB line fields total_xxx * Used by migration * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base