From 3e723af0189ce964550999462e4962068ae90182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 1 Sep 2018 23:46:13 +0200 Subject: [PATCH 01/30] start changing phpcs:ignore --- htdocs/comm/propal/class/propal.class.php | 66 +++++--- htdocs/contrat/class/contrat.class.php | 36 +++-- htdocs/cron/class/cronjob.class.php | 16 +- htdocs/expedition/class/expedition.class.php | 52 +++--- .../class/paymentexpensereport.class.php | 8 +- htdocs/product/card.php | 2 +- .../product/class/html.formproduct.class.php | 10 +- htdocs/product/class/product.class.php | 149 ++++++++++++------ htdocs/product/class/productbatch.class.php | 7 +- .../inventory/class/inventory.class.php | 15 +- .../class/productstockentrepot.class.php | 5 +- test/phpunit/CoreTest.php | 3 +- 12 files changed, 235 insertions(+), 134 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index d59ccc63d1c4d..e8437e6649855 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -232,9 +232,10 @@ function __construct($db, $socid="", $propalid=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Add line into array products - * $this->thirdparty should be loaded + * Add line into array products + * $this->thirdparty should be loaded * * @param int $idproduct Product Id to add * @param int $qty Quantity @@ -244,9 +245,9 @@ function __construct($db, $socid="", $propalid=0) * TODO Replace calls to this function by generation objet Ligne * inserted into table $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; @@ -293,15 +294,16 @@ function add_product($idproduct, $qty, $remise_percent=0) } } + // 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'; @@ -1172,6 +1174,7 @@ function create($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert into DB a proposal object completely defined by its data members (ex, results from copy). * @@ -1179,9 +1182,9 @@ function create($user, $notrigger=0) * @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 // i love this function because $this->products is not used in create function... $this->products=$this->lines; @@ -1564,15 +1567,16 @@ function update(User $user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { + // phpcs:enable $this->lines=array(); $sql = 'SELECT d.rowid, d.fk_propal, d.fk_parent_line, d.label as custom_label, d.description, d.price, d.vat_src_code, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.localtax1_type, d.localtax2_type, d.qty, d.fk_remise_except, d.remise_percent, d.subprice, d.fk_product,'; @@ -1803,6 +1807,7 @@ function valid($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define proposal date * @@ -1811,9 +1816,9 @@ function valid($user, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { + // phpcs:enable if (empty($date)) { $this->error='ErrorBadParameter'; @@ -1871,6 +1876,7 @@ function set_date($user, $date, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define end validity date * @@ -1879,9 +1885,9 @@ function set_date($user, $date, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_echeance($user, $date_fin_validite, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -1932,6 +1938,7 @@ function set_echeance($user, $date_fin_validite, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1940,9 +1947,9 @@ function set_echeance($user, $date_fin_validite, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -1993,6 +2000,7 @@ function set_date_livraison($user, $date_livraison, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery * @@ -2001,9 +2009,9 @@ function set_date_livraison($user, $date_livraison, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_availability($user, $id, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) { $error=0; @@ -2063,6 +2071,7 @@ function set_availability($user, $id, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set source of demand * @@ -2071,9 +2080,9 @@ function set_availability($user, $id, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_demand_reason($user, $id, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) { $error=0; @@ -2135,6 +2144,7 @@ function set_demand_reason($user, $id, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer reference number * @@ -2143,9 +2153,9 @@ function set_demand_reason($user, $id, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { + // phpcs:enable if (! empty($user->rights->propal->creer)) { $error=0; @@ -2199,6 +2209,7 @@ function set_ref_client($user, $ref_client, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -2207,9 +2218,9 @@ function set_ref_client($user, $ref_client, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->propal->creer)) @@ -2265,6 +2276,7 @@ function set_remise_percent($user, $remise, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -2273,9 +2285,9 @@ function set_remise_percent($user, $remise, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->propal->creer)) @@ -2550,6 +2562,7 @@ function classifyBilled(User $user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2557,9 +2570,9 @@ function classifyBilled(User $user, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $notrigger=0) { + // phpcs:enable $error=0; $this->db->begin(); @@ -2608,6 +2621,7 @@ function set_draft($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of proposal (eventually filtered on user) into an array * @@ -2621,9 +2635,9 @@ function set_draft($user, $notrigger=0) * @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.datep', $sortorder='DESC') { + // phpcs:enable global $user; $ga = array(); @@ -2695,15 +2709,16 @@ function getInvoiceArrayList() return $this->InvoiceArrayList($this->id); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array with id and ref of related invoices * * @param int $id Id propal * @return array Array of invoices id */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InvoiceArrayList($id) { + // phpcs:enable $ga = array(); $linkedInvoices = array(); @@ -2974,6 +2989,7 @@ function availability($availability_id, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change source demand * @@ -2982,9 +2998,9 @@ function availability($availability_id, $notrigger=0) * @return int >0 si ok, <0 si ko * @deprecated use set_demand_reason */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { + // phpcs:enable global $user; if ($this->statut >= self::STATUS_DRAFT) @@ -3115,6 +3131,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status (draft, validated, ...) * @@ -3122,9 +3139,9 @@ function getLibStatut($mode=0) * @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($statut,$mode=1) { + // phpcs:enable global $conf; // Init/load array of translation of status @@ -3158,9 +3175,10 @@ function LibStatut($statut,$mode=1) 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); - } + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -3168,9 +3186,9 @@ function LibStatut($statut,$mode=1) * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3336,14 +3354,15 @@ function initAsSpecimen() } } + // 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 $user; $this->nb=array(); @@ -4223,15 +4242,16 @@ function update($notrigger=0) } } + // 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 diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c7601cf9c1daa..ee62ee5680ca3 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -236,6 +236,7 @@ function getNextNumRef($soc) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -246,9 +247,9 @@ function getNextNumRef($soc) * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $line_id, $date, $date_end='', $comment='') { + // phpcs:enable $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); if ($result < 0) { @@ -259,6 +260,7 @@ function active_line($user, $line_id, $date, $date_end='', $comment='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -268,9 +270,9 @@ function active_line($user, $line_id, $date, $date_end='', $comment='') * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $line_id, $date_end, $comment='') { + // phpcs:enable $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); if ($result < 0) { @@ -702,15 +704,16 @@ function fetch($id, $ref='', $ref_customer='', $ref_supplier='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load lines array into this->lines. * This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed * * @return ContratLigne[] Return array of contract lines */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->nbofserviceswait=0; $this->nbofservicesopened=0; $this->nbofservicesexpired=0; @@ -1780,6 +1783,7 @@ function deleteline($idline, User $user) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update statut of contract according to services * @@ -1787,9 +1791,9 @@ function deleteline($idline, User $user) * @return int <0 if KO, >0 if OK * @deprecated This function will never be used. Status of a contract is status of its lines. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_statut($user) { + // phpcs:enable dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); // If draft, we keep it (should not happen) @@ -1819,6 +1823,7 @@ function getLibStatut($mode) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi label of a given contrat status * @@ -1826,9 +1831,9 @@ function getLibStatut($mode) * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; $langs->load("contracts"); if ($mode == 0) @@ -2002,15 +2007,16 @@ function info($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of line rowid * * @param int $statut Status of lines to get * @return array Array of line's rowid */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function array_detail($statut=-1) { + // phpcs:enable $tab=array(); $sql = "SELECT cd.rowid"; @@ -2078,6 +2084,7 @@ function getListOfContracts($option='all') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2085,9 +2092,9 @@ function getListOfContracts($option='all') * @param string $mode "inactive" pour services a activer, "expired" pour services expires * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $langs; $this->from = " FROM ".MAIN_DB_PREFIX."contrat as c"; @@ -2157,14 +2164,15 @@ function load_board($user,$mode) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -2580,6 +2588,7 @@ function getLibStatut($mode) return $this->LibStatut($this->statut,$mode,((! empty($this->date_fin_validite))?($this->date_fin_validite < dol_now()?1:0):-1)); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a contract line status * @@ -2589,9 +2598,9 @@ function getLibStatut($mode) * @param string $moreatt More attribute * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($statut,$mode,$expired=-1,$moreatt='') { + // phpcs:enable global $langs; $langs->load("contracts"); if ($mode == 0) @@ -3003,15 +3012,16 @@ function update($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base des champs total_xxx de ligne * Used by migration process * * @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 @@ -3120,6 +3130,7 @@ public function insert($notrigger = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -3129,9 +3140,9 @@ public function insert($notrigger = 0) * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function active_line($user, $date, $date_end = '', $comment = '') { + // phpcs:enable global $langs, $conf; $error = 0; @@ -3178,6 +3189,7 @@ function active_line($user, $date, $date_end = '', $comment = '') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -3187,9 +3199,9 @@ function active_line($user, $date, $date_end = '', $comment = '') * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_line($user, $date_end, $comment = '', $notrigger=0) { + // phpcs:enable global $langs, $conf; // Update object diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 02fd4a9564363..7c9396c70e807 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -368,6 +368,7 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -380,10 +381,10 @@ function fetch($id) * @param int $processing Processing or not * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder='DESC', $sortfield='t.rowid', $limit=0, $offset=0, $status=1, $filter='', $processing=-1) { - global $langs; + // phpcs:enable + global $langs; $this->lines=array(); @@ -920,6 +921,7 @@ function info() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Run a job. * Once job is finished, status and nb of run is updated. @@ -928,9 +930,9 @@ function info() * @param string $userlogin User login * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function run_jobs($userlogin) { + // phpcs:enable global $langs, $conf; $now=dol_now(); @@ -1191,6 +1193,7 @@ function run_jobs($userlogin) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reprogram a job * @@ -1198,9 +1201,9 @@ function run_jobs($userlogin) * @param timestamp $now Date returned by dol_now() * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reprogram_jobs($userlogin, $now) { + // phpcs:enable dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -1279,6 +1282,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1286,10 +1290,10 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { - global $langs; + // phpcs:enable + global $langs; $langs->load('users'); if ($mode == 0) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 8a46f14c829dc..e40faafeefd7a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -48,14 +48,14 @@ class Expedition extends CommonObject * @var string ID to identify managed object */ public $element="shipping"; - + public $fk_element="fk_expedition"; - + /** * @var string Name of table without prefix where object is stored */ public $table_element="expedition"; - + public $table_element_line="expeditiondet"; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'sending'; @@ -380,6 +380,7 @@ function create($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a expedition line * @@ -389,9 +390,9 @@ function create($user, $notrigger=0) * @param array $array_options extrafields array * @return int <0 if KO, line_id if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) { + //phpcs:enable $expeditionline = new ExpeditionLigne($this->db); $expeditionline->fk_expedition = $this->id; $expeditionline->entrepot_id = $entrepot_id; @@ -407,6 +408,7 @@ function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create the detail (eat-by date) of the expedition line * @@ -414,9 +416,9 @@ function create_line($entrepot_id, $origin_line_id, $qty,$array_options=0) * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_line_batch($line_ext,$array_options=0) { + // phpcs:enable $error = 0; $stockLocationQty = array(); // associated array with batch qty in stock location @@ -478,7 +480,7 @@ function fetch($id, $ref='', $ref_ext='', $ref_int='') $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; $sql.= ', i.libelle as libelle_incoterms'; - $sql.= ', s.libelle as shipping_method'; + $sql.= ', s.libelle as shipping_method'; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; @@ -807,15 +809,16 @@ function valid($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a delivery receipt from a shipment * * @param User $user User * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_delivery($user) { + // phpcs:enable global $conf; if ($conf->livraison_bon->enabled) @@ -915,6 +918,7 @@ function addline($entrepot_id, $id, $qty,$array_options=0) $this->lines[$num] = $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a shipment line with batch record * @@ -922,9 +926,9 @@ function addline($entrepot_id, $id, $qty,$array_options=0) * @param array $array_options extrafields array * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function addline_batch($dbatch,$array_options=0) { + // phpcs:enable global $conf,$langs; $num = count($this->lines); @@ -1303,14 +1307,15 @@ function delete() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load lines * * @return int >0 if OK, Otherwise if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable global $conf, $mysoc; // TODO: recuperer les champs du document associe a part @@ -1590,6 +1595,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1597,9 +1603,9 @@ function getLibStatut($mode=0) * @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) { + // phpcs:enable global $langs; if ($mode==0) @@ -1713,6 +1719,7 @@ function initAsSpecimen() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -1720,9 +1727,9 @@ function initAsSpecimen() * @param timestamp $date_livraison Date de livraison * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { + // phpcs:enable if ($user->rights->expedition->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."expedition"; @@ -1748,14 +1755,15 @@ function set_date_livraison($user, $date_livraison) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch deliveries method and return an array. Load array this->meths(rowid=>label). * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_delivery_methods() { + // phpcs:enable global $langs; $this->meths = array(); @@ -1775,15 +1783,16 @@ function fetch_delivery_methods() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch all deliveries method and return an array. Load array this->listmeths. * * @param id $id only this carrier, all if none * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_delivery_methods($id='') { + // phpcs:enable global $langs; $this->listmeths = array(); @@ -1810,6 +1819,7 @@ function list_delivery_methods($id='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update/create delivery method. * @@ -1817,9 +1827,9 @@ function list_delivery_methods($id='') * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_delivery_method($id='') { + // phpcs:enable if ($id=='') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; @@ -1839,6 +1849,7 @@ function update_delivery_method($id='') if ($resql < 0) dol_print_error($this->db,''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate delivery method. * @@ -1846,15 +1857,16 @@ function update_delivery_method($id='') * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function activ_delivery_method($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; $sql.= ' WHERE rowid='.$id; $resql = $this->db->query($sql); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * DesActivate delivery method. * @@ -1862,9 +1874,9 @@ function activ_delivery_method($id) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function disable_delivery_method($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; $sql.= ' WHERE rowid='.$id; @@ -1872,15 +1884,16 @@ function disable_delivery_method($id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Forge an set tracking url * * @param string $value Value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetUrlTrackingStatus($value='') { + // phpcs:enable if (! empty($this->shipping_method_id)) { $sql = "SELECT em.code, em.tracking"; @@ -2058,14 +2071,15 @@ function setClosed() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_billed() { + // phpcs:enable global $user; $error=0; @@ -2293,7 +2307,7 @@ class ExpeditionLigne extends CommonObjectLine * @var string ID to identify managed object */ public $element='expeditiondet'; - + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/expensereport/class/paymentexpensereport.class.php b/htdocs/expensereport/class/paymentexpensereport.class.php index 0dceeae4808d1..fa581161494ca 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -450,16 +450,17 @@ function getLibStatut($mode=0) return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * - * @param int $statut Id statut + * @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 Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; return ''; @@ -604,15 +605,16 @@ function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between the expense report 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_expensereport SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 672ad33442223..52815c1303d95 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1068,7 +1068,7 @@ print ''; } if (empty($conf->global->PRODUCT_DISABLE_VOLUME)) - { + { // Volume print ''.$langs->trans("Volume").''; print ''; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 4eee6ffe5025a..22b5e4656a7ca 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,6 +167,7 @@ function loadWarehouses($fk_product=0, $batch = '', $status='', $sumStock = true } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return full path to current warehouse in $tab (recursive function) * @@ -174,10 +175,9 @@ function loadWarehouses($fk_product=0, $batch = '', $status='', $sumStock = true * @param String $final_label full label with all parents, separated by ' >> ' (completed on each call) * @return String full label with all parents, separated by ' >> ' */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function get_parent_path($tab, $final_label='') { - + //phpcs:enable if(empty($final_label)) $final_label = $tab['label']; if(empty($tab['parent_id'])) return $final_label; @@ -282,6 +282,7 @@ function formSelectWarehouses($page, $selected='', $htmlname='warehouse_id', $ad } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a combo box with list of units * pour l'instant on ne definit pas les unites dans la base @@ -292,12 +293,13 @@ function formSelectWarehouses($page, $selected='', $htmlname='warehouse_id', $ad * @param int $adddefault Add empty unit called "Default" * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { + //phpcs:enable print $this->load_measuring_units($name, $measuring_style, $default, $adddefault); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a combo box with list of units * For the moment, units labels are defined in measuring_units_string @@ -308,9 +310,9 @@ function select_measuring_units($name='measuring_units', $measuring_style='', $d * @param int $adddefault Add empty unit called "Default" * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { + //phpcs:enable global $langs,$conf,$mysoc; $langs->load("other"); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index cdacd56e432d1..4f81927dca01d 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -692,19 +692,20 @@ function verify() return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check barcode * - * @param string $valuetotest Value to test - * @param string $typefortest Type of barcode (ISBN, EAN, ...) + * @param string $valuetotest Value to test + * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK * -1 ErrorBadBarCodeSyntax * -2 ErrorBarCodeRequired * -3 ErrorBarCodeAlreadyUsed */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_barcode($valuetotest,$typefortest) { + // phpcs:enable global $conf; if (! empty($conf->barcode->enabled) && ! empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) { @@ -1446,6 +1447,7 @@ function getMultiLangs() + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert a track that we changed a customer price * @@ -1453,9 +1455,9 @@ function getMultiLangs() * @param int $level price level to change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _log_price($user,$level=0) { + // phpcs:enable global $conf; $now=dol_now(); @@ -1485,6 +1487,7 @@ function _log_price($user,$level=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a price line * @@ -1492,9 +1495,9 @@ function _log_price($user,$level=0) * @param int $rowid Line id to delete * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function log_price_delete($user, $rowid) { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql.= " WHERE fk_product_price=".$rowid; $resql=$this->db->query($sql); @@ -1514,6 +1517,7 @@ function log_price_delete($user, $rowid) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read price used by a provider. * We enter as input couple prodfournprice/qty or triplet qty/product_id/fourn_ref. @@ -1526,9 +1530,9 @@ function log_price_delete($user, $rowid) * @param int $fk_soc If of supplier * @return int <-1 if KO, -1 if qty not enough, 0 if OK but nothing found, id_product if OK and found. May also initialize some properties like (->ref_supplier, buyprice, fourn_pu, vatrate_supplier...) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_buyprice($prodfournprice, $qty, $product_id=0, $fourn_ref='', $fk_soc=0) { + // phpcs:enable global $conf; $result = 0; @@ -2216,15 +2220,16 @@ function fetch($id='', $ref='', $ref_ext='', $ignore_expression=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats propale pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_propale($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2260,15 +2265,16 @@ function load_stats_propale($socid=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats propale pour le produit/service * * @param int $socid Id thirdparty * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_proposal_supplier($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2304,6 +2310,7 @@ function load_stats_proposal_supplier($socid=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande client pour le produit/service * @@ -2312,9 +2319,9 @@ function load_stats_proposal_supplier($socid=0) * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Array of stats (nb=nb of order, qty=qty ordered) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_customers, COUNT(DISTINCT c.rowid) as nb,"; @@ -2401,6 +2408,7 @@ function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande fournisseur pour le produit/service * @@ -2409,9 +2417,9 @@ function load_stats_commande($socid=0,$filtrestatut='', $forVirtualStock = 0) * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT c.fk_soc) as nb_suppliers, COUNT(DISTINCT c.rowid) as nb,"; @@ -2445,6 +2453,7 @@ function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualS } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats expedition client pour le produit/service * @@ -2453,9 +2462,9 @@ function load_stats_commande_fournisseur($socid=0,$filtrestatut='', $forVirtualS * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT e.fk_soc) as nb_customers, COUNT(DISTINCT e.rowid) as nb,"; @@ -2493,6 +2502,7 @@ function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats réception fournisseur pour le produit/service * @@ -2501,9 +2511,9 @@ function load_stats_sending($socid=0,$filtrestatut='', $forVirtualStock = 0) * @param int $forVirtualStock Ignore rights filter for virtual stock calculation. * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0) { + // phpcs:enable global $conf,$user; $sql = "SELECT COUNT(DISTINCT cf.fk_soc) as nb_customers, COUNT(DISTINCT cf.rowid) as nb,"; @@ -2537,15 +2547,16 @@ function load_stats_reception($socid=0,$filtrestatut='', $forVirtualStock = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats contrat pour le produit/service * - * @param int $socid Id societe + * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_contrat($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2580,15 +2591,16 @@ function load_stats_contrat($socid=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats facture pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2623,15 +2635,16 @@ function load_stats_facture($socid=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats facture pour le produit/service * * @param int $socid Id societe * @return array Tableau des stats */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stats_facture_fournisseur($socid=0) { + // phpcs:enable global $conf; global $user; @@ -2666,6 +2679,7 @@ function load_stats_facture_fournisseur($socid=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an array formated for showing graphs * @@ -2674,9 +2688,9 @@ function load_stats_facture_fournisseur($socid=0) * @param int $year Year (0=current year) * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _get_stats($sql, $mode, $year=0) { + // phpcs:enable $resql = $this->db->query($sql); if ($resql) { @@ -2731,6 +2745,7 @@ function _get_stats($sql, $mode, $year=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or customers invoices in which product is included * @@ -2741,9 +2756,9 @@ function _get_stats($sql, $mode, $year=0) * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2768,6 +2783,7 @@ function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or supplier invoices in which product is included * @@ -2778,9 +2794,9 @@ function get_nb_vente($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2804,6 +2820,7 @@ function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or proposals in which product is included * @@ -2814,9 +2831,9 @@ function get_nb_achat($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2840,6 +2857,7 @@ function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefil return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or proposals in which product is included * @@ -2850,9 +2868,9 @@ function get_nb_propal($socid, $mode, $filteronproducttype=-1, $year=0, $morefil * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf; global $user; @@ -2876,6 +2894,7 @@ function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or orders in which product is included * @@ -2886,9 +2905,9 @@ function get_nb_propalsupplier($socid, $mode, $filteronproducttype=-1, $year=0, * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf, $user; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; @@ -2911,6 +2930,7 @@ function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or orders in which product is included * @@ -2921,9 +2941,9 @@ function get_nb_order($socid, $mode, $filteronproducttype=-1, $year=0, $morefilt * @param string $morefilter More sql filters * @return array <0 if KO, result[month]=array(valuex,valuey) where month is 0 to 11 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $morefilter='') { + // phpcs:enable global $conf, $user; $sql = "SELECT sum(d.qty), date_format(c.date_commande, '%Y%m')"; @@ -2946,6 +2966,7 @@ function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $ return $this->_get_stats($sql,$mode, $year); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link a product/service to a parent product/service * @@ -2955,9 +2976,9 @@ function get_nb_ordersupplier($socid, $mode, $filteronproducttype=-1, $year=0, $ * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { + // phpcs:enable // Clean parameters if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_fils)) $id_fils=0; @@ -3003,6 +3024,7 @@ function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify composed product * @@ -3012,9 +3034,9 @@ function add_sousproduit($id_pere, $id_fils, $qty, $incdec=1) * @param int $incdec 1=Increase/decrease stock of child when parent stock increase/decrease * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) { + // phpcs:enable // Clean parameters if (! is_numeric($id_pere)) $id_pere=0; if (! is_numeric($id_fils)) $id_fils=0; @@ -3037,6 +3059,7 @@ function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retire le lien entre un sousproduit et un produit/service * @@ -3044,9 +3067,9 @@ function update_sousproduit($id_pere, $id_fils, $qty, $incdec=1) * @param int $fk_child Id du produit a ne plus lie * @return int < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_sousproduit($fk_parent, $fk_child) { + // phpcs:enable if (! is_numeric($fk_parent)) $fk_parent=0; if (! is_numeric($fk_child)) $fk_child=0; @@ -3064,16 +3087,17 @@ function del_sousproduit($fk_parent, $fk_child) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si c'est un sous-produit * - * @param int $fk_parent Id du produit auquel le produit est lie - * @param int $fk_child Id du produit lie + * @param int $fk_parent Id du produit auquel le produit est lie + * @param int $fk_child Id du produit lie * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_sousproduit($fk_parent, $fk_child) { + // phpcs:enable $sql = "SELECT fk_product_pere, qty, incdec"; $sql.= " FROM ".MAIN_DB_PREFIX."product_association"; $sql.= " WHERE fk_product_pere = '".$fk_parent."'"; @@ -3105,6 +3129,7 @@ function is_sousproduit($fk_parent, $fk_child) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a supplier price for the product. * Note: Duplicate ref is accepted for different quantity only, or for different companies. @@ -3115,9 +3140,9 @@ function is_sousproduit($fk_parent, $fk_child) * @param float $quantity Quantity minimum for price * @return int < 0 if KO, 0 if link already exists for this product, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity) { + // phpcs:enable global $conf; $now=dol_now(); @@ -3210,14 +3235,15 @@ function add_fournisseur($user, $id_fourn, $ref_fourn, $quantity) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des fournisseurs du produit/service * * @return array Tableau des id de fournisseur */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_suppliers() { + // phpcs:enable global $conf; $list = array(); @@ -3243,6 +3269,7 @@ function list_suppliers() return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recopie les prix d'un produit/service sur un autre * @@ -3250,9 +3277,9 @@ function list_suppliers() * @param int $toId Id product target * @return nt < 0 if KO, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_price($fromId, $toId) { + // phpcs:enable $this->db->begin(); // les prix @@ -3272,6 +3299,7 @@ function clone_price($fromId, $toId) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Clone links between products * @@ -3279,9 +3307,9 @@ function clone_price($fromId, $toId) * @param int $toId Product id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_associations($fromId, $toId) { + // phpcs:enable $this->db->begin(); $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association (fk_product_pere, fk_product_fils, qty)'; @@ -3299,6 +3327,7 @@ function clone_associations($fromId, $toId) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recopie les fournisseurs et prix fournisseurs d'un produit/service sur un autre * @@ -3306,9 +3335,9 @@ function clone_associations($fromId, $toId) * @param int $toId Id produit cible * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clone_fournisseurs($fromId, $toId) { + // phpcs:enable $this->db->begin(); $now=dol_now(); @@ -3347,6 +3376,7 @@ function clone_fournisseurs($fromId, $toId) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction recursive uniquement utilisee par get_arbo_each_prod, recompose l'arborescence des sousproduits * Define value of this->res @@ -3358,9 +3388,9 @@ function clone_fournisseurs($fromId, $toId) * @param int $id_parent Id parent * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_parent=0) { + // phpcs:enable global $conf,$langs; $product = new Product($this->db); @@ -3407,6 +3437,7 @@ function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_paren } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the tree of subproducts into an array * this->sousprods is loaded by this->get_sousproduits_arbo() @@ -3414,9 +3445,9 @@ function fetch_prod_arbo($prod, $compl_path="", $multiply=1, $level=1, $id_paren * @param int $multiply Because each sublevel must be multiplicated by parent nb * @return array $this->res */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_arbo_each_prod($multiply=1) { + // phpcs:enable $this->res = array(); if (isset($this->sousprods) && is_array($this->sousprods)) { @@ -3558,15 +3589,16 @@ function getChildsArbo($id, $firstlevelonly=0, $level=1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tree of all subproducts for product. Tree contains id, name and quantity. * Set this->sousprods * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sousproduits_arbo() { + // phpcs:enable $parent=array(); foreach($this->getChildsArbo($this->id) as $keyChild => $valueChild) // Warning. getChildsArbo can call getChildsArbo recursively. Starting point is $value[0]=id of product @@ -3760,6 +3792,7 @@ function getLibStatut($mode=0, $type=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3768,9 +3801,9 @@ function getLibStatut($mode=0, $type=0) * @param int $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0,$type=0) { + // phpcs:enable global $conf, $langs; $langs->load('products'); @@ -3855,6 +3888,7 @@ function getLibFinished() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product * @@ -3869,9 +3903,9 @@ function getLibFinished() * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $inventorycode='', $origin_element='', $origin_id=null) { + // phpcs:enable if ($id_entrepot) { $this->db->begin(); @@ -3901,6 +3935,7 @@ function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $pri } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product with batch number * @@ -3918,9 +3953,9 @@ function correct_stock($user, $id_entrepot, $nbpiece, $movement, $label='', $pri * @param int $origin_id Origin id of element * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='', $price=0, $dlc='', $dluo='',$lot='', $inventorycode='', $origin_element='', $origin_id=null) { + // phpcs:enable if ($id_entrepot) { $this->db->begin(); @@ -3950,6 +3985,7 @@ function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='' } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load information about stock of a product into ->stock_reel, ->stock_warehouse[] (including stock_warehouse[idwarehouse]->detail_batch for batch products) * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. @@ -3964,9 +4000,9 @@ function correct_stock_batch($user, $id_entrepot, $nbpiece, $movement, $label='' * @return int < 0 if KO, > 0 if OK * @see load_virtual_stock, getBatchInfo */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_stock($option='') { + // phpcs:enable global $conf; $this->stock_reel = 0; @@ -4031,6 +4067,7 @@ function load_stock($option='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load value ->stock_theorique of a product. Property this->id must be defined. * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. @@ -4038,9 +4075,9 @@ function load_stock($option='') * @return int < 0 if KO, > 0 if OK * @see load_stock, getBatchInfo */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_virtual_stock() { + // phpcs:enable global $conf; $stock_commande_client=0; @@ -4131,6 +4168,7 @@ function loadBatchInfo($batch) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Move an uploaded file described into $file array into target directory $sdir. * @@ -4138,9 +4176,9 @@ function loadBatchInfo($batch) * @param string $file Array of file info of file to upload: array('name'=>..., 'tmp_name'=>...) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { + // phpcs:enable global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -4173,15 +4211,16 @@ function add_photo($sdir, $file) else return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if at least one photo is available * * @param string $sdir Directory to scan * @return boolean True if at least one photo is available, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_photo_available($sdir) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; @@ -4210,6 +4249,7 @@ function is_photo_available($sdir) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne tableau de toutes les photos du produit * @@ -4217,9 +4257,9 @@ function is_photo_available($sdir) * @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'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -4266,15 +4306,16 @@ function liste_photos($dir,$nbmax=0) return $tabobj; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Efface la photo du produit et sa vignette * * @param string $file Chemin de l'image * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -4302,29 +4343,31 @@ function delete_photo($file) } } + // 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 $file_osencoded=dol_osencode($file); $infoImg = getimagesize($file_osencoded); // Get information on image $this->imgWidth = $infoImg[0]; // Largeur de l'image $this->imgHeight = $infoImg[1]; // Hauteur de l'image } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators this->nb for the dashboard * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user, $hookmanager; $this->nb=array(); @@ -4380,6 +4423,7 @@ function isService() return ($this->type == Product::TYPE_SERVICE ? true : false); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get a barcode from the module to generate barcode values. * Return value is stored into this->barcode @@ -4388,9 +4432,9 @@ function isService() * @param string $type Barcode type (ean, isbn, ...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_barcode($object,$type='') { + // phpcs:enable global $conf; $result=''; @@ -4509,14 +4553,15 @@ function hasbatch() } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return minimum product recommended price * - * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE + * @return int Minimum recommanded price that is higher price among all suppliers * PRODUCT_MINIMUM_RECOMMENDED_PRICE */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function min_recommended_price() { + // phpcs:enable global $conf; $maxpricesupplier=0; diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 16ff44e563c49..fc36c64a3eb3c 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -73,7 +73,7 @@ function create($user, $notrigger=0) $error=0; // Clean parameters - $this->clean_param(); + $this->cleanParam(); // Check parameters // Put here code to add control on parameters values @@ -204,7 +204,7 @@ function update($user=null, $notrigger=0) $error=0; // Clean parameters - $this->clean_param(); + $this->cleanParam(); // TODO Check qty is ok for stock move. Negative may not be allowed. if ($this->qty < 0) @@ -402,8 +402,7 @@ function initAsSpecimen() * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function clean_param() + private function cleanParam() { if (isset($this->fk_product_stock)) $this->fk_product_stock=(int) trim($this->fk_product_stock); if (isset($this->batch)) $this->batch=trim($this->batch); diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 19fa3e3e6274c..ae5cbd0e580fe 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -38,7 +38,7 @@ class Inventory extends CommonObject * @var string ID to identify managed object */ public $element = 'inventory'; - + /** * @var string Name of table without prefix where object is stored */ @@ -48,7 +48,7 @@ class Inventory extends CommonObject * @var array Does inventory support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for inventory */ @@ -123,22 +123,22 @@ class Inventory extends CommonObject * @var int Name of subtable line */ //public $table_element_line = 'inventorydet'; - + /** * @var int Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_inventory'; - + /** * @var int Name of subtable class that manage subtable lines */ //public $class_element_line = 'Inventoryline'; - + /** * @var array Array of child tables (child tables to delete before deleting a record) */ //protected $childtables=array('inventorydet'); - + /** * @var InventoryLine[] Array of subtable lines */ @@ -339,6 +339,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -346,9 +347,9 @@ function getLibStatut($mode=0) * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long 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) diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index 651ee59c22e00..e0c15d0352091 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -44,7 +44,7 @@ class ProductStockEntrepot extends CommonObject * @var string Id to identify managed objects */ public $element = 'ProductStockEntrepot'; - + /** * @var string Name of table without prefix where object is stored */ @@ -511,6 +511,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -518,9 +519,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/test/phpunit/CoreTest.php b/test/phpunit/CoreTest.php index c29adf0861fa4..c725d66876383 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -250,6 +250,7 @@ public function testSqlAndScriptInject() // This is code copied from main.inc.php !!!!!!!!!!!!!!! + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Security: SQL Injection and XSS Injection (scripts) protection (Filters on GET, POST, PHP_SELF). * @@ -257,9 +258,9 @@ public function testSqlAndScriptInject() * @param string $type 1=GET, 0=POST, 2=PHP_SELF * @return int >0 if there is an injection */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function test_sql_and_script_inject($val, $type) { + // phpcs:enable $inj = 0; // For SQL Injection (only GET and POST are used to be included into bad escaped SQL requests) if ($type != 2) From e98b8e5e25cded665b3511b1207034809294f69d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 09:27:59 +0200 Subject: [PATCH 02/30] move phpcs:ignore --- dev/translation/autotranslator.class.php | 5 +- htdocs/comm/action/class/actioncomm.class.php | 22 +-- .../action/class/actioncommreminder.class.php | 9 +- htdocs/commande/class/commande.class.php | 54 ++++--- htdocs/core/class/html.form.class.php | 142 ++++++++++++------ htdocs/loan/class/loanschedule.class.php | 7 +- htdocs/societe/class/address.class.php | 6 +- htdocs/societe/class/client.class.php | 3 +- 8 files changed, 159 insertions(+), 89 deletions(-) diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 3d1445b0ccebb..123b7f6157db8 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -64,7 +64,7 @@ function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey) // Translate //ini_set('default_charset','UTF-8'); ini_set('default_charset',$this->_outputpagecode); - $this->parse_refLangTranslationFiles(); + $this->parseRefLangTranslationFiles(); } /** @@ -72,8 +72,7 @@ function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function parse_refLangTranslationFiles() + private function parseRefLangTranslationFiles() { $files = $this->getTranslationFilesArray($this->_refLang); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6ad7ce68ba7ca..ef6e2d2c5e463 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -38,21 +38,21 @@ class ActionComm extends CommonObject * @var string ID to identify managed object */ public $element='action'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'actioncomm'; - + public $table_rowid = 'id'; public $picto='action'; - + /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * @var int */ public $ismultientitymanaged = 1; - + /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user, 2=Same than 1 but accept record if fksoc is empty * @var integer @@ -694,14 +694,15 @@ function fetchResources() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize this->userassigned array with list of id of user assigned to event * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_userassigned() { + // phpcs:enable $sql ="SELECT fk_actioncomm, element_type, fk_element, answer_status, mandatory, transparency"; $sql.=" FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql.=" WHERE element_type = 'user' AND fk_actioncomm = ".$this->id; @@ -1017,6 +1018,7 @@ static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filte } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1024,10 +1026,10 @@ static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filte * @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $load_state_board=0) { - global $conf, $langs; + // phpcs:enable + global $conf, $langs; if(empty($load_state_board)) $sql = "SELECT a.id, a.datep as dp"; else { @@ -1142,6 +1144,7 @@ function getLibStatut($mode,$hidenastatus=0) return $this->LibStatut($this->percentage,$mode,$hidenastatus,$this->datep); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of action status * @@ -1151,9 +1154,9 @@ function getLibStatut($mode,$hidenastatus=0) * @param int $datestart Date start of event * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($percent,$mode,$hidenastatus=0,$datestart='') { + // phpcs:enable global $langs; if ($mode == 0) @@ -1351,6 +1354,7 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Export events from database into a cal file. * @@ -1361,9 +1365,9 @@ function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overw * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @return int <0 if error, nb of events in new file if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_exportfile($format,$type,$cachedelay,$filename,$filters) { + // phpcs:enable global $conf,$langs,$dolibarr_main_url_root,$mysoc; require_once DOL_DOCUMENT_ROOT ."/core/lib/xcal.lib.php"; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index ca1a97c54066e..afee2690e773c 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -34,17 +34,17 @@ class ActionCommReminder extends CommonObject * @var string ID to identify managed object */ public $element = 'actioncomm_reminder'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'actioncomm_reminder'; - + /** * @var array Does actioncommreminder support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var string String with name of icon for actioncommreminder. Must be the part after the 'object_' into object_actioncommreminder.png */ @@ -168,6 +168,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -175,9 +176,9 @@ function getLibStatut($mode=0) * @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) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4c2cd368aaccc..011846ba08e4a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -429,6 +429,7 @@ function valid($user, $idwarehouse=0, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -436,9 +437,9 @@ function valid($user, $idwarehouse=0, $notrigger=0) * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user, $idwarehouse=-1) { + //phpcs:enable global $conf,$langs; $error=0; @@ -511,6 +512,7 @@ function set_draft($user, $idwarehouse=-1) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag the order as validated (opened) * Function used when order is reopend after being closed. @@ -518,9 +520,9 @@ function set_draft($user, $idwarehouse=-1) * @param User $user Object user that change status * @return int <0 if KO, 0 if nothing is done, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_reopen($user) { + // phpcs:enable $error=0; if ($this->statut != self::STATUS_CANCELED && $this->statut != self::STATUS_CLOSED) @@ -1476,6 +1478,7 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array * $this->client must be loaded @@ -1490,9 +1493,9 @@ function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $f * 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.0, $date_start='', $date_end='') { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -1715,15 +1718,16 @@ function fetch($id, $ref='', $ref_ext='', $ref_int='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the order in DB * * @param int $idremise Id de la remise fixe * @return int >0 si ok, <0 si 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'; @@ -1793,15 +1797,16 @@ function insert_discount($idremise) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load array lines * * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($only_product=0) { + // phpcs:enable $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_product, l.fk_parent_line, l.product_type, l.fk_commande, l.label as custom_label, l.description, l.price, l.qty, l.vat_src_code, l.tva_tx,'; @@ -2019,6 +2024,7 @@ function loadExpeditions($filtre_statut=-1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns a array with expeditions lines number * @@ -2026,9 +2032,9 @@ function loadExpeditions($filtre_statut=-1) * * TODO deprecate, move to Shipping class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_expedition() { + // phpcs:enable $sql = 'SELECT count(*)'; $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e'; $sql.= ', '.MAIN_DB_PREFIX.'element_element as el'; @@ -2045,6 +2051,7 @@ function nb_expedition() else dol_print_error($this->db); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a array with the pending stock by product * @@ -2053,9 +2060,9 @@ function nb_expedition() * * TODO FONCTION NON FINIE A FINIR */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function stock_array($filtre_statut=self::STATUS_CANCELED) { + // phpcs:enable $this->stocks = array(); // Tableau des id de produit de la commande @@ -2162,6 +2169,7 @@ function deleteline($user=null, $lineid=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise relative * @@ -2170,9 +2178,9 @@ function deleteline($user=null, $lineid=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) @@ -2229,6 +2237,7 @@ function set_remise($user, $remise, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise absolue * @@ -2237,9 +2246,9 @@ function set_remise($user, $remise, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if ($user->rights->commande->creer) @@ -2296,6 +2305,7 @@ function set_remise_absolue($user, $remise, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the order date * @@ -2304,9 +2314,9 @@ function set_remise_absolue($user, $remise, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -2361,6 +2371,7 @@ function set_date($user, $date, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -2369,9 +2380,9 @@ function set_date($user, $date, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -2426,6 +2437,7 @@ function set_date_livraison($user, $date_livraison, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of orders (eventuelly filtered on a user) into an array * @@ -2439,9 +2451,9 @@ function set_date_livraison($user, $date_livraison, $notrigger=0) * @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, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') { + // phpcs:enable global $user; $ga = array(); @@ -2570,6 +2582,7 @@ function availability($availability_id, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update order demand_reason * @@ -2577,9 +2590,9 @@ function availability($availability_id, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demand_reason($demand_reason_id, $notrigger=0) { + // phpcs:enable global $user; dol_syslog('Commande::demand_reason('.$demand_reason_id.')'); @@ -2641,6 +2654,7 @@ function demand_reason($demand_reason_id, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -2649,9 +2663,9 @@ function demand_reason($demand_reason_id, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($user, $ref_client, $notrigger=0) { + // phpcs:enable if ($user->rights->commande->creer) { $error=0; @@ -3254,15 +3268,16 @@ function delete($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3340,6 +3355,7 @@ function getLibStatut($mode) return $this->LibStatut($this->statut, $this->billed, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -3349,9 +3365,9 @@ function getLibStatut($mode) * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$billed,$mode,$donotshowbilled=0) { + // phpcs:enable global $langs, $conf; $billedtext = ''; @@ -3660,14 +3676,15 @@ function initAsSpecimen() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -4296,14 +4313,15 @@ function update(User $user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update totals of order into database * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Clean parameters diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0419e2cfc689b..bbe7fc7d071d2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -51,12 +51,12 @@ class Form * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + var $num; // Cache arrays @@ -653,6 +653,7 @@ function initCheckForSelect(mode) /* mode is 0 during init of page or click all, return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list of activated countries, into language of user * @@ -666,9 +667,9 @@ function initCheckForSelect(mode) /* mode is 0 during init of page or click all, * @param int $disablefavorites Disable favorites * @return string HTML string with select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0) { + // phpcs:enable global $conf,$langs; $langs->load("dict"); @@ -750,6 +751,7 @@ function select_country($selected='', $htmlname='country_id', $htmloption='', $m return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of incoterms * @@ -762,9 +764,9 @@ function select_country($selected='', $htmlname='country_id', $htmloption='', $m * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with select and input */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_incoterms($selected='', $location_incoterms='', $page='', $htmlname='incoterm_id', $htmloption='', $forcecombo=1, $events=array()) { + // phpcs:enable global $conf,$langs; $langs->load("dict"); @@ -843,6 +845,7 @@ function select_incoterms($selected='', $location_incoterms='', $page='', $htmln return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of lines (product or service) * Example: 0=product, 1=service, 9=other (for external module) @@ -854,9 +857,9 @@ function select_incoterms($selected='', $location_incoterms='', $page='', $htmln * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0) { + // phpcs:enable global $db,$langs,$user,$conf; // If product & services are enabled or both disabled. @@ -899,14 +902,15 @@ function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidete } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into cache cache_types_fees, array of types of fees * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_fees() { + // phpcs:enable global $langs; $num = count($this->cache_types_fees); @@ -947,6 +951,7 @@ function load_cache_types_fees() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes * @@ -955,9 +960,9 @@ function load_cache_types_fees() * @param int $showempty Add an empty field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees($selected='',$htmlname='type',$showempty=0) { + // phpcs:enable global $user, $langs; dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); @@ -986,6 +991,7 @@ function select_type_fees($selected='',$htmlname='type',$showempty=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML code to select a company. * @@ -998,12 +1004,13 @@ function select_type_fees($selected='',$htmlname='type',$showempty=0) * @return string Return select box for thirdparty. * @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0) { + // phpcs:enable return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0, $limit); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a third party * @@ -1023,9 +1030,9 @@ function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=2 * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @return string HTML string with select box for thirdparty. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -1067,6 +1074,7 @@ function select_company($selected='', $htmlname='socid', $filter='', $showempty= return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a third party. * Note, you must use the select_company to get the component to select a third party. This function must only be called by select_company. @@ -1086,9 +1094,9 @@ function select_company($selected='', $htmlname='socid', $filter='', $showempty= * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML string with */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -1248,6 +1256,7 @@ function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showe } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of absolute discounts * @@ -1258,9 +1267,9 @@ function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showe * @param int $maxvalue Max value for lines that can be selected * @return int Return number of qualifed lines in list */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) { + // phpcs:enable global $langs,$conf; // On recherche les remises @@ -1324,6 +1333,7 @@ function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of all contacts (for a third party or all) * @@ -1344,9 +1354,9 @@ function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) * @return int <0 if KO, Nb of contact in list if OK * @deprected You can use selectcontacts directly (warning order of param was changed) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $events=array(), $options_only=false, $moreparam='', $htmlid='') { + // phpcs:enable print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); return $this->num; } @@ -1484,6 +1494,7 @@ function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty= } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users * @@ -1499,12 +1510,13 @@ function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty= * @deprecated Use select_dolusers instead * @see select_dolusers() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity='0') { + // phpcs:enable print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users * @@ -1528,9 +1540,9 @@ function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=nul * @return string HTML select string * @see select_dolgroups */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false) { + // phpcs:enable global $conf,$user,$langs; // If no preselected user defined, we take current user @@ -1713,6 +1725,7 @@ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclu } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users. Selected users are stored into session. * List of users are provided into $_SESSION['assignedtouser']. @@ -1735,9 +1748,9 @@ function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclu * @return string HTML select string * @see select_dolgroups */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) { + // phpcs:enable global $conf, $user, $langs; $userstatic=new User($this->db); @@ -1802,6 +1815,7 @@ function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for customer in Ajax if Ajax activated or go to select_produits_list * @@ -1827,9 +1841,9 @@ function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array()) { + // phpcs:enable global $langs,$conf; $price_level = (! empty($price_level) ? $price_level : 0); @@ -1945,6 +1959,7 @@ function select_produits($selected='', $htmlname='productid', $filtertype='', $l } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for a customer * @@ -1968,9 +1983,9 @@ function select_produits($selected='', $htmlname='productid', $filtertype='', $l * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return array Array of keys for json */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') { + // phpcs:enable global $langs,$conf,$user,$db; $out=''; @@ -2432,6 +2447,7 @@ private function constructProductListOption(&$objp, &$opt, &$optJson, $price_lev $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for customer (in Ajax if Ajax activated or go to select_produits_fournisseurs_list) * @@ -2445,9 +2461,9 @@ private function constructProductListOption(&$objp, &$opt, &$optJson, $price_lev * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0) { + // phpcs:enable global $langs,$conf; global $price_level, $status, $finished; @@ -2474,6 +2490,7 @@ function select_produits_fournisseurs($socid, $selected='', $htmlname='productid } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers products * @@ -2489,9 +2506,9 @@ function select_produits_fournisseurs($socid, $selected='', $htmlname='productid * @param int $alsoproductwithnosupplierprice 1=Add also product without supplier prices * @return array Array of keys for json */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0) { + // phpcs:enable global $langs,$conf,$db; $out=''; @@ -2704,6 +2721,7 @@ function select_produits_fournisseurs_list($socid,$selected='',$htmlname='produc } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers prices for a product * @@ -2712,9 +2730,9 @@ function select_produits_fournisseurs_list($socid,$selected='',$htmlname='produc * @param int $selected_supplier Pre-selected supplier if more than 1 result * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_product_fourn_price($productid, $htmlname='productfournpriceid', $selected_supplier='') { + // phpcs:enable global $langs,$conf; $langs->load('stocks'); @@ -2816,6 +2834,7 @@ function select_product_fourn_price($productid, $htmlname='productfournpriceid', } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of delivery address * @@ -2825,10 +2844,10 @@ function select_product_fourn_price($productid, $htmlname='productfournpriceid', * @param int $showempty Add an empty field * @return integer|null */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_address($selected, $socid, $htmlname='address_id',$showempty=0) { - // On recherche les utilisateurs + // phpcs:enable + // looking for users $sql = "SELECT a.rowid, a.label"; $sql .= " FROM ".MAIN_DB_PREFIX ."societe_address as a"; $sql .= " WHERE a.fk_soc = ".$socid; @@ -2869,14 +2888,15 @@ function select_address($selected, $socid, $htmlname='address_id',$showempty=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into cache list of payment terms * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_conditions_paiements() { + // phpcs:enable global $langs; $num = count($this->cache_conditions_paiements); @@ -2917,14 +2937,15 @@ function load_cache_conditions_paiements() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge dans cache la liste des délais de livraison possibles * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_availability() { + // phpcs:enable global $langs; $num = count($this->cache_availability); @@ -3084,14 +3105,15 @@ function selectInputReason($selected='',$htmlname='demandreasonid',$exclude='',$ if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge dans cache la liste des types de paiements possibles * * @return int Nb of lines loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_types_paiements() { + // phpcs:enable global $langs; $num=count($this->cache_types_paiements); @@ -3137,6 +3159,7 @@ function load_cache_types_paiements() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of payment modes. * Constant MAIN_DEFAULT_PAYMENT_TERM_ID can used to set default value but scope is all application, probably not what you want. @@ -3150,9 +3173,9 @@ function load_cache_types_paiements() * @param string $morecss Add more CSS on select tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='') { + // phpcs:enable global $langs, $user, $conf; dol_syslog(__METHOD__." selected=".$selected.", htmlname=".$htmlname, LOG_DEBUG); @@ -3182,6 +3205,7 @@ function select_conditions_paiements($selected=0, $htmlname='condid', $filtertyp } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of payment methods * @@ -3196,9 +3220,9 @@ function select_conditions_paiements($selected=0, $htmlname='condid', $filtertyp * @param string $morecss Add more CSS on select tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') { + // phpcs:enable global $langs,$user; dol_syslog(__METHOD__." ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); @@ -3458,6 +3482,7 @@ function selectUnits($selected = '', $htmlname = 'units', $showempty=0) return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of bank accounts * @@ -3470,9 +3495,9 @@ function selectUnits($selected = '', $htmlname = 'units', $showempty=0) * @param int $showcurrency Show currency in label * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0) { + // phpcs:enable global $langs, $conf; $langs->load("admin"); @@ -3562,6 +3587,7 @@ function formSelectAccount($page, $selected='', $htmlname='fk_account', $addempt } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of categories having choosed type * @@ -3574,9 +3600,9 @@ function formSelectAccount($page, $selected='', $htmlname='fk_account', $addempt * @return string * @see select_categories */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0) { + // phpcs:enable global $conf, $langs; $langs->load("categories"); @@ -3648,6 +3674,7 @@ function select_all_categories($type, $selected='', $htmlname="parent", $maxleng return $output; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a confirmation HTML form or AJAX popup * @@ -3664,9 +3691,9 @@ function select_all_categories($type, $selected='', $htmlname="parent", $maxleng * @deprecated * @see formconfirm() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) { + // phpcs:enable print $this->formconfirm($page, $title, $question, $action, $formquestion, $selectedchoice, $useajax, $height, $width); } @@ -3960,6 +3987,7 @@ function formconfirm($page, $title, $question, $action, $formquestion='', $selec } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a project * @@ -3973,9 +4001,9 @@ function formconfirm($page, $title, $question, $action, $formquestion='', $selec * @param int $nooutput No print is done. String is returned. * @return string Return html content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) { + // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; @@ -4019,6 +4047,7 @@ function form_project($page, $socid, $selected='', $htmlname='projectid', $disca return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select payment conditions * @@ -4028,9 +4057,9 @@ function form_project($page, $socid, $selected='', $htmlname='projectid', $disca * @param int $addempty Add empty entry * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4053,6 +4082,7 @@ function form_conditions_reglement($page, $selected='', $htmlname='cond_reglemen } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a delivery delay * @@ -4062,9 +4092,9 @@ function form_conditions_reglement($page, $selected='', $htmlname='cond_reglemen * @param int $addempty Ajoute entree vide * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_availability($page, $selected='', $htmlname='availability', $addempty=0) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4128,6 +4158,7 @@ function formInputReason($page, $selected='', $htmlname='demandreason', $addempt } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form + html select a date * @@ -4140,9 +4171,9 @@ function formInputReason($page, $selected='', $htmlname='demandreason', $addempt * @return string * @see select_date */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) { + // phpcs:enable global $langs; $ret=''; @@ -4170,6 +4201,7 @@ function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select form to choose a user * @@ -4180,9 +4212,9 @@ function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $ * @param array $include List of users id to include * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_users($page, $selected='', $htmlname='userid', $exclude='', $include='') { + // phpcs:enable global $langs; if ($htmlname != "none") @@ -4209,6 +4241,7 @@ function form_users($page, $selected='', $htmlname='userid', $exclude='', $inclu } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with payment mode * @@ -4219,9 +4252,9 @@ function form_users($page, $selected='', $htmlname='userid', $exclude='', $inclu * @param int $active Active or not, -1 = all * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1) { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4244,6 +4277,7 @@ function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id' } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency code * @@ -4252,9 +4286,9 @@ function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id' * @param string $htmlname Name of select html field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_code') { + // phpcs:enable global $langs; if ($htmlname != "none") { @@ -4272,6 +4306,7 @@ function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_c } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency rate * @@ -4281,9 +4316,9 @@ function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_c * @param string $currency Currency code to explain the rate * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') { + // phpcs:enable global $langs, $mysoc, $conf; if ($htmlname != "none") @@ -4314,6 +4349,7 @@ function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select box with available absolute discounts * @@ -4329,9 +4365,9 @@ function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0, $discount_type=0) { + // phpcs:enable global $conf,$langs; if ($htmlname != "none") { @@ -4410,6 +4446,7 @@ function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show forms to select a contact * @@ -4419,9 +4456,9 @@ function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter * @param string $htmlname Name of HTML select. If 'none', we just show contact link. * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_contacts($page, $societe, $selected='', $htmlname='contactid') { + // phpcs:enable global $langs, $conf; if ($htmlname != "none") @@ -4455,6 +4492,7 @@ function form_contacts($page, $societe, $selected='', $htmlname='contactid') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html select to select thirdparty * @@ -4468,9 +4506,9 @@ function form_contacts($page, $societe, $selected='', $htmlname='contactid') * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array()) { + // phpcs:enable global $langs; if ($htmlname != "none") @@ -4498,6 +4536,7 @@ function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$sho } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste des devises, dans la langue de l'utilisateur * @@ -4505,9 +4544,9 @@ function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$sho * @param string $htmlname name of HTML select list * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_currency($selected='',$htmlname='currency_id') { + // phpcs:enable print $this->selectCurrency($selected,$htmlname); } @@ -4610,15 +4649,16 @@ function selectMultiCurrency($selected='', $htmlname='multicurrency_code', $usee return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into the cache vat rates of a country * * @param string $country_code Country code with quotes ("'CA'", or "'CA,IN,...'") * @return int Nb of loaded lines, 0 if already loaded, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_vatrates($country_code) { + // phpcs:enable global $langs; $num = count($this->cache_vatrates); @@ -4676,6 +4716,7 @@ function load_cache_vatrates($country_code) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output an HTML select vat rate. * The name of this function should be selectVat. We keep bad name for compatibility purpose. @@ -4697,9 +4738,9 @@ function load_cache_vatrates($country_code) * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) { + // phpcs:enable global $langs,$conf,$mysoc; $langs->load('errors'); @@ -4864,6 +4905,7 @@ function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a HTML widget to input a date or combo list for day, month, years and optionaly hours and minutes. * Fields are preselected with : @@ -4887,9 +4929,9 @@ function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $ * @return string|null Nothing or string if nooutput is 1 * @see form_date, select_month, select_year, select_dayofweek */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { + // phpcs:enable global $conf,$langs; $retstring=''; @@ -5241,6 +5283,7 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to show a form to select a duration on a page * @@ -5254,9 +5297,9 @@ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_nam * @param int $nooutput Do not output html string but return it * @return string|null */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) { + // phpcs:enable global $langs; $retstring=''; @@ -6440,6 +6483,7 @@ function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of export templates * @@ -6449,10 +6493,9 @@ function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty * @param int $useempty Affiche valeur vide dans liste * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0) { - + // phpcs:enable $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; $sql.= " WHERE type = '".$type."'"; @@ -6815,6 +6858,7 @@ static function showphoto($modulepart, $object, $width=100, $height=0, $caneditf return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of groups * @@ -6830,9 +6874,9 @@ static function showphoto($modulepart, $object, $width=100, $height=0, $caneditf * @return string * @see select_dolusers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false) { + // phpcs:enable global $conf,$user,$langs; // Permettre l'exclusion de groupes diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 80341e8df0c78..a8774244e0070 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -58,7 +58,7 @@ class LoanSchedule extends CommonObject * @deprecated * @see amount, amounts */ - var $total; + public $total; /** * Constructor @@ -372,6 +372,7 @@ function delete($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Calculate mensuality * @@ -380,9 +381,9 @@ function delete($user, $notrigger=0) * @param int $nbterm nb term * @return double mensuality */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calc_mens($capital, $rate, $nbterm) { + // phpcs:enable $result=''; if (!empty($capital) && !empty($rate) && !empty($nbterm)) { @@ -465,7 +466,7 @@ function fetchAll($loanid) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function trans_paiment() { require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 1cb4f1c4b6501..578127fc248f1 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -230,6 +230,7 @@ function update($id, $socid, $user='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base toutes les adresses d'une societe * @@ -237,9 +238,9 @@ function update($id, $socid, $user='') * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines($socid, $user=null) { + // phpcs:enable global $langs, $conf; $sql = 'SELECT rowid, nom as name, client, fournisseur'; @@ -324,6 +325,7 @@ function fetch_lines($socid, $user=null) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base l'objet adresse * @@ -331,9 +333,9 @@ function fetch_lines($socid, $user=null) * @param User $user Objet de l'utilisateur * @return int >0 si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_address($id, $user=null) { + // phpcs:enable global $langs; global $conf; diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 9c24aecae859e..400dc65b0c24d 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -47,14 +47,15 @@ function __construct($db) $this->fournisseur = 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array("customers" => 0,"prospects" => 0); From 47879d44bc5d94ec81fdaaef5088123cf11261af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 09:57:19 +0200 Subject: [PATCH 03/30] move phpcs:ignore --- .../class/accountingjournal.class.php | 3 +- htdocs/api/class/api.class.php | 3 +- .../mailing/class/advtargetemailing.class.php | 12 ++-- .../class/rejetprelevement.class.php | 5 +- htdocs/imports/class/import.class.php | 6 +- .../class/opensurveysondage.class.php | 6 +- .../class/productcustomerprice.class.php | 6 +- htdocs/product/stock/class/entrepot.class.php | 22 ++++--- htdocs/user/class/user.class.php | 61 ++++++++++++------- 9 files changed, 80 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 91cc87e695224..282ac93c72a7a 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -260,6 +260,7 @@ function getLibType($mode=0) return $this->LibType($this->nature,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return type of an accounting journal * @@ -267,9 +268,9 @@ function getLibType($mode=0) * @param int $mode 0=libelle long, 1=libelle court * @return string Label of type */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibType($nature,$mode=0) { + // phpcs:enable global $langs; $langs->loadLangs(array("accountancy")); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 32ebc4fb26e38..6ddb4dae1b39b 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -271,15 +271,16 @@ function _checkFilters($sqlfilters) return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to forge a SQL criteria * * @param array $matches Array of found string by regex search * @return string Forged criteria. Example: "t.field like 'abc%'" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function _forge_criteria_callback($matches) { + // phpcs:enable global $db; //dol_syslog("Convert matches ".$matches[1]); diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 14d1fb20f4e94..c862b8392fde2 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -254,15 +254,16 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * * @param int $id Id object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_mailing($id=0) { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -320,6 +321,7 @@ function fetch_by_mailing($id=0) + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -327,9 +329,9 @@ function fetch_by_mailing($id=0) * @param string $type_element Type target * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_element($id=0, $type_element='mailing') { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -546,15 +548,16 @@ function savequery($user,$arrayquery) + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_thirdparty($arrayquery) { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; @@ -700,6 +703,7 @@ function query_thirdparty($arrayquery) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * @@ -707,9 +711,9 @@ function query_thirdparty($arrayquery) * @param int $withThirdpartyFilter add contact with tridparty filter * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function query_contact($arrayquery, $withThirdpartyFilter = 0) { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 095defe986ae7..6e3cfe499a88b 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -34,7 +34,7 @@ class RejetPrelevement * @var int ID */ public $id; - + /** * @var DoliDB Database handler. */ @@ -199,15 +199,16 @@ function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send email to all users that has asked the withdraw request * * @param Facture $fac Invoice object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _send_email($fac) { + // phpcs:enable global $langs; $userid = 0; diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 3d3e195b7c993..a0d33d4c28a6b 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -65,6 +65,7 @@ function __construct($db) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load description int this->array_import_module, this->array_import_fields, ... of an importable dataset * @@ -72,9 +73,9 @@ function __construct($db) * @param string $filter Load a particular dataset only. Index will start to 0. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { + // phpcs:enable global $langs,$conf; dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); @@ -184,6 +185,7 @@ function load_arrays($user,$filter='') + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build an import example file. * Arrays this->array_export_xxx are already loaded for required datatoexport @@ -194,9 +196,9 @@ function load_arrays($user,$filter='') * @param string $datatoimport Dataset to import * @return string <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_example_file($model, $headerlinefields, $contentlinevalues,$datatoimport) { + // phpcs:enable global $conf,$langs; $indice=0; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 62a9a79861798..f0c0159419185 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -467,14 +467,15 @@ function getNomUrl($withpicto=0, $notooltip=0, $morecss='', $save_lastsearch_val return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of lines * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $ret=array(); $sql = "SELECT id_users, nom as name, reponses FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; @@ -623,6 +624,7 @@ function getLibStatut($mode) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -630,9 +632,9 @@ function getLibStatut($mode) * @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($status,$mode) { + // phpcs:enable global $langs, $conf; //print 'x'.$status.'-'.$billed; diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index bb3782be0bb3f..589321eacb0c7 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -304,6 +304,7 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all customer prices in memory from database * @@ -314,9 +315,9 @@ function fetch($id) * @param array $filter Filter for select * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array()) { + // phpcs:enable global $langs; if ( empty($sortfield)) $sortfield = "t.rowid"; @@ -418,6 +419,7 @@ function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $f } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects in memory from database * @@ -428,9 +430,9 @@ function fetch_all($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $f * @param array $filter Filter for sql request * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_log($sortorder, $sortfield, $limit, $offset, $filter = array()) { + // phpcs:enable global $langs; if (! empty($sortfield)) $sortfield = "t.rowid"; diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 8fa05f5c45315..a0aee6fb2b58f 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -37,12 +37,12 @@ class Entrepot extends CommonObject * @var string ID to identify managed object */ public $element='stock'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='entrepot'; - + public $picto='stock'; /** @@ -415,15 +415,16 @@ function info($id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of all warehouses * * @param int $status Status * @return array Array list of warehouses */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_array($status=1) { + // phpcs:enable $liste = array(); $sql = "SELECT rowid, ref as label"; @@ -447,14 +448,15 @@ function list_array($status=1) return $liste; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of unique different product into a warehouse * * @return Array Array('nb'=>Nb, 'value'=>Value) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_different_products() { + // phpcs:enable $ret=array(); $sql = "SELECT count(distinct p.rowid) as nb"; @@ -480,14 +482,15 @@ function nb_different_products() return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return stock and value of warehosue * * @return Array Array('nb'=>Nb, 'value'=>Value) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function nb_products() { + // phpcs:enable $ret=array(); $sql = "SELECT sum(ps.reel) as nb, sum(ps.reel * p.pmp) as value"; @@ -525,6 +528,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -532,9 +536,9 @@ function getLibStatut($mode=0) * @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'); @@ -652,14 +656,15 @@ function initAsSpecimen() $this->country_code='FR'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return full path to current warehouse * * @return string String full path to current warehouse separated by " >> " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo() { + // phpcs:enable global $user,$langs,$conf; $TArbo = array(empty($this->label)?$this->libelle:$this->label); @@ -693,6 +698,7 @@ function get_full_arbo() return implode(' >> ', array_reverse($TArbo)); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of children warehouses ids from $id warehouse (recursive function) * @@ -700,9 +706,9 @@ function get_full_arbo() * @param array $TChildWarehouses array which will contain all children (param by reference) * @return array $TChildWarehouses array which will contain all children */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children_warehouses($id, &$TChildWarehouses) { + // phpcs:enable $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'entrepot diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7cac041977201..b221f0fa4f3a1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1176,6 +1176,7 @@ function create($user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user from a contact object. User will be internal but if contact is linked to a third party, user will be external * @@ -1184,9 +1185,9 @@ function create($user, $notrigger=0) * @param string $password Password to force * @return int <0 if error, if OK returns id of created user */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_contact($contact,$login='',$password='') { + // phpcs:enable global $conf,$user,$langs; $error=0; @@ -1254,6 +1255,7 @@ function create_from_contact($contact,$login='',$password='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user into database from a member object * @@ -1261,9 +1263,9 @@ function create_from_contact($contact,$login='',$password='') * @param string $login Login to force * @return int <0 if KO, if OK, return id of created account */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member($member,$login='') { + // phpcs:enable global $conf,$user,$langs; // Positionne parametres @@ -1328,14 +1330,15 @@ function create_from_member($member,$login='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign rights by default * * @return integer erreur <0, si ok renvoi le nbre de droits par defaut positionnes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_default_rights() { + // phpcs:enable global $conf; $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def"; @@ -1663,15 +1666,16 @@ function update($user, $notrigger=0, $nosyncmember=0, $nosyncmemberpass=0, $nosy } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base de la date de derniere connexion d'un utilisateur * Fonction appelee lors d'une nouvelle connexion * * @return <0 si echec, >=0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_last_login_date() { + // phpcs:enable $now=dol_now(); $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; @@ -1829,6 +1833,7 @@ function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncm } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send new password by email * @@ -1837,9 +1842,9 @@ function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncm * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @TODO Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_password($user, $password='', $changelater=0) { + // phpcs:enable global $conf,$langs; global $dolibarr_main_url_root; @@ -1944,14 +1949,15 @@ function error() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read clicktodial information for user * * @return <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_clicktodial() { + // phpcs:enable $sql = "SELECT url, login, pass, poste "; $sql.= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; $sql.= " WHERE u.fk_user = ".$this->id; @@ -1981,14 +1987,15 @@ function fetch_clicktodial() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update clicktodial info * * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_clicktodial() { + // phpcs:enable $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; @@ -2021,6 +2028,7 @@ function update_clicktodial() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add user into a group * @@ -2029,9 +2037,9 @@ function update_clicktodial() * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetInGroup($group, $entity, $notrigger=0) { + // phpcs:enable global $conf, $langs, $user; $error=0; @@ -2082,6 +2090,7 @@ function SetInGroup($group, $entity, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a user from a group * @@ -2090,9 +2099,9 @@ function SetInGroup($group, $entity, $notrigger=0) * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function RemoveFromGroup($group, $entity, $notrigger=0) { + // phpcs:enable global $conf,$langs,$user; $error=0; @@ -2355,6 +2364,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2362,9 +2372,9 @@ function getLibStatut($mode=0) * @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($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('users'); @@ -2402,6 +2412,7 @@ function LibStatut($statut,$mode=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2411,9 +2422,9 @@ function LibStatut($statut,$mode=0) * 2=Return key only (RDN) (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN; @@ -2422,14 +2433,15 @@ function _load_ldap_dn($info,$mode=0) return $dn; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); @@ -2692,6 +2704,7 @@ function getNbOfUsers($limitTo, $option='', $admin=-1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update user using data from the LDAP * @@ -2699,9 +2712,9 @@ function getNbOfUsers($limitTo, $option='', $admin=-1) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ldap2dolibarr(&$ldapuser) { + // phpcs:enable // TODO: Voir pourquoi le update met à jour avec toutes les valeurs vide (global $user écrase ?) global $user, $conf; @@ -2729,15 +2742,16 @@ function update_ldap2dolibarr(&$ldapuser) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return and array with all instanciated first level children users of current user * * @return void * @see getAllChildIds */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_children() { + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; $sql.= " WHERE fk_user = ".$this->id; @@ -2767,8 +2781,7 @@ function get_children() * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - private function load_parentof() + private function loadParentOf() { global $conf; @@ -2780,7 +2793,7 @@ private function load_parentof() $sql.= " WHERE fk_user <> 0"; $sql.= " AND entity IN (".getEntity('user').")"; - dol_syslog(get_class($this)."::load_parentof", LOG_DEBUG); + dol_syslog(get_class($this)."::loadParentOf", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -2797,6 +2810,7 @@ private function load_parentof() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau * Set and return this->users that is an array sorted according to tree with arrays of: @@ -2810,9 +2824,9 @@ private function load_parentof() * @param string $filter SQL filter on users * @return array Array of users $this->users. Note: $this->parentof is also set. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_tree($deleteafterid=0, $filter='') { + // phpcs:enable global $conf, $user; global $hookmanager; @@ -2822,7 +2836,7 @@ function get_full_tree($deleteafterid=0, $filter='') $this->users = array(); // Init this->parentof that is array(id_son=>id_parent, ...) - $this->load_parentof(); + $this->loadParentOf(); // Init $this->users array $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates @@ -2941,6 +2955,7 @@ function getAllChildIds($addcurrentuser=0) return $childids; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * For user id_user and its childs available in this->users, define property fullpath and fullname. * Function called by get_full_tree(). @@ -2949,9 +2964,9 @@ function getAllChildIds($addcurrentuser=0) * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) * @return int < 0 if KO (infinit loop), >= 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_user($id_user,$protection=0) { + // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); if (! empty($this->users[$id_user]['fullpath'])) @@ -3004,14 +3019,15 @@ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) } + // 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(); @@ -3075,6 +3091,7 @@ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedes return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of user from its id * @@ -3082,9 +3099,9 @@ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedes * @param string $mode 'email' or 'mobile' * @return string Email of user with format: "Full name " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function user_get_property($rowid,$mode) { + // phpcs:enable $user_property=''; if (empty($rowid)) return ''; From b60f7db60a1c979f36e3cdbc915574871ada366b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 10:43:34 +0200 Subject: [PATCH 04/30] move phpcs:ignore --- htdocs/comm/action/class/ical.class.php | 70 +++++++---- htdocs/core/class/CMailFile.class.php | 27 ++-- htdocs/core/class/antivir.class.php | 5 +- htdocs/core/class/canvas.class.php | 8 +- htdocs/ecm/class/ecmdirectory.class.php | 23 ++-- htdocs/ecm/class/ecmfiles.class.php | 9 +- .../class/companypaymentmode.class.php | 29 ++--- htdocs/societe/class/societe.class.php | 119 ++++++++++++------ htdocs/societe/class/societeaccount.class.php | 9 +- 9 files changed, 183 insertions(+), 116 deletions(-) diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 4d8675bc8ee67..d3c2070d321fc 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -27,7 +27,7 @@ /** - * Class to read/parse ICal calendars + * Class to read/parse ICal calendars */ class ICal { @@ -39,22 +39,23 @@ class ICal var $last_key; //Help variable save last key (multiline string) - /** - * Constructor - */ - public function __construct() - { - } + /** + * Constructor + */ + public function __construct() + { + } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Read text file, icalender text file * * @param string $file File * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function read_file($file) { + // phpcs:enable $this->file = $file; $file_text=''; @@ -67,25 +68,27 @@ function read_file($file) return $file_text; // return all text } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of calendar events * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_count() { + // phpcs:enable return $this->event_count; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the number of to do * * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_count() { + // phpcs:enable return $this->todo_count; } @@ -197,6 +200,7 @@ function parse($uri) return $this->cal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add to $this->ical array one value and key. * @@ -205,9 +209,9 @@ function parse($uri) * @param string $value Value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_array($type, $key, $value) { + // phpcs:enable //print 'type='.$type.' key='.$key.' value='.$value.'
'."\n"; @@ -258,16 +262,17 @@ function add_to_array($type, $key, $value) $this->last_key = $key; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse text "XXXX:value text some with : " and return array($key = "XXXX", $value="value"); * * @param string $text Text * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function retun_key_value($text) { - /* + // phpcs:enable + /* preg_match("/([^:]+)[:]([\w\W]+)/", $text, $matches); if (empty($matches)) @@ -279,19 +284,20 @@ function retun_key_value($text) $matches = array_splice($matches, 1, 2); return $matches; }*/ - return explode(':',$text,2); + return explode(':',$text,2); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Parse RRULE return array * * @param string $value string * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_rrule($value) { - $result=array(); + // phpcs:enable + $result = array(); $rrule = explode(';',$value); foreach ($rrule as $line) { @@ -300,15 +306,17 @@ function ical_rrule($value) } return $result; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Unix time from ical date time fomrat (YYYYMMDD[T]HHMMSS[Z] or YYYYMMDD[T]HHMMSS) * * @param string $ical_date String date * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_date_to_unix($ical_date) { + // phpcs:enable $ical_date = str_replace('T', '', $ical_date); $ical_date = str_replace('Z', '', $ical_date); @@ -322,6 +330,7 @@ function ical_date_to_unix($ical_date) return $ntime; // ntime is a GTM time } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return unix date from iCal date format * @@ -329,10 +338,10 @@ function ical_date_to_unix($ical_date) * @param string $value Value * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dt_date($key, $value) { - $return_value=array(); + // phpcs:enable + $return_value = array(); $value = $this->ical_date_to_unix($value); // Analyse TZID @@ -352,14 +361,15 @@ function ical_dt_date($key, $value) return array($key,$return_value); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return sorted eventlist as array or false if calenar is empty * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_sort_event_list() { + // phpcs:enable $temp = $this->get_event_list(); if (!empty($temp)) { @@ -372,6 +382,7 @@ function get_sort_event_list() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Compare two unix timestamp * @@ -379,64 +390,69 @@ function get_sort_event_list() * @param array $b Operand b * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ical_dtstart_compare($a, $b) { + // phpcs:enable return strnatcasecmp($a['DTSTART']['unixtime'], $b['DTSTART']['unixtime']); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_event_list() { + // phpcs:enable return (! empty($this->cal['VEVENT'])?$this->cal['VEVENT']:''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return eventlist array (not sort eventlist array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_freebusy_list() { + // phpcs:enable return $this->cal['VFREEBUSY']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return to do array (not sort to do array) * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_todo_list() { + // phpcs:enable return $this->cal['VTODO']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return base calendar data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_calender_data() { + // phpcs:enable return $this->cal['VCALENDAR']; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with all data * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_data() { + // phpcs:enable return $this->cal; } } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0fdd33335496e..45998a7886922 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -827,15 +827,16 @@ static function encodetorfc2822($stringtoencode) return '=?'.$conf->file->character_set_client.'?B?'.base64_encode($stringtoencode).'?='; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read a file on disk and return encoded content for emails (mode = 'mail') * * @param string $sourcefile Path to file to encode * @return int <0 if KO, encoded string if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _encode_file($sourcefile) { + // phpcs:enable $newsourcefile=dol_osencode($sourcefile); if (is_readable($newsourcefile)) @@ -853,6 +854,7 @@ function _encode_file($sourcefile) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SMTP request into a dump file (mode = all) * Used for debugging. @@ -860,9 +862,9 @@ function _encode_file($sourcefile) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_mail() { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir @@ -947,14 +949,15 @@ function buildCSS() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create SMTP headers (mode = 'mail') * * @return string headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_smtpheaders() { + // phpcs:enable global $conf; $out = ""; @@ -1010,6 +1013,7 @@ function write_smtpheaders() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create header MIME (mode = 'mail') * @@ -1017,9 +1021,9 @@ function write_smtpheaders() * @param array $mimefilename_list Array of mime types * @return string mime headers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_mimeheaders($filename_list, $mimefilename_list) { + // phpcs:enable $mimedone=0; $out = ""; @@ -1040,15 +1044,16 @@ function write_mimeheaders($filename_list, $mimefilename_list) return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return email content (mode = 'mail') * * @param string $msgtext Message string * @return string String content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_body($msgtext) { + // phpcs:enable global $conf; $out=''; @@ -1141,6 +1146,7 @@ function write_body($msgtext) return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach file to email (mode = 'mail') * @@ -1149,9 +1155,9 @@ function write_body($msgtext) * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_files($filename_list,$mimetype_list,$mimefilename_list) { + // phpcs:enable $out = ''; $filename_list_size=count($filename_list); @@ -1189,15 +1195,16 @@ function write_files($filename_list,$mimetype_list,$mimefilename_list) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach an image to email (mode = 'mail') * * @param array $images_list Tableau * @return string Chaine images encodees */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_images($images_list) { + // phpcs:enable $out = ''; if ($images_list) @@ -1221,6 +1228,7 @@ function write_images($images_list) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Try to create a socket connection * @@ -1228,9 +1236,9 @@ function write_images($images_list) * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_server_port($host,$port) { + // phpcs:enable global $conf; $_retVal=0; @@ -1285,6 +1293,7 @@ function check_server_port($host,$port) return $_retVal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions. @@ -1293,9 +1302,9 @@ function check_server_port($host,$port) * @param string $response Response string * @return boolean true if success */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { + // phpcs:enable $_retVal = true; // Indicates if Object was created or not $server_response = ''; diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index e1a50c6308327..d18501d54d9d1 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -41,7 +41,7 @@ class AntiVir public $errors = array(); var $output; - + /** * @var DoliDB Database handler. */ @@ -57,6 +57,7 @@ function __construct($db) $this->db=$db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Scan a file with antivirus. * This function runs the command defined in setup. This antivirus command must return 0 if OK. @@ -65,9 +66,9 @@ function __construct($db) * @param string $file File to scan * @return int <0 if KO (-98 if error, -99 if virus), 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dol_avscan_file($file) { + // phpcs:enable global $conf; $return = 0; diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index c65b2ba6fe1e6..a4665701661ee 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -32,7 +32,7 @@ class Canvas * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -133,6 +133,7 @@ function getCanvas($module, $card, $canvas) //print ' => template_dir='.$this->template_dir.'
'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Shared method for canvas to assign values for templates * @@ -141,9 +142,9 @@ function getCanvas($module, $card, $canvas) * @param string $ref Object ref (if id not provided) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action='view', $id=0, $ref='') { + // phpcs:enable if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref); } @@ -161,6 +162,7 @@ function displayCanvasExists($action) else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display a canvas page. This will include the template for output. * Variables used by templates may have been defined or loaded before into the assign_values function. @@ -168,9 +170,9 @@ function displayCanvasExists($action) * @param string $action Action code * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_canvas($action) { + // phpcs:enable global $db, $conf, $langs, $user, $canvas; global $form, $formfile; diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 6393d201188e0..349cea676f1d5 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -31,12 +31,12 @@ class EcmDirectory // extends CommonObject * @var string ID to identify managed object */ public $element='ecm_directories'; - + /** * @var string Name of table without prefix where object is stored */ //public $table_element='ecm_directories'; - + var $picto = 'dir'; /** @@ -48,7 +48,7 @@ class EcmDirectory // extends CommonObject * @var string proper name for given parameter */ public $label; - + var $fk_parent; var $description; var $cachenbofdoc=-1; // By default cache initialized with value 'not calculated' @@ -70,7 +70,7 @@ class EcmDirectory // extends CommonObject * @var string Error code (or message) */ public $error; - + /** * @var string[] Error codes (or messages) */ @@ -512,14 +512,15 @@ function getRelativePath($force=0) return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load this->motherof that is array(id_son=>id_parent, ...) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_motherof() { + // phpcs:enable global $conf; $this->motherof=array(); @@ -560,6 +561,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -567,14 +569,15 @@ function getLibStatut($mode=0) * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reconstruit l'arborescence des categories sous la forme d'un tableau à partir de la base de donnée * Renvoi un tableau de tableau('id','id_mere',...) trie selon arbre et avec: @@ -594,9 +597,9 @@ static function LibStatut($status,$mode=0) * @param int $force Force reload of full arbo even if already loaded in cache $this->cats * @return array Tableau de array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($force=0) { + // phpcs:enable global $conf; if (empty($force) && ! empty($this->full_arbo_loaded)) @@ -676,6 +679,7 @@ function get_full_arbo($force=0) return $this->cats; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define properties fullpath, fullrelativename, fulllabel of a directory of array this->cats and all its childs. * Separator between directories is always '/', whatever is OS. @@ -684,9 +688,9 @@ function get_full_arbo($force=0) * @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=0) { + // phpcs:enable // Define fullpath if (! empty($this->cats[$id_categ]['id_mere'])) { @@ -761,6 +765,7 @@ function refreshcachenboffile($all=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance * @@ -772,9 +777,9 @@ function refreshcachenboffile($all=0) * @param User $user Object user * @return int Result of run_triggers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { + // phpcs:enable global $langs,$conf; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 95d4b42a4b6b1..38d155f332862 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -40,12 +40,12 @@ class EcmFiles extends CommonObject * @var string Id to identify managed objects */ public $element = 'ecmfiles'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'ecm_files'; - + public $picto = 'generic'; public $ref; // hash of file path @@ -68,7 +68,7 @@ class EcmFiles extends CommonObject public $acl; public $src_object_type; public $src_object_id; - + /** * Constructor @@ -779,6 +779,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -786,9 +787,9 @@ function getLibStatut($mode=0) * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 4f3b666049b31..7ff2e2de6f9dc 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -36,22 +36,22 @@ class CompanyPaymentMode extends CommonObject * @var string ID to identify managed object */ public $element = 'companypaymentmode'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_rib'; - + /** * @var int Does companypaymentmode support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 2; - + /** * @var int Does companypaymentmode support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 0; - + /** * @var string String with name of icon for companypaymentmode. Must be the part after the 'object_' into object_companypaymentmode.png */ @@ -452,6 +452,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -459,43 +460,37 @@ function getLibStatut($mode=0) * @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/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5c15f82952f94..2cd3ba2f6d8be 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -571,15 +571,16 @@ function create(User $user) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a contact/address from thirdparty * * @param User $user Object user * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_individual(User $user) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contact=new Contact($this->db); @@ -1475,14 +1476,15 @@ function delete($id, User $fuser=null, $call_trigger=1) return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define third party as a customer * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_as_client() { + // phpcs:enable if ($this->id) { $newclient=1; @@ -1502,6 +1504,7 @@ function set_as_client() return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1510,9 +1513,9 @@ function set_as_client() * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_client($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1564,6 +1567,7 @@ function set_remise_client($remise, $note, User $user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1572,9 +1576,9 @@ function set_remise_client($remise, $note, User $user) * @param User $user Utilisateur qui definie la remise * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_supplier($remise, $note, User $user) { + // phpcs:enable global $conf, $langs; // Nettoyage parametres @@ -1626,6 +1630,7 @@ function set_remise_supplier($remise, $note, User $user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount for third party * @@ -1636,9 +1641,9 @@ function set_remise_supplier($remise, $note, User $user) * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, id of discount record if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_except($remise, User $user, $desc, $tva_tx=0, $discount_type=0) { + // phpcs:enable global $langs; // Clean parameters @@ -1771,6 +1776,7 @@ function getSalesRepresentatives(User $user, $mode=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the price level * @@ -1778,9 +1784,9 @@ function getSalesRepresentatives(User $user, $mode=0) * @param User $user Use making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_price_level($price_level, User $user) { + // phpcs:enable if ($this->id) { $now=dol_now(); @@ -1809,6 +1815,7 @@ function set_price_level($price_level, User $user) return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1816,14 +1823,12 @@ function set_price_level($price_level, User $user) * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_commercial(User $user, $commid) { + // phpcs:enable $error=0; - - if ($this->id > 0 && $commid > 0) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; @@ -1848,6 +1853,7 @@ function add_commercial(User $user, $commid) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1855,9 +1861,9 @@ function add_commercial(User $user, $commid) * @param int $commid Id of user * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_commercial(User $user, $commid) { + // phpcs:enable $error=0; $this->context=array('commercial_modified'=>$commid); @@ -2069,6 +2075,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2076,9 +2083,9 @@ function getLibStatut($mode=0) * @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 Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('companies'); @@ -2119,15 +2126,16 @@ function LibStatut($statut,$mode=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails existing for third party * * @param int $addthirdparty 1=Add also a record for thirdparty email * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_email_array($addthirdparty=0) { + // phpcs:enable global $langs; $contact_emails = $this->contact_property_array('email',1); @@ -2140,14 +2148,15 @@ function thirdparty_and_contact_email_array($addthirdparty=0) return $contact_emails; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts mobile phone existing for third party * * @return array Array of contacts emails */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_and_contact_phone_array() { + // phpcs:enable global $langs; $contact_phone = $this->contact_property_array('mobile'); @@ -2161,6 +2170,7 @@ function thirdparty_and_contact_phone_array() return $contact_phone; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails or mobile existing for third party * @@ -2168,9 +2178,9 @@ function thirdparty_and_contact_phone_array() * @param int $hidedisabled 1=Hide contact if disabled * @return array Array of contacts emails or mobile. Example: array(id=>'Name ') */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_property_array($mode='email', $hidedisabled=0) { + // phpcs:enable global $langs; $contact_property = array(); @@ -2230,14 +2240,15 @@ function contact_property_array($mode='email', $hidedisabled=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array() { + // phpcs:enable $contacts = array(); $sql = "SELECT rowid, lastname, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$this->id; @@ -2263,14 +2274,15 @@ function contact_array() return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des contacts de cette societe * * @return array $contacts tableau des contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_array_objects() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; $contacts = array(); @@ -2299,6 +2311,7 @@ function contact_array_objects() return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of contact from its id * @@ -2306,9 +2319,9 @@ function contact_array_objects() * @param string $mode 'email' or 'mobile' * @return string Email of contact with format: "Full name " */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contact_get_property($rowid,$mode) { + // phpcs:enable $contact_property=''; if (empty($rowid)) return ''; @@ -2338,15 +2351,16 @@ function contact_get_property($rowid,$mode) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return bank number property of thirdparty (label or rum) * * @param string $mode 'label' or 'rum' or 'format' * @return string Bank number */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_rib($mode='label') { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($this->db); @@ -2375,14 +2389,15 @@ function display_rib($mode='label') return 'BadParameterToFunctionDisplayRib'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Array of RIB * * @return array|int 0 if KO, Array of CompanyBanckAccount if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_rib() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".$this->id; $result = $this->db->query($sql); @@ -2404,6 +2419,7 @@ function get_all_rib() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code client a partir du module de controle des codes. * Return value is stored into this->code_client @@ -2412,9 +2428,9 @@ function get_all_rib() * @param int $type Should be 0 to say customer * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codeclient($objsoc=0,$type=0) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2435,6 +2451,7 @@ function get_codeclient($objsoc=0,$type=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attribut un code fournisseur a partir du module de controle des codes. * Return value is stored into this->code_fournisseur @@ -2443,9 +2460,9 @@ function get_codeclient($objsoc=0,$type=0) * @param int $type Should be 1 to say supplier * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codefournisseur($objsoc=0,$type=1) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2465,15 +2482,16 @@ function get_codefournisseur($objsoc=0,$type=1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code client est modifiable en fonction des parametres * du module de controle des codes. * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codeclient_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2501,14 +2519,15 @@ function codeclient_modifiable() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie si un code fournisseur est modifiable dans configuration du module de controle des codes * * @return int 0=No, 1=Yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function codefournisseur_modifiable() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2536,6 +2555,7 @@ function codefournisseur_modifiable() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check customer code * @@ -2545,9 +2565,9 @@ function codefournisseur_modifiable() * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codeclient() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2572,6 +2592,7 @@ function check_codeclient() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check supplier code * @@ -2581,9 +2602,9 @@ function check_codeclient() * -3 ErrorCustomerCodeAlreadyUsed * -4 ErrorPrefixRequired */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function check_codefournisseur() { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { @@ -2608,6 +2629,7 @@ function check_codefournisseur() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie un code compta, suivant le module de code compta. * Peut etre identique a celui saisit ou genere automatiquement. @@ -2616,9 +2638,9 @@ function check_codefournisseur() * @param string $type Type of thirdparty ('customer' or 'supplier') * @return string Code compta si ok, 0 si aucun, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_codecompta($type) { + // phpcs:enable global $conf; if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) @@ -2659,15 +2681,16 @@ function get_codecompta($type) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define parent commany of current company * * @param int $id Id of thirdparty to set or '' to remove * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_parent($id) { + // phpcs:enable if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; @@ -2688,15 +2711,16 @@ function set_parent($id) else return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns if a profid sould be verified * * @param int $idprof 1,2,3,4,5,6 (Exemple: 1=siren,2=siret,3=naf,4=rcs/rm,5=idprof5,6=idprof6) * @return boolean true , false */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_verifiable($idprof) { + // phpcs:enable global $conf; switch($idprof) @@ -2726,6 +2750,7 @@ function id_prof_verifiable($idprof) return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verify if a profid exists into database for others thirds * @@ -2734,9 +2759,9 @@ function id_prof_verifiable($idprof) * @param int $socid Id of thirdparty to exclude (if update) * @return boolean True if exists, False if not */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_exists($idprof, $value, $socid=0) { + // phpcs:enable $field = $idprof; switch($idprof) // For backward compatibility @@ -2785,6 +2810,7 @@ function id_prof_exists($idprof, $value, $socid=0) else return false; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verifie la validite d'un identifiant professionnel en fonction du pays de la societe (siren, siret, ...) * @@ -2793,9 +2819,9 @@ function id_prof_exists($idprof, $value, $socid=0) * @return int <=0 if KO, >0 if OK * TODO better to have this in a lib than into a business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_check($idprof,$soc) { + // phpcs:enable global $conf; $ok=1; @@ -2935,6 +2961,7 @@ function id_prof_check($idprof,$soc) return $ok; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an url to check online a professional id or empty string * @@ -2943,9 +2970,9 @@ function id_prof_check($idprof,$soc) * @return string Url or empty string if no URL known * TODO better in a lib than into business class */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function id_prof_url($idprof,$thirdparty) { + // phpcs:enable global $conf,$langs,$hookmanager; $url=''; @@ -2988,14 +3015,15 @@ function id_prof_url($idprof,$thirdparty) return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Indique si la societe a des projets * * @return bool true si la societe a des projets, false sinon */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function has_projects() { + // phpcs:enable $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; $resql = $this->db->query($sql); if ($resql) @@ -3090,14 +3118,15 @@ function isInEEC() return isInEEC($this); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge la liste des categories fournisseurs * * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadSupplierCateg() { + // phpcs:enable $this->SupplierCategories = array(); $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; @@ -3118,15 +3147,16 @@ function LoadSupplierCateg() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert link supplier - category * * @param int $categorie_id Id of category * @return int 0 if success, <> 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFournisseurInCategory($categorie_id) { + // phpcs:enable if ($categorie_id > 0 && $this->id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_soc) "; @@ -3142,6 +3172,7 @@ function AddFournisseurInCategory($categorie_id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a third party into database from a member object * @@ -3150,9 +3181,9 @@ function AddFournisseurInCategory($categorie_id) * @param string $socalias Alias name of third party to force * @return int <0 if KO, id of created account if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from_member(Adherent $member, $socname='', $socalias='') { + // phpcs:enable global $user,$langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); @@ -3419,15 +3450,16 @@ function getLibProspLevel() return $this->LibProspLevel($this->fk_prospectlevel); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of prospect level * * @param int $fk_prospectlevel Prospect level * @return string label of level */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspLevel($fk_prospectlevel) { + // phpcs:enable global $langs; $lib=$langs->trans("ProspectLevel".$fk_prospectlevel); @@ -3440,6 +3472,7 @@ function LibProspLevel($fk_prospectlevel) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set prospect level * @@ -3447,9 +3480,9 @@ function LibProspLevel($fk_prospectlevel) * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_prospect_level(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3465,6 +3498,7 @@ function getLibProspCommStatut($mode=0, $label='') return $this->LibProspCommStatut($this->stcomm_id, $mode, $label); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3473,9 +3507,9 @@ function getLibProspCommStatut($mode=0, $label='') * @param string $label Label to use for status for added status * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibProspCommStatut($statut, $mode=0, $label='') { + // phpcs:enable global $langs; $langs->load('customers'); @@ -3519,6 +3553,7 @@ function LibProspCommStatut($statut, $mode=0, $label='') return "Error, mode/status not found"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set outstanding value * @@ -3526,9 +3561,9 @@ function LibProspCommStatut($statut, $mode=0, $label='') * @return int <0 if KO, >0 if OK * @deprecated Use update function instead */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_OutstandingBill(User $user) { + // phpcs:enable return $this->update($this->id, $user); } @@ -3685,15 +3720,16 @@ function getOutstandingBills($mode='customer') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return amount of bill not paid * * @return int Amount in debt for thirdparty * @deprecated */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_OutstandingBill() { + // phpcs:enable /* Accurate value of remain to pay is to sum remaintopay for each invoice $paiement = $invoice->getSommePaiement(); $creditnotes=$invoice->getSumCreditNotesUsed(); @@ -3739,15 +3775,16 @@ function getLibCustProspStatut() return $this->LibCustProspStatut($this->client); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibCustProspStatut($statut) { + // phpcs:enable global $langs; $langs->load('companies'); diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index e6aabf68f6d33..61e7303a35b78 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -39,17 +39,17 @@ class SocieteAccount extends CommonObject * @var string ID to identify managed object */ public $element = 'societeaccount'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'societe_account'; - + /** * @var array Does societeaccount support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var string String with name of icon for societeaccount. Must be the part after the 'object_' into object_myobject.png */ @@ -395,6 +395,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -402,9 +403,9 @@ function getLibStatut($mode=0) * @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) From 4ea582ad4aa4168eac7f34e0f38ca5aadd435ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 11:12:07 +0200 Subject: [PATCH 05/30] move phpcs:ignore --- htdocs/asset/class/asset.class.php | 21 ++--- htdocs/asset/class/asset_type.class.php | 7 +- htdocs/categories/class/categorie.class.php | 51 ++++++++---- htdocs/comm/mailing/class/mailing.class.php | 37 ++++----- .../stock/class/mouvementstock.class.php | 22 +++-- .../product/stock/class/productlot.class.php | 5 +- .../class/supplier_proposal.class.php | 80 +++++++++++-------- 7 files changed, 122 insertions(+), 101 deletions(-) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 036aa8dc0baf4..f94fa4b8a12d4 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -338,6 +338,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -345,43 +346,37 @@ function getLibStatut($mode=0) * @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) + if ($mode == 0 || $mode == 1) { - $prefix=''; if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($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 e6b95d7ad374a..7aa9beda6271e 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 @@ function fetch($rowid) } } + // 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 433b05aceeb2a..32910c3ed8aa8 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -640,6 +640,7 @@ function delete($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link an object to the category * @@ -647,9 +648,9 @@ function delete($user, $notrigger=0) * @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 @@ function add_type($obj, $type) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object from category * @@ -750,9 +752,9 @@ function add_type($obj, $type) * * @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 @@ function getListForItem($id, $type='customer', $sortfield = "s.rowid", $sortorde 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 @@ function get_filles() } } + // 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 @@ private function load_motherof() } } + // 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 @@ private function load_motherof() * * @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 @@ function get_full_arbo($type, $markafterid=0) 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 @@ function get_full_arbo($type, $markafterid=0) * @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 @@ function build_path_from_id_categ($id_categ,$protection=1000) 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 @@ function debug_cats() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns all categories * @@ -1195,9 +1203,9 @@ function debug_cats() * @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 @@ function get_all_categories($type=null, $parent=false) } } + // 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 @@ function already_exists() } } + // 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 @@ function get_main_categories($type=null) * @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 @@ function print_all_ways($sep = " >> ", $url='', $nocolor=0) } + // 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 @@ function get_meres() } } + // 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 @@ function getNomUrl($withpicto=0,$option='',$maxlength=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Deplace fichier uploade sous le nom $files dans le repertoire sdir * @@ -1603,9 +1617,9 @@ function getNomUrl($withpicto=0,$option='',$maxlength=0) * @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 @@ function add_photo($sdir, $file) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tableau de toutes les photos de la categorie * @@ -1653,9 +1668,9 @@ function add_photo($sdir, $file) * @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 @@ function liste_photos($dir,$nbmax=0) 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 @@ function delete_photo($file) } } + // 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 fa7a9a1bc9e50..26e2c7bec906e 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 @@ function delete($rowid) * * @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 @@ function delete_targets() * @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 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -543,42 +544,38 @@ function getLibStatut($mode=0) * @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) - { - return $langs->trans($this->statuts[$statut]); - } - if ($mode == 1) + if ($mode == 0 || $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 @@ public static function libStatutDest($statut,$mode=0,$desc='') { 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 ba82e0070869c..76225ff890237 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 @@ private function createBatch($dluo, $qty) return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Url link of origin object * @@ -865,9 +866,9 @@ private function createBatch($dluo, $qty) * @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 @@ function getLibStatut($mode=0) 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) - { - return $langs->trans('StatusNotApplicable'); - } - if ($mode == 1) + if ($mode == 0 || $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 0c501a1a09f3d..2cee8f7a2a1c3 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 @@ function getLibStatut($mode=0) return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -482,9 +483,9 @@ function getLibStatut($mode=0) * @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 a9b44339930ca..f690cdd862507 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 @@ function __construct($db, $socid="", $supplier_proposalid=0) } + // 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 @@ function __construct($db, $socid="", $supplier_proposalid=0) * 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 @@ function add_product($idproduct, $qty, $remise_percent=0) } } + // 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 @@ function create($user, $notrigger=0) } + // 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 @@ function create($user, $notrigger=0) * @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 @@ function valid($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1511,9 +1515,9 @@ function valid($user, $notrigger=0) * @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 @@ function set_date_livraison($user, $date_livraison) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -1541,9 +1546,9 @@ function set_date_livraison($user, $date_livraison) * @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 @@ function set_remise_percent($user, $remise) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -1575,9 +1581,9 @@ function set_remise_percent($user, $remise) * @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 @@ function createPriceFournisseur($product, $user) } } + // 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 @@ function set_draft($user) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of askprice (eventually filtered on user) into an array * @@ -1881,9 +1889,9 @@ function set_draft($user) * @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 @@ function getLibStatut($mode=0) 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 @@ function LibStatut($statut,$mode=1) $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 @@ function LibStatut($statut,$mode=1) * @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 @@ function initAsSpecimen() } } + // 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 @@ function update($notrigger=0) } } + // 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 From 04c1a7d4af9dbd7a44e0f4ee10e6ae0974733046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 13:38:11 +0200 Subject: [PATCH 06/30] move phpcs:ignore --- htdocs/api/class/api_access.class.php | 6 +- htdocs/compta/bank/class/account.class.php | 59 +++++++----- .../bank/class/paymentvarious.class.php | 26 ++--- .../deplacement/class/deplacement.class.php | 17 ++-- .../compta/paiement/class/paiement.class.php | 19 ++-- .../class/bonprelevement.class.php | 68 +++++++------ .../salaries/class/paymentsalary.class.php | 6 +- .../sociales/class/cchargesociales.class.php | 3 +- .../sociales/class/chargesociales.class.php | 35 ++++--- .../class/paymentsocialcontribution.class.php | 6 +- htdocs/core/class/CSMSFile.class.php | 6 +- htdocs/core/class/commonobject.class.php | 95 ++++++++++++------- htdocs/loan/class/loan.class.php | 25 +++-- htdocs/loan/class/paymentloan.class.php | 3 +- .../class/propalmergepdfproduct.class.php | 9 +- .../class/price_expression.class.php | 14 +-- .../price_global_variable_updater.class.php | 18 ++-- 17 files changed, 244 insertions(+), 171 deletions(-) diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 8d8281745faee..e453bd331c23d 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -59,15 +59,16 @@ class DolibarrApiAccess implements iAuthenticate */ public static $user = ''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName /** * Check access * * @return bool * @throws RestException */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __isAllowed() { + // phpcs:enable global $conf, $db; $login = ''; @@ -165,15 +166,16 @@ public function __isAllowed() return in_array(static::$role, (array) $requirefortest) || static::$role == 'admin'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName /** * @return string string to be used with WWW-Authenticate header * @example Basic * @example Digest * @example OAuth */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName public function __getWWWAuthenticateString() { + // phpcs:enable return ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index bba4e2ff00193..4a1d2b047ab71 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -40,12 +40,12 @@ class Account extends CommonObject * @var string ID to identify managed object */ public $element = 'bank_account'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'bank_account'; - + public $picto = 'account'; /** @@ -304,7 +304,7 @@ function canBeConciliated() * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_url_line($line_id, $url_id, $url, $label, $type) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; @@ -343,7 +343,7 @@ function add_url_line($line_id, $url_id, $url, $label, $type) * @param string $type To search using type * @return array|-1 Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_url($fk_bank='', $url_id='', $type='') { $lines = array(); @@ -790,7 +790,7 @@ function update(User $user, $notrigger = 0) * @param User $user Object user making update * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_bban(User $user = null) { global $conf,$langs; @@ -1078,7 +1078,7 @@ function getLibStatut($mode=0) * @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 + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { global $langs; @@ -1114,7 +1114,7 @@ function LibStatut($statut, $mode = 0) * * @return boolean vrai si peut etre supprime, faux sinon */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function can_be_deleted() { $can_be_deleted=false; @@ -1184,7 +1184,7 @@ function solde($option=0) * @param int $filteraccountid To get info for a particular account id * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board(User $user, $filteraccountid = 0) { global $conf, $langs; @@ -1238,7 +1238,7 @@ function load_board(User $user, $filteraccountid = 0) * @param int $filteraccountid To get info for a particular account id * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board($filteraccountid = 0) { global $user; @@ -1648,29 +1648,29 @@ class AccountLine extends CommonObject * @var string Error code (or message) */ public $error=''; - + /** * @var DoliDB Database handler. */ public $db; - + /** * @var string ID to identify managed object */ public $element='bank'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='bank'; - + var $picto = 'generic'; /** * @var int ID */ public $id; - + var $ref; var $datec; var $dateo; @@ -1680,12 +1680,12 @@ class AccountLine extends CommonObject */ var $datev; var $amount; - + /** * @var string proper name for given parameter */ public $label; - + var $note; var $fk_user_author; var $fk_user_rappro; @@ -1884,15 +1884,16 @@ function delete(User $user = null) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete bank line records * * @param User $user User object that delete * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_urls(User $user = null) { + // phpcs:enable $nbko=0; if ($this->rappro) @@ -1955,6 +1956,7 @@ function update(User $user, $notrigger = 0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update conciliation field * @@ -1962,9 +1964,9 @@ function update(User $user, $notrigger = 0) * @param int $cat Category id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_conciliation(User $user, $cat) { + // phpcs:enable global $conf,$langs; $this->db->begin(); @@ -2018,6 +2020,7 @@ function update_conciliation(User $user, $cat) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase/decrease value date of a rowid * @@ -2025,9 +2028,9 @@ function update_conciliation(User $user, $cat) * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_change($rowid,$sign=1) { + // phpcs:enable $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $resql = $this->db->query($sql); if ($resql) @@ -2057,31 +2060,34 @@ function datev_change($rowid,$sign=1) return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_next($id) { + // phpcs:enable return $this->datev_change($id,1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Decrease value date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function datev_previous($id) { + // phpcs:enable return $this->datev_change($id,-1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase/decrease operation date of a rowid * @@ -2089,9 +2095,9 @@ function datev_previous($id) * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_change($rowid,$sign=1) { + // phpcs:enable $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; $resql = $this->db->query($sql); if ($resql) @@ -2121,27 +2127,29 @@ function dateo_change($rowid,$sign=1) return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_next($id) { + // phpcs:enable return $this->dateo_change($id,1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Decrease operation date of a rowid * * @param int $id Id of line to change * @return int >0 if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dateo_previous($id) { + // phpcs:enable return $this->dateo_change($id,-1); } @@ -2248,6 +2256,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2255,9 +2264,9 @@ function getLibStatut($mode=0) * @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 global $langs; //$langs->load('companies'); /* diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 74df6c24ad6bb..df3507d4dca78 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -34,19 +34,19 @@ class PaymentVarious extends CommonObject * @var string ID to identify managed object */ public $element='variouspayment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='payment_various'; - + public $picto = 'bill'; /** * @var int ID */ public $id; - + var $ref; var $tms; var $datep; @@ -55,12 +55,12 @@ class PaymentVarious extends CommonObject var $amount; var $type_payment; var $num_payment; - + /** * @var string proper name for given parameter */ public $label; - + var $accountancy_code; var $fk_project; var $fk_bank; @@ -451,15 +451,16 @@ function create($user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment various and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_various SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -486,6 +487,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -493,38 +495,38 @@ function getLibStatut($mode=0) * @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 Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index c78ca6707eb07..2330e81d3a009 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -35,12 +35,12 @@ class Deplacement extends CommonObject * @var string ID to identify managed object */ public $element='deplacement'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='deplacement'; - + public $table_element_line = ''; public $fk_element = ''; public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -300,6 +300,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -307,38 +308,38 @@ function getLibStatut($mode=0) * @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 Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$statut]); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 1fd2ad8bbef86..3a2b3f900a18f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -40,12 +40,12 @@ class Paiement extends CommonObject * @var string ID to identify managed object */ public $element='payment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='paiement'; - + public $picto = 'payment'; var $facid; @@ -702,15 +702,16 @@ function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour du lien entre le paiement et la ligne generee dans llx_bank * * @param int $id_bank Id compte bancaire * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' set fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; @@ -728,15 +729,16 @@ function update_fk_bank($id_bank) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Updates the payment date * * @param int $date New date * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_date($date) { + // phpcs:enable if (!empty($date) && $this->statut!=1) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; @@ -760,15 +762,16 @@ function update_date($date) return -1; //no date given or already validated } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Updates the payment number * * @param string $num New num * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_num($num) { + // phpcs:enable if(!empty($num) && $this->statut!=1) { $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; @@ -1123,6 +1126,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1130,9 +1134,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); @@ -1174,15 +1178,16 @@ function LibStatut($status,$mode=0) return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the third party of object, from id into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; if (empty($force_thirdparty_id)) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 7eba6afec2986..dbb8932d7f5f9 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -43,12 +43,12 @@ class BonPrelevement extends CommonObject * @var string ID to identify managed object */ public $element='widthdraw'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='prelevement_bons'; - + public $picto = 'payment'; var $date_echeance; @@ -109,6 +109,7 @@ function __construct($db, $filename='') $this->_fetched = 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add invoice to withdrawal * @@ -122,9 +123,9 @@ function __construct($db, $filename='') * @param string $number_key number key of account number * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) { + // phpcs:enable $result = 0; $line_id = 0; @@ -328,14 +329,15 @@ function fetch($rowid, $ref='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set credite and set status of linked invoices. Still used ?? * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_credite() { + // phpcs:enable global $user,$conf; $error = 0; @@ -406,6 +408,7 @@ function set_credite() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set direct debit order to "credited" status. * @@ -413,9 +416,9 @@ function set_credite() * @param int $date date of action * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infocredit($user, $date) { + // phpcs:enable global $conf,$langs; $error = 0; @@ -553,6 +556,7 @@ function set_infocredit($user, $date) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set withdrawal to transmited status * @@ -561,9 +565,9 @@ function set_infocredit($user, $date) * @param string $method method of transmision to bank * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_infotrans($user, $date, $method) { + // phpcs:enable global $conf,$langs; $error = 0; @@ -678,14 +682,15 @@ private function getListInvoices($amounts=0) return $arr; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns amount of withdrawal * * @return double Total amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SommeAPrelever() { + // phpcs:enable global $conf; $sql = "SELECT sum(pfd.amount) as nb"; @@ -716,6 +721,7 @@ function SommeAPrelever() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get number of invoices to withdrawal * TODO delete params banque and agence when not necesary @@ -724,9 +730,9 @@ function SommeAPrelever() * @param int $agence dolibarr mysoc agence * @return int 0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeleteNotification($user, $action) { + // phpcs:enable $result = 0; $sql = "DELETE FROM ".MAIN_DB_PREFIX."notify_def"; @@ -1243,6 +1252,7 @@ function DeleteNotification($user, $action) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a notification * @@ -1251,9 +1261,9 @@ function DeleteNotification($user, $action) * @param string $action notification action * @return int 0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddNotification($db, $user, $action) { + // phpcs:enable $result = 0; if ($this->DeleteNotification($user, $action) == 0) @@ -1469,6 +1479,7 @@ function generate($format='ALL',$executiondate='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write recipient of request (customer) * @@ -1483,9 +1494,9 @@ function generate($format='ALL',$executiondate='') * @param string $rib_dom rib domiciliation * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='') { + // phpcs:enable fputs($this->file, "06"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1556,6 +1567,7 @@ static function buildRumNumber($row_code_client, $row_datec, $row_drum) return $pre.$row_code_client.'-'.$row_drum.'-'.date('U', $row_datec); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write recipient of request (customer) * @@ -1577,9 +1589,9 @@ static function buildRumNumber($row_code_client, $row_datec, $row_drum) * @param string $row_drum rib.rowid used to generate rum * @return string Return string with SEPA part DrctDbtTxInf */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum) { + // phpcs:enable $CrLf = "\n"; $Rowing = sprintf("%06d", $row_idfac); @@ -1634,14 +1646,15 @@ function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write sender of request (me) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteur() { + // phpcs:enable fputs($this->file, "03"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1700,6 +1713,7 @@ function EnregEmetteur() fputs($this->file, "\n"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write sender of request (me). * Note: The tag PmtInf is opened here but closed into caller @@ -1712,9 +1726,9 @@ function EnregEmetteur() * @param string $format FRST or RCUR or ALL * @return string String with SEPA Sender */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', $format='FRST') { + // phpcs:enable // SEPA INITIALISATION global $conf; @@ -1822,15 +1836,16 @@ function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', return $XML_SEPA_INFO; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write end * * @param int $total total amount * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EnregTotal($total) { + // phpcs:enable fputs($this->file, "08"); fputs($this->file, "08"); // Prelevement ordinaire @@ -1895,6 +1910,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -1902,9 +1918,9 @@ function getLibStatut($mode=0) * @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($statut,$mode=0) { + // phpcs:enable if (empty($this->labelstatut)) { global $langs; @@ -1914,39 +1930,35 @@ function LibStatut($statut,$mode=0) $this->labelstatut[2]=$langs->trans("StatusCredited"); } - if ($mode == 0) - { - return $this->labelstatut[$statut]; - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { return $this->labelstatut[$statut]; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3').' '.$this->labelstatut[$statut]; if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3'); if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut==1) return img_picto($this->labelstatut[$statut],'statut3').' '.$this->labelstatut[$statut]; if ($statut==2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut3'); if ($statut==2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut==0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut==1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut3'); diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 5aa11229452ee..7630800ad158d 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -486,15 +486,16 @@ function create($user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment salary and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'payment_salary SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -584,6 +585,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -591,9 +593,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index bfa8c97a058b6..409ee99aaae26 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -461,6 +461,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -468,9 +469,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index bad851450a7c2..726eef6feff47 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -36,14 +36,14 @@ class ChargeSociales extends CommonObject * @var string ID to identify managed object */ public $element='chargesociales'; - + public $table='chargesociales'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='chargesociales'; - + public $picto = 'bill'; /** @@ -367,15 +367,16 @@ function solde($year = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag social contribution as payed completely * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql.= " paye = 1"; $sql.= " WHERE rowid = ".$this->id; @@ -383,15 +384,17 @@ function set_paid($user) if ($return) return 1; else return -1; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove tag payed on social contribution * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql.= " paye = 0"; $sql.= " WHERE rowid = ".$this->id; @@ -412,6 +415,7 @@ function getLibStatut($mode=0,$alreadypaid=-1) return $this->LibStatut($this->paye,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -420,55 +424,50 @@ function getLibStatut($mode=0,$alreadypaid=-1) * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { + // phpcs:enable global $langs; $langs->load('customers'); $langs->load('bills'); - if ($mode == 0) - { - if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 1) return $langs->trans("Paid"); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - return "Error, mode/status not found"; + else return "Error, mode/status not found"; } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 4a989554b690b..ca233eb43ea4f 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -600,15 +600,16 @@ function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour du lien entre le paiement de charge et la ligne dans llx_bank generee * * @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."paiementcharge SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); @@ -636,6 +637,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -643,9 +645,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 5bc8105049e74..c2512af70ef78 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -192,15 +192,16 @@ function sendfile() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SendSms request into a dump file (mode = all) * Used for debugging. * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms() { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir @@ -222,6 +223,7 @@ function dump_sms() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write content of a SendSms result into a dump file (mode = all) * Used for debugging. @@ -229,9 +231,9 @@ function dump_sms() * @param int $result Result of sms sending * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function dump_sms_result($result) { + // phpcs:enable global $conf,$dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a00f91ac5bcd1..ca493b980417d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -713,6 +713,7 @@ function getLastMainDocLink($modulepart, $initsharekey=0, $relativelink=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a link between element $this->element and a contact * @@ -722,9 +723,9 @@ function getLastMainDocLink($modulepart, $initsharekey=0, $relativelink=0) * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) { + // phpcs:enable global $user,$langs; @@ -836,6 +837,7 @@ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger } else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Copy contact from one element to current * @@ -843,9 +845,9 @@ function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function copy_linked_contact($objFrom, $source='internal') { + // phpcs:enable $contacts = $objFrom->liste_contact(-1, $source); foreach($contacts as $contact) { @@ -858,6 +860,7 @@ function copy_linked_contact($objFrom, $source='internal') return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a link to contact line * @@ -867,9 +870,9 @@ function copy_linked_contact($objFrom, $source='internal') * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) { + // phpcs:enable // Insert into database $sql = "UPDATE ".MAIN_DB_PREFIX."element_contact set"; $sql.= " statut = ".$statut; @@ -888,6 +891,7 @@ function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to contact line * @@ -895,9 +899,9 @@ function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_contact($rowid, $notrigger=0) { + // phpcs:enable global $user; @@ -926,6 +930,7 @@ function delete_contact($rowid, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete all links between an object $this and all its contacts * @@ -933,9 +938,9 @@ function delete_contact($rowid, $notrigger=0) * @param string $code Type of contact (code or id) * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_linked_contact($source='',$code='') { + // phpcs:enable $temp = array(); $typeContact = $this->liste_type_contact($source,'',0,0,$code); @@ -962,6 +967,7 @@ function delete_linked_contact($source='',$code='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get array of all contacts for an object * @@ -971,9 +977,9 @@ function delete_linked_contact($source='',$code='') * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array Array of contacts */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_contact($statut=-1,$source='external',$list=0,$code='') { + // phpcs:enable global $langs; $tab=array(); @@ -1070,6 +1076,7 @@ function swapContactStatus($rowid) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with list of possible values for type of contacts * @@ -1080,9 +1087,9 @@ function swapContactStatus($rowid) * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_type_contact($source='internal', $order='position', $option=0, $activeonly=0, $code='') { + // phpcs:enable global $langs; if (empty($order)) $order='position'; @@ -1184,15 +1191,16 @@ function getIdContact($source,$code,$status=0) return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object contact with id=$this->contactid into $this->contact * * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_contact($contactid=null) { + // phpcs:enable if (empty($contactid)) $contactid=$this->contactid; if (empty($contactid)) return 0; @@ -1204,15 +1212,16 @@ function fetch_contact($contactid=null) return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the third party of object, from id $this->socid or $this->fk_soc, into this->thirdparty * * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_thirdparty($force_thirdparty_id=0) { + // phpcs:enable global $conf; if (empty($this->socid) && empty($this->fk_soc) && empty($this->fk_thirdparty) && empty($force_thirdparty_id)) @@ -1266,6 +1275,7 @@ public function fetchOneLike($ref) return $this->fetch($result->rowid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load data for barcode into properties ->barcode_type* * Properties ->barcode_type that is id of barcode. Type is used to find other properties, but @@ -1273,9 +1283,9 @@ public function fetchOneLike($ref) * * @return int <0 if KO, 0 if can't guess type of barcode (ISBN, EAN13...), >0 if OK (all barcode properties loaded) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_barcode() { + // phpcs:enable global $conf; dol_syslog(get_class($this).'::fetch_barcode this->element='.$this->element.' this->barcode_type='.$this->barcode_type); @@ -1316,14 +1326,15 @@ function fetch_barcode() return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the project with id $this->fk_project into this->project * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_projet() { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; if (empty($this->fk_project) && ! empty($this->fk_projet)) $this->fk_project = $this->fk_projet; // For backward compatibility @@ -1337,14 +1348,15 @@ function fetch_projet() return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the product with id $this->fk_product into this->product * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product() { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (empty($this->fk_product)) return 0; @@ -1356,29 +1368,31 @@ function fetch_product() return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load the user with id $userid into this->user * * @param int $userid Id du contact * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_user($userid) { + // phpcs:enable $user = new User($this->db); $result=$user->fetch($userid); $this->user = $user; return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Read linked origin object * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_origin() { + // phpcs:enable if ($this->origin == 'shipping') $this->origin = 'expedition'; if ($this->origin == 'delivery') $this->origin = 'livraison'; @@ -1538,6 +1552,7 @@ function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * @@ -1546,9 +1561,9 @@ function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_ref($filter, $fieldid, $nodbprefix=0) { + // phpcs:enable global $conf, $user; if (! $this->table_element) @@ -2173,6 +2188,7 @@ function setBankAccount($fk_account, $notrigger=false, $userused=null) // TODO: Move line related operations to CommonObjectLine? + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Save a new position (field rang) for details lines. * You can choose to set position for lines with already a position or lines without any position defined. @@ -2182,9 +2198,9 @@ function setBankAccount($fk_account, $notrigger=false, $userused=null) * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true) { + // phpcs:enable if (! $this->table_element_line) { dol_syslog(get_class($this)."::line_order was called on objet with property table_element_line not defined",LOG_ERR); @@ -2293,6 +2309,7 @@ function getChildrenOfLine($id) return $rows; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a lower rank * @@ -2300,9 +2317,9 @@ function getChildrenOfLine($id) * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_up($rowid, $fk_parent_line=true) { + // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); // Get rang of line @@ -2312,6 +2329,7 @@ function line_up($rowid, $fk_parent_line=true) $this->updateLineUp($rowid, $rang); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a higher rank * @@ -2319,9 +2337,9 @@ function line_up($rowid, $fk_parent_line=true) * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_down($rowid, $fk_parent_line=true) { + // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); // Get rang of line @@ -2356,15 +2374,16 @@ function updateRangOfLine($rowid,$rang) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update position of line with ajax (rang) * * @param array $rows Array of rows * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_ajaxorder($rows) { + // phpcs:enable $num = count($rows); for ($i = 0 ; $i < $num ; $i++) { @@ -2472,15 +2491,16 @@ function getIdOfLine($rang) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value used for position of line (rang) * * @param int $fk_parent_line Parent line id * @return int Max value of rang in table of lines */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function line_max($fk_parent_line=0) { + // phpcs:enable // Search the last rang with fk_parent_line if ($fk_parent_line) { @@ -2519,15 +2539,16 @@ function line_max($fk_parent_line=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update external ref of element * * @param string $ref_ext Update field ref_ext * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_ref_ext($ref_ext) { + // phpcs:enable if (! $this->table_element) { dol_syslog(get_class($this)."::update_ref_ext was called on objet with property table_element not defined", LOG_ERR); @@ -2551,6 +2572,7 @@ function update_ref_ext($ref_ext) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update note of element * @@ -2558,9 +2580,9 @@ function update_ref_ext($ref_ext) * @param string $suffix '', '_public' or '_private' * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_note($note, $suffix='') { + // phpcs:enable global $user; if (! $this->table_element) @@ -2603,6 +2625,7 @@ function update_note($note, $suffix='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update public note (kept for backward compatibility) * @@ -2611,12 +2634,13 @@ function update_note($note, $suffix='') * @deprecated * @see update_note() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_note_public($note) { + // phpcs:enable return $this->update_note($note,'_public'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total_ht, total_ttc, total_vat, total_localtax1, total_localtax2 for an object (sum of lines). * Must be called at end of methods addline or updateline. @@ -2627,9 +2651,9 @@ function update_note_public($note) * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) { + // phpcs:enable global $conf, $hookmanager, $action; // Some external module want no update price after a trigger because they have another method to calculate the total (ex: with an extrafield) @@ -2856,6 +2880,7 @@ function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$se } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add objects linked in llx_element_element. * @@ -2864,9 +2889,9 @@ function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$se * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked, updateObjectLinked, deleteObjectLinked */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_object_linked($origin=null, $origin_id=null) { + // phpcs:enable $origin = (! empty($origin) ? $origin : $this->origin); $origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id); @@ -3617,15 +3642,16 @@ function setExtraParameters() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return incoterms informations * TODO Use a cache for label get * * @return string incoterms info */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_incoterms() { + // phpcs:enable $out = ''; $this->libelle_incoterms = ''; if (!empty($this->fk_incoterms)) @@ -4225,6 +4251,7 @@ function printOriginLine($line, $var, $restrictlist='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add resources to the current object : add entry into llx_element_resources * Need $this->element & $this->id @@ -4235,9 +4262,9 @@ function printOriginLine($line, $var, $restrictlist='') * @param int $mandatory Mandatory or not * @return int <=0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0) { + // phpcs:enable $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_resources ("; @@ -4270,6 +4297,7 @@ function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory= } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to resource line * @@ -4278,9 +4306,9 @@ function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory= * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_resource($rowid, $element, $notrigger=0) { + // phpcs:enable global $user; $this->db->begin(); @@ -4653,6 +4681,7 @@ function getDefaultCreateValueFor($fieldname, $alternatevalue=null) /* For triggers */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance. * Some context information may also be provided into array property this->context. @@ -4663,9 +4692,9 @@ function getDefaultCreateValueFor($fieldname, $alternatevalue=null) * @param User $user Object user * @return int Result of run_triggers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function call_trigger($trigger_name, $user) { + // phpcs:enable global $langs,$conf; include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; @@ -4690,6 +4719,7 @@ function call_trigger($trigger_name, $user) /* Functions for extrafields */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to get extra fields of an object into $this->array_options * This method is in most cases called by method fetch of objects but you can call it separately. @@ -4698,9 +4728,9 @@ function call_trigger($trigger_name, $user) * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_optionals($rowid=null, $optionsArray=null) { + // phpcs:enable if (empty($rowid)) $rowid=$this->id; // To avoid SQL errors. Probably not the better solution though @@ -6175,7 +6205,7 @@ function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', { //Show only the key field in params if (is_array($params) && array_key_exists('onlykey',$params) && $key != $params['onlykey']) continue; - + $enabled = 1; if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key])) { @@ -6462,6 +6492,7 @@ public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_pro return $buyPrice; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show photos of an object (nbmax maximum), into several columns * @@ -6479,9 +6510,9 @@ public function defineBuyPrice($unitPrice = 0.0, $discountPercent = 0.0, $fk_pro * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_photos($modulepart, $sdir, $size=0, $nbmax=0, $nbbyrow=5, $showfilename=0, $showaction=0, $maxHeight=120, $maxWidth=160, $nolink=0, $notitle=0, $usesharelink=0) { + // phpcs:enable global $conf,$user,$langs; include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index b1bcbc65567f3..ba14c2828b615 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -333,15 +333,16 @@ function update($user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag loan as payed completely * * @param User $user Object user making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql.= " paid = 1"; $sql.= " WHERE rowid = ".$this->id; @@ -366,6 +367,7 @@ function getLibStatut($mode=0,$alreadypaid=-1) return $this->LibStatut($this->paid,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label for given status * @@ -374,54 +376,49 @@ function getLibStatut($mode=0,$alreadypaid=-1) * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0,$alreadypaid=-1) { + // phpcs:enable global $langs; $langs->loadLangs(array("customers","bills")); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { if ($statut == 0) return $langs->trans("Unpaid"); if ($statut == 1) return $langs->trans("Paid"); } - if ($mode == 1) - { - if ($statut == 0) return $langs->trans("Unpaid"); - if ($statut == 1) return $langs->trans("Paid"); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0 && $alreadypaid <= 0) return img_picto($langs->trans("Unpaid"), 'statut1').' '.$langs->trans("Unpaid"); if ($statut == 0 && $alreadypaid > 0) return img_picto($langs->trans("BillStatusStarted"), 'statut3').' '.$langs->trans("BillStatusStarted"); if ($statut == 1) return img_picto($langs->trans("Paid"), 'statut6').' '.$langs->trans("Paid"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == 0 && $alreadypaid <= 0) return $langs->trans("Unpaid").' '.img_picto($langs->trans("Unpaid"), 'statut1'); if ($statut == 0 && $alreadypaid > 0) return $langs->trans("BillStatusStarted").' '.img_picto($langs->trans("BillStatusStarted"), 'statut3'); if ($statut == 1) return $langs->trans("Paid").' '.img_picto($langs->trans("Paid"), 'statut6'); } - return "Error, mode/status not found"; + else return "Error, mode/status not found"; } diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 32b4080187f56..add1aef496d22 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -478,15 +478,16 @@ function addPaymentToBank($user, $fk_loan, $mode, $label, $accountid, $emetteur_ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between loan's payment and the line generate 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_loan SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 75fe5282bd1f9..b02f1710bb5ca 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -223,6 +223,7 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -230,9 +231,9 @@ function fetch($id) * @param string $lang Lang string code * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_by_product($product_id, $lang='') { + // phpcs:enable global $langs,$conf; $sql = "SELECT"; @@ -436,6 +437,7 @@ function delete($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object in database * @@ -445,9 +447,9 @@ function delete($user, $notrigger=0) * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_product($user, $product_id, $lang_id='', $notrigger=0) { + // phpcs:enable global $conf, $langs; $error=0; @@ -501,15 +503,16 @@ function delete_by_product($user, $product_id, $lang_id='', $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object in database * * @param User $user User that deletes * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_by_file($user) { + // phpcs:enable global $conf, $langs; $error=0; diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 0d991ace9fefa..8d7dfbb7ce4df 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -33,7 +33,7 @@ class PriceExpression * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -43,15 +43,15 @@ class PriceExpression * @var string[] Error codes (or messages) */ public $errors = array(); - + /** * @var int ID */ public $id; - + var $title; var $expression; - + /** * @var string Name of table without prefix where object is stored */ @@ -176,14 +176,15 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List all price expressions * * @return array Array of price expressions */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_price_expression() { + // phpcs:enable $sql = "SELECT rowid, title, expression"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " ORDER BY title"; @@ -214,15 +215,16 @@ function list_price_expression() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns any existing rowid with specified title * * @param String $title Title of expression * @return int < 0 if KO, 0 if OK but not found, > 0 rowid */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_title($title) { + // phpcs:enable $sql = "SELECT rowid"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE title = '".$this->db->escape($title)."'"; diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index ca81e40beb645..69639677f73f1 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -33,25 +33,25 @@ class PriceGlobalVariableUpdater * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - + var $types=array(0, 1); //!< Updater types var $update_min = 5; //!< Minimal update rate - + /** * @var int ID */ public $id; - + var $type; var $description; var $parameters; @@ -59,7 +59,7 @@ class PriceGlobalVariableUpdater var $update_interval; //!< Interval in mins var $next_update; //!< Next update timestamp var $last_status; - + /** * @var string Name of table without prefix where object is stored */ @@ -551,6 +551,7 @@ function process() return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update next_update into database * @@ -559,9 +560,9 @@ function process() * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_next_update($next_update, $user=0, $notrigger=0) { + // phpcs:enable $error=0; $this->next_update = $next_update; @@ -596,6 +597,7 @@ function update_next_update($next_update, $user=0, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update last_status into database * @@ -604,9 +606,9 @@ function update_next_update($next_update, $user=0, $notrigger=0) * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_status($last_status, $user=0, $notrigger=0) { + // phpcs:enable $error=0; $this->last_status = $last_status; From 2a5c994009cfd7f9b1fe14defc42e45127d6f85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 14:01:37 +0200 Subject: [PATCH 07/30] move phpcs:ignore --- htdocs/adherents/class/adherent.class.php | 48 ++++++++++++------- .../adherents/class/adherent_type.class.php | 13 +++-- htdocs/adherents/class/subscription.class.php | 7 +-- .../admin/dolistore/class/dolistore.class.php | 23 +++++---- .../compta/localtax/class/localtax.class.php | 15 ++++-- htdocs/holiday/class/holiday.class.php | 18 +++---- htdocs/hrm/class/establishment.class.php | 17 +++---- .../product/actions_card_product.class.php | 6 ++- .../service/actions_card_service.class.php | 6 ++- 9 files changed, 94 insertions(+), 59 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 41764c38bd6b1..6c49b87185e99 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -132,6 +132,7 @@ function __construct($db) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function sending an email has the adherent with the text supplied in parameter. * @@ -147,9 +148,9 @@ function __construct($db) * @param string $errors_to erros to * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') { + // phpcs:enable global $conf,$langs; // Detect if message is HTML @@ -638,6 +639,7 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update denormalized last subscription date. * This function is called when we delete a subscription for example. @@ -645,9 +647,9 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp * @param User $user User making change * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_end_date($user) { + // phpcs:enable $this->db->begin(); // Search for last subscription id and end date @@ -993,15 +995,16 @@ function setThirdPartyId($thirdpartyid) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Method to load member from its login * * @param string $login login of member * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_login($login) { + // phpcs:enable global $conf; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; @@ -1023,6 +1026,7 @@ function fetch_login($login) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Method to load member from its name * @@ -1030,9 +1034,9 @@ function fetch_login($login) * @param string $lastname Lastname * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_name($firstname,$lastname) { + // phpcs:enable global $conf; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; @@ -1195,6 +1199,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetc } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui recupere pour un adherent les parametres * first_subscription_date @@ -1204,9 +1209,9 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetc * * @return int <0 si KO, >0 si OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_subscriptions() { + // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; @@ -1750,14 +1755,15 @@ function resiliate($user) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to add member into external tools mailing-list, spip, etc. * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_abo() { + // phpcs:enable global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -1808,14 +1814,15 @@ function add_to_abo() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to delete a member from external tools like mailing-list, spip, etc. * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_abo() { + // phpcs:enable global $conf,$langs; include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -1988,6 +1995,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$this->need_subscription,$this->datefin,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1997,9 +2005,9 @@ function getLibStatut($mode=0) * @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,$need_subscription,$date_end_subscription,$mode=0) { + // phpcs:enable global $langs; $langs->load("members"); if ($mode == 0) @@ -2013,7 +2021,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return $langs->trans("MemberStatusResiliated"); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); if ($statut >= 1) @@ -2024,7 +2032,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); if ($statut >= 1) @@ -2035,7 +2043,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2046,7 +2054,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); if ($statut >= 1) @@ -2057,7 +2065,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliated"); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2068,7 +2076,7 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } if ($statut == 0) return ''.$langs->trans("MemberStatusResiliated").' '.img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); if ($statut >= 1) @@ -2082,14 +2090,15 @@ function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) } + // 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; $this->nb=array(); @@ -2117,15 +2126,16 @@ function load_state_board() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -2260,6 +2270,7 @@ function initAsSpecimen() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2269,9 +2280,9 @@ function initAsSpecimen() * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS."=".$info[$conf->global->LDAP_KEY_MEMBERS].",".$conf->global->LDAP_MEMBER_DN; @@ -2281,14 +2292,15 @@ function _load_ldap_dn($info,$mode=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index b7d510a3e0fb5..9b24461c60dcc 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -36,12 +36,12 @@ class AdherentType extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'adherent_type'; - + /** * @var string ID to identify managed object */ public $element = 'adherent_type'; - + public $picto = 'group'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -290,14 +290,15 @@ function fetch($rowid) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of members' type * * @return array List of types of members */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { + // phpcs:enable global $conf,$langs; $adherenttypes = array(); @@ -422,6 +423,7 @@ function getLibStatut() return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -431,9 +433,9 @@ function getLibStatut() * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_MEMBERS_TYPES."=".$info[$conf->global->LDAP_KEY_MEMBERS_TYPES].",".$conf->global->LDAP_MEMBER_TYPE_DN; @@ -443,14 +445,15 @@ function _load_ldap_dn($info,$mode=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 90452816be855..6ad63a0f6821e 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -36,12 +36,12 @@ class Subscription extends CommonObject * @var string ID to identify managed object */ public $element='subscription'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='subscription'; - + public $picto='payment'; var $datec; // Date creation @@ -363,15 +363,16 @@ function getLibStatut($mode=0) return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * * @param int $statut Id statut * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut) { + // phpcs:enable global $langs; $langs->load("members"); return ''; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index c4dae079c3c35..859b9140f8697 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -163,15 +163,16 @@ function getRemoteData($options = array('start' => 0, 'end' => 10, 'per_page' => } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tree of Dolistore categories. $this->categories must have been loaded before. * * @param int $parent Id of parent category * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_categories($parent = 0) { + // phpcs:enable if (!isset($this->categories)) die('not possible'); if ($parent != 0) { $html = '
    '; @@ -211,14 +212,15 @@ function get_categories($parent = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of product formated for output * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_products() { + // phpcs:enable global $langs, $conf; $html = ""; $parity = "pair"; @@ -293,38 +295,41 @@ function get_products() return $html; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get previous link * * @param string $text symbol previous * @return string html previous link */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_previous_link($text = '<<') { + // phpcs:enable return ''.$text.''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get next link * * @param string $text symbol next * @return string html next link */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_link($text = '>>') { + // phpcs:enable return ''.$text.''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get previous url * * @return string previous url */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function get_previous_url() + function get_previous_url() { + // phpcs:enable $param_array = array(); if ($this->start < $this->per_page) { $sub = 0; @@ -340,14 +345,15 @@ function get_previous_url() return $this->url."&".$param; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get next url * * @return string next url */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_next_url() { + // phpcs:enable $param_array = array(); if (count($this->products) < $this->per_page) { $add = 0; @@ -363,6 +369,7 @@ function get_next_url() return $this->url."&".$param; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * version compare * @@ -370,9 +377,9 @@ function get_next_url() * @param string $v2 version 2 * @return int result of compare */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function version_compare($v1, $v2) { + // phpcs:enable $v1 = explode('.', $v1); $v2 = explode('.', $v2); $ret = 0; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 18b284f918734..2c777d671fcbf 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -344,15 +344,16 @@ function solde($year = 0) return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total de la localtax des factures emises par la societe. * * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_collectee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.localtax) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; if ($year) @@ -383,15 +384,16 @@ function localtax_sum_collectee($year = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * localtax payed * * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_payee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.total_localtax) as total_localtax"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -424,6 +426,7 @@ function localtax_sum_payee($year = 0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * localtax payed * Total de la localtax payed @@ -431,9 +434,9 @@ function localtax_sum_payee($year = 0) * @param int $year Year * @return int ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function localtax_sum_reglee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f"; @@ -579,15 +582,16 @@ function addPayment($user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update the link betwen localtax payment and the line into llx_bank * * @param int $id Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'localtax SET fk_bank = '.$id; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -639,6 +643,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -646,9 +651,9 @@ function getLibStatut($mode=0) * @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($status, $mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage return ''; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 0240ff8a34cb7..0f4107bf3ad7d 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -36,12 +36,12 @@ class Holiday extends CommonObject * @var string ID to identify managed object */ public $element='holiday'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='holiday'; - + public $ismultientitymanaged = 0; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $fk_element = 'fk_holiday'; public $picto = 'holiday'; @@ -921,6 +921,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut, $mode, $this->date_debut); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -929,9 +930,9 @@ function getLibStatut($mode=0) * @param date $startdate Date holiday should start * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode=0, $startdate='') { + // phpcs:enable global $langs; if ($mode == 0) @@ -942,7 +943,7 @@ function LibStatut($statut, $mode=0, $startdate='') if ($statut == 4) return $langs->trans('CancelCP'); if ($statut == 5) return $langs->trans('RefuseCP'); } - if ($mode == 2) + elseif ($mode == 2) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; @@ -952,7 +953,7 @@ function LibStatut($statut, $mode=0, $startdate='') if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5').' '.$langs->trans('CancelCP'); if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5').' '.$langs->trans('RefuseCP'); } - if ($mode == 3) + elseif ($mode == 3) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; @@ -962,7 +963,7 @@ function LibStatut($statut, $mode=0, $startdate='') if ($statut == 4) return img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 5) return img_picto($langs->trans('RefuseCP'),'statut5'); } - if ($mode == 5) + elseif ($mode == 5) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; @@ -972,7 +973,7 @@ function LibStatut($statut, $mode=0, $startdate='') if ($statut == 4) return $langs->trans('CancelCP').' '.img_picto($langs->trans('CancelCP'),'statut5'); if ($statut == 5) return $langs->trans('RefuseCP').' '.img_picto($langs->trans('RefuseCP'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { $pictoapproved='statut6'; if (! empty($startdate) && $startdate > dol_now()) $pictoapproved='statut4'; @@ -1580,15 +1581,16 @@ function fetchUsers($stringlist=true, $type=true, $filters='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of people with permission to validate leave requests. * Search for permission "approve leave requests" * * @return array Array of user ids */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_holiday() { + // phpcs:enable $users_validator=array(); $sql = "SELECT DISTINCT ur.fk_user"; diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index 60493b0b7f065..8ff5c2da52bdb 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -32,12 +32,12 @@ class Establishment extends CommonObject * @var string ID to identify managed object */ public $element='establishment'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='establishment'; - + public $table_element_line = ''; public $fk_element = 'fk_establishment'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -265,6 +265,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Give a label from a status * @@ -272,35 +273,35 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$status]); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); } - if ($mode == 2) + elseif ($mode == 2) { if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts_short[$status]); if ($status==1) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts_short[$status]); } - if ($mode == 3) + elseif ($mode == 3) { if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5'); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status==0 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut5').' '.$langs->trans($this->statuts[$status]); if ($status==1 && ! empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]),'statut4').' '.$langs->trans($this->statuts[$status]); } - if ($mode == 5) + elseif ($mode == 5) { if ($status==0 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut5'); if ($status==1 && ! empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut4'); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index c24d5a8214af6..bcd9773c7196a 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -64,6 +64,7 @@ function __construct($db, $dirmodule, $targetmodule, $canvas, $card) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -72,9 +73,9 @@ function __construct($db, $dirmodule, $targetmodule, $canvas, $card) * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; @@ -295,6 +296,7 @@ private function getFieldList() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -304,9 +306,9 @@ private function getFieldList() * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; $this->getFieldList(); diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 3d10988de85ef..2f0489b6f91b3 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -63,6 +63,7 @@ function __construct($db,$targetmodule,$canvas,$card) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -71,9 +72,9 @@ function __construct($db,$targetmodule,$canvas,$card) * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $langs, $user, $mysoc, $canvas; global $form, $formproduct; @@ -273,6 +274,7 @@ private function getFieldList() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -282,9 +284,9 @@ private function getFieldList() * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf; global $search_categ,$sall,$sref,$search_barcode,$snom,$catid; From 61c4e9831f0e8c1d2f13d1181896988b4b2900e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 18:18:10 +0200 Subject: [PATCH 08/30] move phpcs:ignore --- htdocs/contact/class/contact.class.php | 30 ++++++++++++++---------- htdocs/exports/class/export.class.php | 18 +++++++++----- htdocs/loan/class/loanschedule.class.php | 3 ++- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 4cd6fe8182038..ecaeedad9f330 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -41,12 +41,12 @@ class Contact extends CommonObject * @var string ID to identify managed object */ public $element='contact'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='socpeople'; - + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'contact'; @@ -131,9 +131,6 @@ class Contact extends CommonObject public $oldcopy; // To contains a clone of this when we need to save old properties of object - - - /** * Constructor * @@ -145,14 +142,15 @@ function __construct($db) $this->statut = 1; // By default, status is enabled } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators into this->nb for board * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -475,6 +473,7 @@ function update($id, $user=null, $notrigger=0, $action='update', $nosyncuser=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -484,9 +483,9 @@ function update($id, $user=null, $notrigger=0, $action='update', $nosyncuser=0) * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN; @@ -496,14 +495,15 @@ function _load_ldap_dn($info,$mode=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info = array(); @@ -570,6 +570,7 @@ function _load_ldap_info() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update field alert birthday * @@ -578,9 +579,9 @@ function _load_ldap_info() * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_perso($id, $user=null, $notrigger=0) { + // phpcs:enable $error=0; $result=false; @@ -726,7 +727,7 @@ function fetch($id, $user=0, $ref_ext='') $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - + $this->fk_departement = $obj->fk_departement; // deprecated $this->state_id = $obj->fk_departement; $this->departement_code = $obj->state_code; // deprecated @@ -852,6 +853,7 @@ function setGenderFromCivility() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load number of elements the contact is used as a link for * ref_facturation @@ -861,9 +863,9 @@ function setGenderFromCivility() * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_ref_elements() { + // phpcs:enable // Compte les elements pour lesquels il est contact $sql ="SELECT tc.element, count(ec.rowid) as nb"; $sql.=" FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as tc"; @@ -1194,6 +1196,7 @@ function getLibStatut($mode) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1201,9 +1204,9 @@ function getLibStatut($mode) * @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 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; if ($mode == 0) @@ -1240,15 +1243,16 @@ function LibStatut($statut,$mode) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return translated label of Public or Private * * @param int $statut Type (0 = public, 1 = private) * @return string Label translated */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibPubPriv($statut) { + // phpcs:enable global $langs; if ($statut=='1') return $langs->trans('ContactPrivate'); else return $langs->trans('ContactPublic'); diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index fd685ad74fd52..46d21eba03134 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -70,6 +70,7 @@ function __construct($db) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load an exportable dataset * @@ -77,9 +78,9 @@ function __construct($db) * @param string $filter Load a particular dataset only * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_arrays($user,$filter='') { + // phpcs:enable global $langs,$conf,$mysoc; dol_syslog(get_class($this)."::load_arrays user=".$user->id." filter=".$filter); @@ -208,6 +209,7 @@ function load_arrays($user,$filter='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the sql export request. * Arrays this->array_export_xxx are already loaded for required datatoexport @@ -217,9 +219,9 @@ function load_arrays($user,$filter='') * @param array $array_filterValue Filter records on array of value for fields * @return string SQL String. Example "select s.rowid as r_rowid, s.status as s_status from ..." */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_sql($indice, $array_selected, $array_filterValue) { + // phpcs:enable // Build the sql request $sql=$this->array_export_sql_start[$indice]; $i=0; @@ -271,6 +273,7 @@ function build_sql($indice, $array_selected, $array_filterValue) return $sql; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the conditionnal string from filter the query * @@ -279,9 +282,9 @@ function build_sql($indice, $array_selected, $array_filterValue) * @param string $ValueField Value of the field for filter. Must not be '' * @return string sql string of then field ex : "field='xxx'>" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterQuery($TypeField, $NameField, $ValueField) { + // phpcs:enable //print $TypeField." ".$NameField." ".$ValueField; $InfoFieldList = explode(":", $TypeField); // build the input field on depend of the type of file @@ -365,6 +368,7 @@ function conditionDate($Field, $Value, $Sens) return $Condition; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build an input field used to filter the query * @@ -373,9 +377,9 @@ function conditionDate($Field, $Value, $Sens) * @param string $ValueField Initial value of the field to filter * @return string html string of the input field ex : "" */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_filterField($TypeField, $NameField, $ValueField) { + // phpcs:enable global $conf,$langs; $szFilterField=''; @@ -514,6 +518,7 @@ function genDocFilter($TypeField) return $szMsg; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build export file. * File is built into directory $conf->export->dir_temp.'/'.$user->id @@ -527,9 +532,9 @@ function genDocFilter($TypeField) * @param string $sqlquery If set, transmit the sql request for select (otherwise, sql request is generated from arrays) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_file($user, $model, $datatoexport, $array_selected, $array_filterValue, $sqlquery = '') { + // phpcs:enable global $conf,$langs; $indice=0; @@ -825,15 +830,16 @@ function delete($user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output list all export models * TODO Move this into a class htmlxxx.class.php * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_export_model() { + // phpcs:enable global $conf, $langs; $sql = "SELECT em.rowid, em.field, em.label, em.type, em.filter"; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index a8774244e0070..71217444b1668 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -461,14 +461,15 @@ function fetchAll($loanid) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * trans_paiment * * @return void */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function trans_paiment() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/loan/class/loan.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/loan.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; From 03a5aba8a2038844838a4119fe06eb7f8891d991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 18:49:23 +0200 Subject: [PATCH 09/30] move phpcs:ignore --- dev/setup/codesniffer/ruleset.xml | 4 +- htdocs/comm/mailing/class/mailing.class.php | 6 +- htdocs/don/class/don.class.php | 36 ++++++----- htdocs/don/class/paymentdonation.class.php | 8 ++- .../class/expensereport.class.php | 59 ++++++++++++------- .../template/class/myobject.class.php | 19 +++--- 6 files changed, 79 insertions(+), 53 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index b8ddcebf18c48..79b16bdbf55ce 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 26e2c7bec906e..4b7b31b6b1398 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -439,14 +439,15 @@ function delete($rowid) } } + // 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 @@ function delete_targets() } + // 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 d2039a200cb1a..958924c4da50f 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 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -103,9 +104,9 @@ function getLibStatut($mode=0) * @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 @@ function LibStatut($statut,$mode=0) { 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 @@ function fetch($id, $ref='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Validate a promise of donation * @@ -702,9 +704,9 @@ function fetch($id, $ref='') * @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 @@ function valid_promesse($id, $userid, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the donation as paid, the donation was received * @@ -752,9 +755,9 @@ function valid_promesse($id, $userid, $notrigger=0) * @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 @@ function set_paid($id, $modepayment=0) } } + // 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 @@ function set_cancel($id) } } + // 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 @@ function sum_donations($param) 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 3a839c2e7597c..575a53558771b 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -453,6 +453,7 @@ function getLibStatut($mode=0) return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -460,10 +461,10 @@ function getLibStatut($mode=0) * @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 @@ function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_ } + // 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 7ccb88d82ee47..9f5fdc485e32c 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -547,6 +547,7 @@ function fetch($id, $ref='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the expense report as paid * @@ -555,9 +556,9 @@ function fetch($id, $ref='') * @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 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -626,30 +628,30 @@ function getLibStatut($mode=0) * @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 @@ function initAsSpecimen() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_line_by_project * @@ -801,9 +804,9 @@ function initAsSpecimen() * @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 @@ function recalculer($id) } } + // 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 @@ function setValidate($fuser, $notrigger=0) } } + // 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 @@ function setDeny($fuser,$details,$notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_unpaid * @@ -1375,9 +1381,9 @@ function setDeny($fuser,$details,$notrigger=0) * @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 @@ function set_unpaid($fuser, $notrigger = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_cancel * @@ -1436,9 +1443,9 @@ function set_unpaid($fuser, $notrigger = 0) * @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 @@ function getNomUrl($withpicto=0, $max=0, $short=0, $moretitle='', $notooltip=0, return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you add a line. * @@ -1620,9 +1628,9 @@ function getNomUrl($withpicto=0, $max=0, $short=0, $moretitle='', $notooltip=0, * @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 @@ function update_totaux_add($ligne_total_ht,$ligne_total_tva) endif; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you delete a line. * @@ -1649,9 +1658,9 @@ function update_totaux_add($ligne_total_ht,$ligne_total_tva) * @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 @@ function deleteline($rowid, $fuser='') return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * periode_existe * @@ -2066,9 +2076,9 @@ function deleteline($rowid, $fuser='') * @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 @@ function periode_existe($fuser, $date_debut, $date_fin) } + // 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 @@ function listOfTypes($active=1) 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 @@ function load_state_board() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2264,9 +2277,9 @@ function load_state_board() * @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 @@ function update($fuser) } +// 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 @@ function update($fuser) * @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 21e8df59efc1a..a37f9d35c183f 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 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -375,9 +376,9 @@ function getLibStatut($mode=0) * @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; From 35232b753a79652a6e619453d7a11fb212cc47ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 20:37:12 +0200 Subject: [PATCH 10/30] move phpcs:ignore --- .../comm/action/class/cactioncomm.class.php | 9 +++-- .../cheque/class/remisecheque.class.php | 34 +++++++++------- .../class/ligneprelevement.class.php | 11 +++--- .../actions_contactcard_common.class.php | 14 ++++--- htdocs/fourn/class/fournisseur.class.php | 9 +++-- .../mailinglist_mymodule_myobject.modules.php | 5 ++- htdocs/resource/class/dolresource.class.php | 24 ++++++++---- .../class/html.formresource.class.php | 6 ++- htdocs/user/class/usergroup.class.php | 15 ++++--- htdocs/website/class/website.class.php | 39 ++++++++----------- 10 files changed, 94 insertions(+), 72 deletions(-) diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index 2fcd4e63bd73c..e7fa7a3d2ef52 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -32,7 +32,7 @@ class CActionComm * @var string Error code (or message) */ public $error=''; - + /** * @var DoliDB Database handler. */ @@ -46,12 +46,12 @@ class CActionComm var $code; var $type; var $libelle; // deprecated - + /** * @var string proper name for given parameter */ public $label; - + var $active; var $color; var $picto; @@ -114,6 +114,7 @@ function fetch($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of event types: array(id=>label) or array(code=>label) * @@ -125,9 +126,9 @@ function fetch($id) * @param int $shortlabel 1=Get short label instead of long label * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='', $shortlabel=0) { + // phpcs:enable global $langs,$conf; $langs->load("commercial"); diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index e858f599cc803..70e642cbf90d9 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -37,12 +37,12 @@ class RemiseCheque extends CommonObject * @var string ID to identify managed object */ public $element='chequereceipt'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='bordereau_cheque'; - + public $picto = 'payment'; var $num; @@ -488,15 +488,16 @@ function getNextNumRef($mode='next') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Objet user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -542,14 +543,15 @@ function load_board($user) } + // 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 $user; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -857,14 +859,15 @@ function rejectCheck($bank_id, $rejection_date) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge les proprietes ref_previous et ref_next * * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_previous_next_id() { + // phpcs:enable global $conf; $this->errno = 0; @@ -899,6 +902,7 @@ function load_previous_next_id() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the creation date * @@ -906,9 +910,9 @@ function load_previous_next_id() * @param int $date Date creation * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date($user, $date) { + // phpcs:enable if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; @@ -934,6 +938,7 @@ function set_date($user, $date) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the ref of bordereau * @@ -941,9 +946,9 @@ function set_date($user, $date) * @param int $ref ref of bordereau * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_number($user, $ref) { + // phpcs:enable if ($user->rights->banque->cheque) { $sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque"; @@ -1057,6 +1062,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1064,9 +1070,9 @@ function getLibStatut($mode=0) * @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 Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); if ($mode == 0) @@ -1074,32 +1080,32 @@ function LibStatut($status,$mode=0) if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 0) return $langs->trans('ToValidate'); if ($status == 1) return $langs->trans('Validated'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0').' '.$langs->trans('ToValidate'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans('ToValidate'),'statut0').' '.$langs->trans('ToValidate'); if ($status == 1) return img_picto($langs->trans('Validated'),'statut4').' '.$langs->trans('Validated'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 0) return $langs->trans('ToValidate').' '.img_picto($langs->trans('ToValidate'),'statut0'); if ($status == 1) return $langs->trans('Validated').' '.img_picto($langs->trans('Validated'),'statut4'); diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index fc92302cf7d28..d8434caefd831 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -35,7 +35,7 @@ class LignePrelevement * @var int ID */ public $id; - + /** * @var DoliDB Database handler. */ @@ -128,6 +128,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -135,28 +136,28 @@ function getLibStatut($mode=0) * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); // Waiting if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); // Credited if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); // Refused } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==0) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); if ($statut==3) return img_picto($langs->trans($this->statuts[$statut]),'statut8'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut6'); diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 06c65500527b9..7e41385484670 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -31,7 +31,7 @@ abstract class ActionsContactCardCommon * @var DoliDB Database handler. */ public $db; - + var $dirmodule; var $targetmodule; var $canvas; @@ -41,12 +41,12 @@ abstract class ActionsContactCardCommon var $tpl = array(); //! Object container var $object; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) @@ -76,16 +76,17 @@ function getObject($id) //} } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Set content of ->tpl array, to use into template * * @param string $action Type of action * @param int $id Id * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $conf, $langs, $user, $canvas; global $form, $formcompany, $objsoc; @@ -266,14 +267,15 @@ function assign_values(&$action, $id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { + // phpcs:enable global $langs, $mysoc; $this->object->old_name = $_POST["old_name"]; diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 66f0c730938c5..878f4bee67ead 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -102,14 +102,15 @@ function nbOfProductRefs() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load statistics indicators * * @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(); @@ -144,6 +145,7 @@ function load_state_board() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a supplier category * @@ -151,9 +153,9 @@ function load_state_board() * @param string $name Category name * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function CreateCategory($user, $name) { + // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (label,visible,type)"; $sql.= " VALUES "; $sql.= " ('".$this->db->escape($name)."',1,1)"; @@ -173,14 +175,15 @@ function CreateCategory($user, $name) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the suppliers list * * @return array Array of suppliers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ListArray() { + // phpcs:enable global $conf; global $user; diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 9b52b3119f6c9..545e53d350a8e 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -27,7 +27,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets var $enabled=0; var $require_module=array(); var $picto='mymodule@mymodule'; - + /** * @var DoliDB Database handler. */ @@ -92,6 +92,7 @@ function url($id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -99,9 +100,9 @@ function url($id) * @param array $filtersarray Requete sql de selection des destinataires * @return int <0 if error, number of emails added if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable $target = array(); $cibles = array(); $j = 0; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 13de6e62ccfb4..4d3a4a55c7404 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -333,15 +333,16 @@ function update($user=null, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * * @param int $id id object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_element_resource($id) { + // phpcs:enable global $langs; $sql = "SELECT"; $sql.= " t.rowid,"; @@ -478,6 +479,7 @@ function delete($rowid, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load resource objects into $this->lines * @@ -488,9 +490,9 @@ function delete($rowid, $notrigger=0) * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='') { + // phpcs:enable global $conf; $sql="SELECT "; $sql.= " t.rowid,"; @@ -574,6 +576,7 @@ function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -584,9 +587,9 @@ function fetch_all($sortorder, $sortfield, $limit, $offset, $filter='') * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter='') { + // phpcs:enable global $conf; $sql="SELECT "; $sql.= " t.rowid,"; @@ -652,6 +655,7 @@ function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter='' } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -662,9 +666,9 @@ function fetch_all_resources($sortorder, $sortfield, $limit, $offset, $filter='' * @param array $filter filter output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='') { + // phpcs:enable global $conf; if ( ! $sortorder) $sortorder="ASC"; @@ -730,6 +734,7 @@ function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch all resources available, declared by modules * Load available resource in array $this->available_resources @@ -738,9 +743,9 @@ function fetch_all_used($sortorder, $sortfield, $limit, $offset=1, $filter='') * @deprecated, remplaced by hook getElementResources * @see getElementResources() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_all_available() { + // phpcs:enable global $conf; if (! empty($conf->modules_parts['resources'])) @@ -752,6 +757,7 @@ function fetch_all_available() return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update element resource into database * @@ -759,9 +765,9 @@ function fetch_all_available() * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_element_resource($user=null, $notrigger=0) { + // phpcs:enable global $conf, $langs; $error=0; @@ -880,14 +886,15 @@ function fetchElementResources($element,$element_id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load in cache resource type code (setup in dictionary) * * @return int Nb lignes chargees, 0 si deja chargees, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_cache_code_type_resource() { + // phpcs:enable global $langs; if (count($this->cache_code_type_resource)) return 0; // Cache deja charge @@ -967,6 +974,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -974,9 +982,9 @@ function getLibStatut($mode=0) * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 5=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; return ''; diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 6ed6038af8121..b95ba78e2be81 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -60,6 +60,7 @@ function __construct($db) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a resource * @@ -75,9 +76,9 @@ function __construct($db) * @param int $limit Limit number of answers * @return string HTML string with */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$showempty=0, $showtype=0, $forcecombo=0, $event=array(), $filterkey='', $outputmode=0, $limit=20) { + // phpcs:enable global $conf,$user,$langs; $out=''; @@ -155,6 +156,7 @@ function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$s return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return html list of tickets type * @@ -167,9 +169,9 @@ function select_resource_list($selected='',$htmlname='fk_resource',$filter='',$s * @param int $maxlength Max length of label * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_types_resource($selected='',$htmlname='type_resource',$filtertype='',$format=0, $empty=0, $noadmininfo=0,$maxlength=0) { + // phpcs:enable global $langs,$user; $resourcestat = new Dolresource($this->db); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 98d20bd0ad595..33360116c977d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -39,12 +39,12 @@ class UserGroup extends CommonObject * @var string ID to identify managed object */ public $element='usergroup'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='usergroup'; - + public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto='group'; public $entity; // Entity of group @@ -803,6 +803,7 @@ function getLibStatut($mode=0) return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -810,9 +811,9 @@ function getLibStatut($mode=0) * @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($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('users'); return ''; @@ -895,6 +896,7 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -904,9 +906,9 @@ function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_la * 2=Return key only (uid=qqq) * @return string DN */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_dn($info,$mode=0) { + // phpcs:enable global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_GROUPS."=".$info[$conf->global->LDAP_KEY_GROUPS].",".$conf->global->LDAP_GROUP_DN; @@ -916,14 +918,15 @@ function _load_ldap_dn($info,$mode=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Initialize the info array (array of LDAP values) that will be used to call LDAP functions * * @return array Tableau info des attributs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_ldap_info() { + // phpcs:enable global $conf,$langs; $info=array(); @@ -986,7 +989,7 @@ function initAsSpecimen() * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description * @param int $hideref Hide ref - * @param null|array $moreparams Array to provide more information + * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index d4e29841821e8..039bea84bc65a 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -39,17 +39,17 @@ class Website extends CommonObject * @var string Id to identify managed objects */ public $element = 'website'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'website'; - + /** * @var array Does website support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for website. Must be the part after the 'object_' into object_myobject.png */ @@ -59,37 +59,37 @@ class Website extends CommonObject * @var int */ public $entity; - + /** * @var string */ public $ref; - + /** * @var string */ public $description; - + /** * @var int */ public $status; - + /** * @var mixed */ public $date_creation; - + /** * @var mixed */ public $tms = ''; - + /** * @var integer */ public $fk_default_home; - + /** * @var string */ @@ -695,6 +695,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -702,38 +703,32 @@ function getLibStatut($mode=0) * @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($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'); From 22b96325559d902f71e9997f22635fd2f2d3bb92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 21:08:57 +0200 Subject: [PATCH 11/30] move phpcs:ignore --- .../facture/class/facture-rec.class.php | 22 +++--- htdocs/compta/facture/class/facture.class.php | 72 ++++++++++++------- htdocs/compta/tva/class/tva.class.php | 23 +++--- .../company/actions_card_company.class.php | 3 +- 4 files changed, 75 insertions(+), 45 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 4687a84180770..51b031b5c7ce1 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -43,12 +43,12 @@ class FactureRec extends CommonInvoice * @var string ID to identify managed object */ public $element='facturerec'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture_rec'; - + public $table_element_line='facturedet_rec'; public $fk_element='fk_facture'; public $picto='bill'; @@ -440,14 +440,15 @@ function getLinesArray() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recupere les lignes de factures predefinies dans this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); // Retreive all extrafield for line @@ -1182,6 +1183,7 @@ function getLibStatut($mode=0, $alreadypaid=-1) return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1192,9 +1194,9 @@ function getLibStatut($mode=0, $alreadypaid=-1) * @param int $type Type invoice * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) { + // phpcs:enable global $langs; $langs->load('bills'); @@ -1213,7 +1215,7 @@ function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) else return $langs->trans("Draft"); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if ($recur) @@ -1227,7 +1229,7 @@ function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) else return $langs->trans("Draft"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($recur) { @@ -1240,7 +1242,7 @@ function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 3) + elseif ($mode == 3) { if ($recur) { @@ -1254,7 +1256,7 @@ function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) else return img_picto($langs->trans('Draft'),'statut0'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if ($recur) @@ -1268,7 +1270,7 @@ function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 5 || $mode == 6) + elseif ($mode == 5 || $mode == 6) { $prefix=''; if ($mode == 5) $prefix='Short'; @@ -1653,7 +1655,7 @@ class FactureLigneRec extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedetrec'; - + /** * @var string Name of table without prefix where object is stored */ diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index da0d66b278428..cb38b954736ca 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -57,12 +57,12 @@ class Facture extends CommonInvoice * @var string ID to identify managed object */ public $element='facture'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture'; - + public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; public $picto='bill'; @@ -1406,14 +1406,15 @@ function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $fetch_situation=false } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all detailed lines into this->lines * * @return int 1 if OK, < 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = 'SELECT l.rowid, l.fk_facture, l.fk_product, l.fk_parent_line, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,'; @@ -1666,15 +1667,16 @@ function update(User $user, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount line into an invoice (as an invoice line) using an existing absolute discount (Consume the discount) * * @param int $idremise Id of absolute 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'; @@ -1767,6 +1769,7 @@ function insert_discount($idremise) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -1774,9 +1777,9 @@ function insert_discount($idremise) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_ref_client($ref_client, $notrigger=0) { + // phpcs:enable global $user; $error=0; @@ -2001,6 +2004,7 @@ function delete($user, $notrigger=0, $idwarehouse=-1) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme paye completement (si close_code non renseigne) => this->fk_statut=2, this->paye=1 * ou partiellement (si close_code renseigne) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 @@ -2010,9 +2014,9 @@ function delete($user, $notrigger=0, $idwarehouse=-1) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { + // phpcs:enable $error=0; if ($this->paye != 1) @@ -2060,6 +2064,7 @@ function set_paid($user, $close_code='', $close_note='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag la facture comme non payee completement + appel trigger BILL_UNPAYED * Fonction utilisee quand un paiement prelevement est refuse, @@ -2068,9 +2073,9 @@ function set_paid($user, $close_code='', $close_note='') * @param User $user Object user that change status * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable $error=0; $this->db->begin(); @@ -2108,6 +2113,7 @@ function set_unpaid($user) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because @@ -2118,9 +2124,9 @@ function set_unpaid($user) * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_canceled($user, $close_code='', $close_note='') { + // phpcs:enable dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); @@ -2472,6 +2478,7 @@ function updatePriceNextInvoice(&$langs) return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2479,9 +2486,9 @@ function updatePriceNextInvoice(&$langs) * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user,$idwarehouse=-1) { + // phpcs:enable global $conf,$langs; $error=0; @@ -3038,6 +3045,7 @@ function checkProgressLine($idline, $situation_percent) else return $situation_percent < $obj->situation_percent; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update invoice line with percentage * @@ -3045,9 +3053,9 @@ function checkProgressLine($idline, $situation_percent) * @param int $percent Percentage * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_percent($line, $percent) { + // phpcs:enable global $mysoc,$user; include_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; @@ -3135,6 +3143,7 @@ function deleteline($rowid) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set percent discount * @@ -3143,9 +3152,9 @@ function deleteline($rowid) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise($user, $remise, $notrigger=0) { + // phpcs:enable // Clean parameters if (empty($remise)) $remise=0; @@ -3200,6 +3209,7 @@ function set_remise($user, $remise, $notrigger=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set absolute discount * @@ -3208,9 +3218,9 @@ function set_remise($user, $remise, $notrigger=0) * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise, $notrigger=0) { + // phpcs:enable if (empty($remise)) $remise=0; if ($user->rights->facture->creer) @@ -3401,6 +3411,7 @@ function info($id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices (eventually filtered on a user) into an array * @@ -3414,9 +3425,9 @@ function info($id) * @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, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -3476,6 +3487,7 @@ function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be replaced by another invoice. * Invoices matching the following rules are returned: @@ -3484,9 +3496,9 @@ function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $ * @param int $socid Id thirdparty * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -3525,6 +3537,7 @@ function list_replacable_invoices($socid=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices qualified to be corrected by a credit note. * Invoices matching the following rules are returned: @@ -3533,9 +3546,9 @@ function list_replacable_invoices($socid=0) * @param int $socid Id thirdparty * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -3599,6 +3612,7 @@ function list_qualified_avoir_invoices($socid=0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a withdrawal request for a standing order. * Use the remain to pay excluding all existing open direct debit requests. @@ -3607,9 +3621,9 @@ function list_qualified_avoir_invoices($socid=0) * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement($fuser, $amount=0) { + // phpcs:enable $error=0; @@ -3710,6 +3724,7 @@ function demande_prelevement($fuser, $amount=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Supprime une demande de prelevement * @@ -3717,9 +3732,9 @@ function demande_prelevement($fuser, $amount=0) * @param int $did id de la demande a supprimer * @return int <0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function demande_prelevement_delete($fuser, $did) { + // phpcs:enable $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'prelevement_facture_demande'; $sql .= ' WHERE rowid = '.$did; $sql .= ' AND traite = 0'; @@ -3736,15 +3751,16 @@ function demande_prelevement_delete($fuser, $did) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @param User $user Object user * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user) { + // phpcs:enable global $conf, $langs; $clause = " WHERE"; @@ -3982,14 +3998,15 @@ function initAsSpecimen($option='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * * @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(); @@ -4096,25 +4113,27 @@ function newCycle() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the first of a cycle * * @return boolean */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_first() { + // phpcs:enable return ($this->situation_counter == 1); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array containing the previous situations as Facture objects * * @return mixed -1 if error, array of previous situations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_sits() { + // phpcs:enable global $conf; $sql = 'SELECT rowid FROM ' . MAIN_DB_PREFIX . 'facture'; @@ -4187,15 +4206,16 @@ function setFinal(User $user, $notrigger=0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Checks if the invoice is the last in its cycle * * @return bool Last of the cycle status * */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_last_in_cycle() { + // phpcs:enable global $conf; if (!empty($this->situation_cycle_ref)) { @@ -4262,7 +4282,7 @@ class FactureLigne extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedet'; - + /** * @var string Name of table without prefix where object is stored */ @@ -4825,15 +4845,16 @@ function delete() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Mise a jour en base des champs total_xxx de ligne de facture * TODO What is goal of this method ? * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); dol_syslog(get_class($this)."::update_total", LOG_DEBUG); @@ -4866,6 +4887,7 @@ function update_total() } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns situation_percent of the previous line. * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. @@ -4873,9 +4895,9 @@ function update_total() * @param int $invoiceid Invoice id * @return int >= 0 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_prev_progress($invoiceid) { + // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { return 0; } else { diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index a5f7c3134d795..b1197260240b3 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -37,12 +37,12 @@ class Tva extends CommonObject * @var string ID to identify managed object */ public $element='tva'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='tva'; - + public $picto='payment'; var $tms; @@ -51,12 +51,12 @@ class Tva extends CommonObject var $amount; var $type_payment; var $num_payment; - + /** * @var string proper name for given parameter */ public $label; - + var $fk_bank; var $fk_user_creat; var $fk_user_modif; @@ -363,15 +363,16 @@ function solde($year = 0) return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT from invoices emitted by the thirdparty. * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_collectee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.tva) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f WHERE f.paye = 1"; @@ -403,15 +404,16 @@ function tva_sum_collectee($year = 0) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_payee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.total_tva) as total_tva"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -444,15 +446,16 @@ function tva_sum_payee($year = 0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Total of the VAT payed * * @param int $year Year * @return double Amount */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tva_sum_reglee($year = 0) { + // phpcs:enable $sql = "SELECT sum(f.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."tva as f"; @@ -636,15 +639,16 @@ function addPayment($user) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between payment tva and line generate into llx_bank * * @param int $id_bank Id bank account * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'tva SET fk_bank = '.$id_bank; $sql.= ' WHERE rowid = '.$this->id; $result = $this->db->query($sql); @@ -800,6 +804,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -807,9 +812,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage return ''; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 1949f696a8693..3e18b7944f2fa 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -67,6 +67,7 @@ private function getTitle($action) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -75,9 +76,9 @@ private function getTitle($action) * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs, $user, $mysoc; global $form, $formadmin, $formcompany; From 2a9ef8dc0573ed0a907a3843915dce2ecec5bcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 22:05:19 +0200 Subject: [PATCH 12/30] move phpcs:ignore --- .../class/accountingaccount.class.php | 19 ++++--- .../actions_adherentcard_common.class.php | 8 +-- .../actions_adherentcard_default.class.php | 6 ++- .../actions_contactcard_default.class.php | 10 ++-- .../core/class/emailsenderprofile.class.php | 26 ++++----- htdocs/core/class/html.formprojet.class.php | 11 ++-- htdocs/core/class/html.formsms.class.php | 3 +- htdocs/core/class/menu.class.php | 3 +- htdocs/core/modules/DolibarrModules.class.php | 54 ++++++++++++------- .../barcode/mod_barcode_product_standard.php | 6 ++- .../modules/fichinter/modules_fichinter.php | 6 ++- htdocs/core/modules/member/modules_cards.php | 6 ++- .../fourn/class/fournisseur.product.class.php | 25 +++++---- .../mailmanspip/class/mailmanspip.class.php | 17 +++--- .../canvas/actions_card_common.class.php | 12 +++-- .../actions_card_individual.class.php | 3 +- htdocs/website/class/websitepage.class.php | 17 +++--- 17 files changed, 140 insertions(+), 92 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index c6848bfe68949..f2e2bbaf04caa 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -528,15 +528,16 @@ function info($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Account deactivated * * @param int $id Id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_desactivate($id) { + // phpcs:enable $result = $this->checkUsage(); if ($result > 0) { @@ -562,15 +563,16 @@ function account_desactivate($id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Account activated * * @param int $id Id * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function account_activate($id) { + // phpcs:enable $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; @@ -601,6 +603,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -608,9 +611,9 @@ function getLibStatut($mode=0) * @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($statut,$mode=0) { + // phpcs:enable global $langs; $langs->loadLangs(array("users")); @@ -620,27 +623,27 @@ function LibStatut($statut,$mode=0) if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == 1) return $langs->trans('Enabled'); if ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index fe91fc744363c..b84534af37a62 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -75,16 +75,17 @@ function getObject($id) //} } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Set content of ->tpl array, to use into template * * @param string $action Type of action * @param int $id Id * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $conf, $langs, $user, $canvas; global $form, $formcompany, $objsoc; @@ -233,14 +234,15 @@ function assign_values(&$action, $id) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post() { + // phpcs:enable global $langs, $mysoc; $this->object->old_name = $_POST["old_name"]; diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index c5d6a89a15202..be7af41e894b8 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -67,6 +67,7 @@ private function getTitle($action) return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -74,9 +75,9 @@ private function getTitle($action) * @param int $id Id * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; @@ -121,6 +122,7 @@ function assign_values(&$action, $id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -130,9 +132,9 @@ function assign_values(&$action, $id) * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; //$this->getFieldList(); diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 566434c1d5a92..5831b943d768f 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -29,8 +29,8 @@ */ class ActionsContactCardDefault extends ActionsContactCardCommon { - /** - * Constructor + /** + * Constructor * * @param DoliDB $db Handler acces base de donnees * @param string $dirmodule Name of directory of module @@ -66,6 +66,7 @@ private function getTitle($action) return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -73,9 +74,9 @@ private function getTitle($action) * @param int $id Id * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id) { + // phpcs:enable global $limit, $offset, $sortfield, $sortorder; global $conf, $db, $langs, $user; global $form; @@ -120,6 +121,7 @@ function assign_values(&$action, $id) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -129,9 +131,9 @@ function assign_values(&$action, $id) * @param string $sortorder Sort order ('ASC' or 'DESC') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LoadListDatas($limit, $offset, $sortfield, $sortorder) { + // phpcs:enable global $conf, $langs; //$this->getFieldList(); diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index ffff8ef1941f5..37685001abab3 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -39,17 +39,17 @@ class EmailSenderProfile extends CommonObject * @var string ID to identify managed object */ public $element = 'emailsenderprofile'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'c_email_senderprofile'; - + /** * @var array Does emailsenderprofile support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 1; - + /** * @var string String with name of icon for emailsenderprofile */ @@ -310,6 +310,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -317,43 +318,36 @@ function getLibStatut($mode=0) * @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) { 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/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 61c633c720b69..e9e1d8fe6c90d 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -33,7 +33,7 @@ class FormProjets * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -51,6 +51,7 @@ function __construct($db) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a combo list with projects qualified for a third party / user * @@ -71,9 +72,9 @@ function __construct($db) * @param int $htmlid Html id to use instead of htmlname * @return string Return html content */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0, $forceaddid=0, $morecss='', $htmlid='') { + // phpcs:enable global $langs,$conf,$form; $out=''; @@ -119,6 +120,7 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen else return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array with projects qualified for a third party * @@ -139,9 +141,9 @@ function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlen * @param string $morecss More CSS * @return int Nb of project if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '', $nooutput=0, $forceaddid=0, $htmlid='', $morecss='maxwidth500') { + // phpcs:enable global $user,$conf,$langs; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -470,6 +472,7 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build a HTML select list of element of same thirdparty to suggest to link them to project * @@ -480,9 +483,9 @@ function selectTasks($socid=-1, $selected='', $htmlname='taskid', $maxlength=24, * @param string $projectkey Equivalent key to fk_projet for actual table_element * @return int|string The HTML select list of element or '' if nothing or -1 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_element($table_element, $socid=0, $morecss='', $limitonstatus=-2,$projectkey="fk_projet") { + // phpcs:enable global $conf, $langs; if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done) diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index 1db9fe4d3d85f..a549485ac4c21 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -88,6 +88,7 @@ function __construct($db) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show the form to input an sms. * @@ -95,9 +96,9 @@ function __construct($db) * @param int $showform Show form tags and submit button (recommanded is to use with value 0) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_form($morecss='titlefield', $showform=1) { + // phpcs:enable global $conf, $langs, $user, $form; if (! is_object($form)) $form=new Form($this->db); diff --git a/htdocs/core/class/menu.class.php b/htdocs/core/class/menu.class.php index b1ecbbf483cf8..3d9d92189a377 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -96,14 +96,15 @@ function insert($idafter, $url, $titre, $level=0, $enabled=1, $target='',$mainme $this->liste=array_merge($array_start,$array_new,$array_end); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a menu entry from this->liste * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_last() { + // phpcs:enable if (count($this->liste) > 1) { array_pop($this->liste); } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 42be08bfe348d..c700b8c84a1e1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -999,6 +999,7 @@ function _unactive() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create tables and keys required by module. * Files module.sql and module.key.sql with create table and create keys @@ -1008,9 +1009,9 @@ function _unactive() * @param string $reldir Relative directory where to scan files * @return int <=0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _load_tables($reldir) { + // phpcs:enable global $conf; $error=0; @@ -1118,6 +1119,7 @@ function _load_tables($reldir) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds boxes * @@ -1125,9 +1127,9 @@ function _load_tables($reldir) * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_boxes($option='') { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; global $conf; @@ -1218,14 +1220,15 @@ function insert_boxes($option='') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes boxes * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_boxes() { + // phpcs:enable global $conf; $err=0; @@ -1294,14 +1297,15 @@ function delete_boxes() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds cronjobs * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_cronjobs() { + // phpcs:enable require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php'; global $conf; @@ -1408,14 +1412,15 @@ function insert_cronjobs() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes boxes * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_cronjobs() { + // phpcs:enable global $conf; $err=0; @@ -1438,14 +1443,15 @@ function delete_cronjobs() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes tabs * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_tabs() { + // phpcs:enable global $conf; $err=0; @@ -1464,14 +1470,15 @@ function delete_tabs() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds tabs * * @return int Error count (0 if ok) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_tabs() { + // phpcs:enable global $conf; $err=0; @@ -1532,14 +1539,15 @@ function insert_tabs() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds constants * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_const() { + // phpcs:enable global $conf; $err=0; @@ -1602,14 +1610,15 @@ function insert_const() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes constants tagged 'deleteonunactive' * * @return int <0 if KO, 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_const() { + // phpcs:enable global $conf; $err=0; @@ -1638,6 +1647,7 @@ function delete_const() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds access rights * @@ -1646,9 +1656,9 @@ function delete_const() * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_permissions($reinitadminperms=0, $force_entity=null, $notrigger=0) { + // phpcs:enable global $conf,$user; $err=0; @@ -1794,14 +1804,15 @@ function insert_permissions($reinitadminperms=0, $force_entity=null, $notrigger= } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes access rights * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_permissions() { + // phpcs:enable global $conf; $err=0; @@ -1820,14 +1831,15 @@ function delete_permissions() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds menu entries * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_menus() { + // phpcs:enable global $user; if (! is_array($this->menu) || empty($this->menu)) return 0; @@ -1930,14 +1942,15 @@ function insert_menus() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes menu entries * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_menus() { + // phpcs:enable global $conf; $err=0; @@ -1960,14 +1973,15 @@ function delete_menus() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Creates directories * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_dirs() { + // phpcs:enable global $langs, $conf; $err=0; @@ -2019,6 +2033,7 @@ function create_dirs() } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds directories definitions * @@ -2027,9 +2042,9 @@ function create_dirs() * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_dirs($name,$dir) { + // phpcs:enable global $conf; $err=0; @@ -2064,14 +2079,15 @@ function insert_dirs($name,$dir) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes directories * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_dirs() { + // phpcs:enable global $conf; $err=0; @@ -2090,14 +2106,15 @@ function delete_dirs() return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds generic parts * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_module_parts() { + // phpcs:enable global $conf; $error=0; @@ -2169,14 +2186,15 @@ function insert_module_parts() return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Removes generic parts * * @return int Error count (0 if OK) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_module_parts() { + // phpcs:enable global $conf; $err=0; diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index bd61dab4ff499..42ce154c648df 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -223,6 +223,7 @@ function verif($db, &$code, $product, $thirdparty_type, $type) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if a code is used (by other element) * @@ -231,9 +232,9 @@ function verif($db, &$code, $product, $thirdparty_type, $type) * @param Product $product Objet product * @return int 0 if available, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $product) { + // phpcs:enable $sql = "SELECT barcode FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE barcode = '".$code."'"; if ($product->id > 0) $sql.= " AND rowid <> ".$product->id; @@ -256,6 +257,7 @@ function verif_dispo($db, $code, $product) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if a barcode value match syntax * @@ -263,9 +265,9 @@ function verif_dispo($db, $code, $product) * @param string $typefortest Type of barcode (ISBN, EAN, ...) * @return int 0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_syntax($codefortest, $typefortest) { + // phpcs:enable global $conf; $result = 0; diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index bc08063ea2145..2d3c4bebfe6a5 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -40,6 +40,7 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -47,9 +48,9 @@ abstract class ModelePDFFicheinter extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { + // phpcs:enable global $conf; $type='ficheinter'; @@ -148,6 +149,7 @@ function getVersion() } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF * @@ -160,9 +162,9 @@ function getVersion() * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + // phpcs:enable global $conf,$langs,$user; $langs->load("ficheinter"); diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index b1dc86d4e4d62..c931abce4edd2 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -40,6 +40,7 @@ class ModelePDFCards public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -47,9 +48,9 @@ class ModelePDFCards * @param integer $maxfilenamelength Max length of value to show * @return array List of templates */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { + // phpcs:enable global $conf; $type='member'; @@ -63,6 +64,7 @@ function liste_modeles($db,$maxfilenamelength=0) } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF * @@ -74,9 +76,9 @@ function liste_modeles($db,$maxfilenamelength=0) * @param string $template pdf generenate document class to use default 'standard' * @return int <0 if KO, >0 if OK */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='', $template='standard') { + // phpcs:enable global $conf,$langs; $langs->load("members"); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 77a31689237c5..57502a52365a6 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -41,7 +41,7 @@ class ProductFournisseur extends Product * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -53,7 +53,7 @@ class ProductFournisseur extends Product * @var int ID */ public $id; - + /** * @deprecated * @see ref_supplier @@ -104,15 +104,16 @@ function __construct($db) + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove all prices for this couple supplier-product * * @param int $id_fourn Supplier Id * @return int < 0 if error, > 0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_fournisseur($id_fourn) { + // phpcs:enable $ok=1; $this->db->begin(); @@ -141,15 +142,16 @@ function remove_fournisseur($id_fourn) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a price for a couple supplier-product * * @param int $rowid Line id of price * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_product_fournisseur_price($rowid) { + // phpcs:enable global $conf, $user; $error=0; @@ -186,6 +188,7 @@ function remove_product_fournisseur_price($rowid) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify the purchase price for a supplier * @@ -212,9 +215,9 @@ function remove_product_fournisseur_price($rowid) * @param string $desc_fourn Custom description for product_fourn_price * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $availability, $ref_fourn, $tva_tx, $charges=0, $remise_percent=0, $remise=0, $newnpr=0, $delivery_time_days=0, $supplier_reputation='', $localtaxes_array=array(), $newdefaultvatcode='', $multicurrency_buyprice=0, $multicurrency_price_base_type='HT',$multicurrency_tx=1,$multicurrency_code='', $desc_fourn='') { + // phpcs:enable global $conf, $langs; //global $mysoc; @@ -441,6 +444,7 @@ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $avai } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Loads the price information of a provider * @@ -448,9 +452,9 @@ function update_buyprice($qty, $buyprice, $user, $price_base_type, $fourn, $avai * @param int $ignore_expression Ignores the math expression for calculating price and uses the db value instead * @return int < 0 if KO, 0 if OK but not found, > 0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) { + // phpcs:enable global $conf; $sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.info_bits as fourn_tva_npr, pfp.fk_availability,"; @@ -529,6 +533,7 @@ function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List all supplier prices of a product * @@ -539,9 +544,9 @@ function fetch_product_fournisseur_price($rowid, $ignore_expression = 0) * @param int $offset Offset * @return array Array of Products with new properties to define supplier price */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $limit=0, $offset=0) { + // phpcs:enable global $conf; $sql = "SELECT s.nom as supplier_name, s.rowid as fourn_id,"; @@ -630,6 +635,7 @@ function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $ } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties for minimum price * @@ -638,9 +644,9 @@ function list_product_fournisseur_price($prodid, $sortfield='', $sortorder='', $ * @param int $socid get min price for specific supplier * @return int <0 if KO, 0=Not found of no product id provided, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function find_min_price_product_fournisseur($prodid, $qty=0, $socid=0) { + // phpcs:enable global $conf; if (empty($prodid)) @@ -818,6 +824,7 @@ function getSocNomUrl($withpicto=0,$option='supplier',$maxlen=0,$notooltip=0) return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display price of product * @@ -829,9 +836,9 @@ function getSocNomUrl($withpicto=0,$option='supplier',$maxlen=0,$notooltip=0) * to display in table format. * @return string String with supplier price */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function display_price_product_fournisseur($showunitprice=1,$showsuptitle=1,$maxlen=0,$notooltip=0, $productFournList=array()) { + // phpcs:enable global $langs; $out = ''; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index c33e015ec7912..139183e03759e 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -42,7 +42,7 @@ class MailmanSpip * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -170,15 +170,16 @@ private function callMailman($object, $url, $list) return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui donne les droits redacteurs dans spip * * @param Adherent $object Object with data (->firstname, ->lastname, ->email and ->login) * @return int =0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_spip($object) { + // phpcs:enable dol_syslog(get_class($this)."::add_to_spip"); if ($this->isSpipEnabled()) @@ -213,15 +214,16 @@ function add_to_spip($object) return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui enleve les droits redacteurs dans spip * * @param Adherent $object Object with data (->login) * @return int =0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_spip($object) { + // phpcs:enable dol_syslog(get_class($this)."::del_to_spip"); if ($this->isSpipEnabled()) @@ -253,15 +255,16 @@ function del_to_spip($object) return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui dit si cet utilisateur est un redacteur existant dans spip * * @param object $object Object with data (->login) * @return int 1=exists, 0=does not exists, -1=error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_in_spip($object) { + // phpcs:enable if ($this->isSpipEnabled()) { if ($this->checkSpipConfig()) @@ -304,6 +307,7 @@ function is_in_spip($object) return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Subscribe an email to all mailing-lists * @@ -311,9 +315,9 @@ function is_in_spip($object) * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_mailman($object,$listes='') { + // phpcs:enable global $conf,$langs,$user; dol_syslog(get_class($this)."::add_to_mailman"); @@ -376,6 +380,7 @@ function add_to_mailman($object,$listes='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Unsubscribe an email from all mailing-lists * Used when a user is resiliated @@ -384,9 +389,9 @@ function add_to_mailman($object,$listes='') * @param array $listes To force mailing-list (string separated with ,) * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_to_mailman($object,$listes='') { + // phpcs:enable global $conf,$langs,$user; dol_syslog(get_class($this)."::del_to_mailman"); diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 30b1667afcfde..2577f5bed5d5d 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -31,7 +31,7 @@ abstract class ActionsCardCommon * @var DoliDB Database handler. */ public $db; - + var $dirmodule; var $targetmodule; var $canvas; @@ -41,12 +41,12 @@ abstract class ActionsCardCommon var $tpl = array(); //! Object container var $object; - + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) @@ -70,6 +70,7 @@ protected function getObject($id,$ref='') $this->object = $object; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -78,9 +79,9 @@ protected function getObject($id,$ref='') * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs, $user, $mysoc, $canvas; global $form, $formadmin, $formcompany; @@ -370,15 +371,16 @@ function assign_values(&$action, $id=0, $ref='') } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Assign POST values into object * * @param string $action Action string * @return string HTML output */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function assign_post($action) { + // phpcs:enable global $langs, $mysoc; $this->object->id = $_POST["socid"]; diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index c662ce2ae6f5c..5fd7ee01faf45 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -84,6 +84,7 @@ function doActions(&$action, $id) return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas (for example into this->tpl to be used by templates) * @@ -92,9 +93,9 @@ function doActions(&$action, $id) * @param string $ref Ref of object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function assign_values(&$action, $id=0, $ref='') { + // phpcs:enable global $conf, $langs; global $form, $formcompany; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index 4b313808e0dec..3f446f13a5b15 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -39,12 +39,12 @@ class WebsitePage extends CommonObject * @var string Id to identify managed objects */ public $element = 'websitepage'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'website_page'; - + /** * @var string String with name of icon for websitepage. Must be the part after the 'object_' into object_myobject.png */ @@ -467,6 +467,7 @@ function getLibStatut($mode=0) return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -474,9 +475,9 @@ function getLibStatut($mode=0) * @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($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) @@ -485,27 +486,27 @@ function LibStatut($status,$mode=0) if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($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'); From 47e73bfd8e937950925025067c6a22405f83da66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 2 Sep 2018 23:01:14 +0200 Subject: [PATCH 13/30] move phpcs:ignore --- .../class/commonstickergenerator.class.php | 21 ++-- htdocs/core/class/discount.class.php | 8 +- htdocs/core/class/doleditor.class.php | 3 +- htdocs/core/class/dolgraph.class.php | 97 ++++++++++++------- htdocs/core/class/dolreceiptprinter.class.php | 41 ++++---- .../core/class/html.formaccounting.class.php | 20 ++-- htdocs/core/class/html.formactions.class.php | 8 +- htdocs/core/class/html.formadmin.class.php | 26 +++-- htdocs/core/class/html.formcron.class.php | 5 +- htdocs/core/class/openid.class.php | 57 +++++++---- htdocs/core/class/translate.class.php | 9 +- 11 files changed, 186 insertions(+), 109 deletions(-) diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 2622704878207..6d4c32d82bbe1 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -94,6 +94,7 @@ function __construct($db) $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP strem. * @@ -103,8 +104,8 @@ function __construct($db) * @param string $outputdir Output directory for pdf file * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir=''); + // phpcs:enable /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) @@ -116,6 +117,7 @@ abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outp */ abstract function addSticker(&$pdf,$outputlangs,$param); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Methode qui permet de modifier la taille des caracteres * Cela modiera aussi l'espace entre chaque ligne @@ -124,9 +126,9 @@ abstract function addSticker(&$pdf,$outputlangs,$param); * @param int $pt point * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Set_Char_Size(&$pdf,$pt) { + // phpcs:enable if ($pt > 3) { $this->_Char_Size = $pt; $this->_Line_Height = $this->_Get_Height_Chars($pt); @@ -134,6 +136,7 @@ function Set_Char_Size(&$pdf,$pt) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Print dot line * @@ -146,9 +149,9 @@ function Set_Char_Size(&$pdf,$pt) * @param int $nbPointilles Nb pointilles * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15) { + // phpcs:enable $pdf->SetLineWidth($epaisseur); $length=abs($x1-$x2); $hauteur=abs($y1-$y2); @@ -176,6 +179,7 @@ function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Function realisant une croix aux 4 coins des cartes * @@ -188,9 +192,9 @@ function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles * @param int $taille Size * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) { + // phpcs:enable $pdf->SetDrawColor(192,192,192); $pdf->SetLineWidth($epaisseur); @@ -211,6 +215,7 @@ function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) $pdf->SetDrawColor(0,0,0); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Convert units (in to mm, mm to in) * $src and $dest must be 'in' or 'mm' @@ -220,9 +225,9 @@ function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) * @param string $dest to * @return float value value after conversion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Convert_Metric($value, $src, $dest) { + // phpcs:enable if ($src != $dest) { $tab['in'] = 39.37008; $tab['mm'] = 1000; @@ -232,15 +237,16 @@ function _Convert_Metric($value, $src, $dest) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Give the height for a char size given. * * @param int $pt Point * @return int Height chars */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Get_Height_Chars($pt) { + // phpcs:enable // Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes $_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10); if (in_array($pt, array_keys($_Table_Hauteur_Chars))) { @@ -250,6 +256,7 @@ function _Get_Height_Chars($pt) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Set format * @@ -257,9 +264,9 @@ function _Get_Height_Chars($pt) * @param string $format Format * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _Set_Format(&$pdf, $format) { + // phpcs:enable $this->_Metric = $format['metric']; $this->_Avery_Name = $format['name']; $this->_Avery_Code = $format['code']; diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index a2ac7a1f458d0..b1a92ae0f5f04 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -32,7 +32,7 @@ class DiscountAbsolute * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -344,6 +344,7 @@ function delete($user) + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * When discount is a global discount used as an invoice line, we link using rowidline. @@ -353,9 +354,9 @@ function delete($user) * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduc payment of invoice) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function link_to_invoice($rowidline,$rowidinvoice) { + // phpcs:enable // Check parameters if (! $rowidline && ! $rowidinvoice) { @@ -399,15 +400,16 @@ function link_to_invoice($rowidline,$rowidinvoice) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link the discount to a particular invoice line or a particular invoice. * Do not call this if discount is linked to a reconcialiated invoice * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function unlink_invoice() { + // phpcs:enable $sql ="UPDATE ".MAIN_DB_PREFIX."societe_remise_except"; if(! empty($this->discount_type)) { $sql.=" SET fk_invoice_supplier_line = NULL, fk_invoice_supplier = NULL"; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 52d9b47ecdf72..548721be05f5f 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -137,6 +137,7 @@ function __construct($htmlname, $content, $width='', $height=200, $toolbarname=' } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output edit area inside the HTML stream. * Output depends on this->tool (fckeditor, ckeditor, textarea, ...) @@ -148,9 +149,9 @@ function __construct($htmlname, $content, $width='', $height=200, $toolbarname=' * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='') { + // phpcs:enable global $conf,$langs; $fullpage=false; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 55ecc77291a9e..f3d6041515c6e 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -69,7 +69,7 @@ class DolGraph var $showpercent=0; var $combine=0; // 0.05 if you want to combine records < 5% into "other" var $graph; // Objet Graph (Artichow, Phplot...) - + /** * @var string Error code (or message) */ @@ -128,120 +128,130 @@ function __construct($library='jflot') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set Y precision * * @param float $which_prec Precision * @return boolean */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetPrecisionY($which_prec) { + // phpcs:enable $this->PrecisionY = $which_prec; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xi Xi * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHorizTickIncrement($xi) { + // phpcs:enable $this->horizTickIncrement = $xi; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Utiliser SetNumTicks ou SetHorizTickIncrement mais pas les 2 * * @param float $xt Xt * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetNumXTicks($xt) { + // phpcs:enable $this->SetNumXTicks = $xt; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set label interval to reduce number of labels * * @param float $x Label interval * @return boolean True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLabelInterval($x) { + // phpcs:enable $this->labelInterval = $x; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Hide X grid * * @param boolean $bool XGrid or not * @return boolean true */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideXGrid($bool) { + // phpcs:enable $this->hideXGrid = $bool; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Hide Y grid * * @param boolean $bool YGrid or not * @return boolean true */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHideYGrid($bool) { + // phpcs:enable $this->hideYGrid = $bool; return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set y label * * @param string $label Y label * @return boolean|null True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetYLabel($label) { + // phpcs:enable $this->YLabel = $label; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set width * * @param int $w Width * @return boolean|null True */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetWidth($w) { + // phpcs:enable $this->width = $w; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set title * * @param string $title Title * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetTitle($title) { + // phpcs:enable $this->title = $title; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set data * @@ -249,161 +259,174 @@ function SetTitle($title) * @return void * @see draw_jflot for syntax of data array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetData($data) { + // phpcs:enable $this->data = $data; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set data * * @param array $datacolor Data color array(array(R,G,B),array(R,G,B)...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetDataColor($datacolor) { + // phpcs:enable $this->datacolor = $datacolor; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set type * * @param array $type Array with type for each serie. Example: array('pie'), array('lines',...,'bars') * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetType($type) { + // phpcs:enable $this->type = $type; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set legend * * @param array $legend Legend. Example: array('seriename1','seriname2',...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegend($legend) { + // phpcs:enable $this->Legend = $legend; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set min width * * @param int $legendwidthmin Min width * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetLegendWidthMin($legendwidthmin) { + // phpcs:enable $this->LegendWidthMin = $legendwidthmin; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set max value * * @param int $max Max value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMaxValue($max) { + // phpcs:enable $this->MaxValue = $max; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValue() { + // phpcs:enable return $this->MaxValue; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set min value * * @param int $min Min value * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetMinValue($min) { + // phpcs:enable $this->MinValue = $min; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get min value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValue() { + // phpcs:enable return $this->MinValue; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set height * * @param int $h Height * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetHeight($h) { + // phpcs:enable $this->height = $h; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetShading($s) { + // phpcs:enable $this->SetShading = $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set shading * * @param string $s Shading * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetCssPrefix($s) { + // phpcs:enable $this->cssprefix = $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset bg color * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColor() { + // phpcs:enable unset($this->bgcolor); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset bgcolorgrid * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetBgColorGrid() { + // phpcs:enable unset($this->bgcolorgrid); } @@ -452,15 +475,16 @@ function setShowPercent($showpercent) + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define background color of complete image * * @param array $bg_color array(R,G,B) ou 'onglet' ou 'default' * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColor($bg_color = array(255,255,255)) { + // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; if (! is_array($bg_color)) @@ -481,15 +505,16 @@ function SetBgColor($bg_color = array(255,255,255)) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define background color of grid * * @param array $bg_colorgrid array(R,G,B) ou 'onglet' ou 'default' * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SetBgColorGrid($bg_colorgrid = array(255,255,255)) { + // phpcs:enable global $theme_bgcolor,$theme_bgcoloronglet; if (! is_array($bg_colorgrid)) @@ -510,25 +535,27 @@ function SetBgColorGrid($bg_colorgrid = array(255,255,255)) } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reset data color * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function ResetDataColor() { + // phpcs:enable unset($this->datacolor); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get max value * * @return int Max value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMaxValueInData() { + // phpcs:enable $k = 0; $vals = array(); @@ -547,14 +574,15 @@ function GetMaxValueInData() return $vals[0]; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return min value of all data * * @return int Min value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetMinValueInData() { + // phpcs:enable $k = 0; $vals = array(); @@ -573,14 +601,15 @@ function GetMinValueInData() return $vals[0]; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return max value of all data * * @return int Max value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetCeilMaxValue() { + // phpcs:enable $max = $this->GetMaxValueInData(); if ($max != 0) $max++; $size=dol_strlen(abs(ceil($max))); @@ -597,14 +626,15 @@ function GetCeilMaxValue() return $res; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return min value of all data * * @return double Max value of all data */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetFloorMinValue() { + // phpcs:enable $min = $this->GetMinValueInData(); if ($min == '') $min=0; if ($min != 0) $min--; @@ -659,7 +689,7 @@ function draw($file, $fileurl='') * @param string $fileurl Url path to show image if saved onto disk * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_artichow($file,$fileurl) { global $artichow_defaultfont; @@ -832,6 +862,7 @@ private function draw_artichow($file,$fileurl) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build a graph using JFlot library. Input when calling this method should be: * $this->data = array(array(0=>'labelxA',1=>yA), array('labelxB',yB)); @@ -848,9 +879,9 @@ private function draw_artichow($file,$fileurl) * @param string $fileurl Url path to show image if saved onto disk. Never used here. * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_jflot($file,$fileurl) { + // phpcs:enable global $artichow_defaultfont; dol_syslog(get_class($this)."::draw_jflot this->type=".join(',',$this->type)." this->MaxValue=".$this->MaxValue); diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index a00da884aba5c..36881b76f843d 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -105,25 +105,25 @@ class dolReceiptPrinter extends Escpos const CONNECTOR_NETWORK_PRINT = 3; const CONNECTOR_WINDOWS_PRINT = 4; //const CONNECTOR_JAVA = 5; - + /** * @var DoliDB Database handler. */ public $db; - + var $tags; var $printer; var $template; - + /** - * @var string Error code (or message) - */ - public $error=''; - + * @var string Error code (or message) + */ + public $error=''; + /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + * @var string[] Error codes (or messages) + */ + public $errors = array(); @@ -350,6 +350,7 @@ function selectProfilePrinter($selected='', $htmlname='printerprofileid') } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Add a printer in db * @@ -359,9 +360,9 @@ function selectProfilePrinter($selected='', $htmlname='printerprofileid') * @param string $parameter Printer parameter * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function AddPrinter($name, $type, $profile, $parameter) { + // phpcs:enable global $conf; $error = 0; $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'printer_receipt'; @@ -375,6 +376,7 @@ function AddPrinter($name, $type, $profile, $parameter) return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer in db * @@ -385,9 +387,9 @@ function AddPrinter($name, $type, $profile, $parameter) * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdatePrinter($name, $type, $profile, $parameter, $printerid) { + // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt'; @@ -404,15 +406,16 @@ function UpdatePrinter($name, $type, $profile, $parameter, $printerid) return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Delete a printer from db * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DeletePrinter($printerid) { + // phpcs:enable global $conf; $error = 0; $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'printer_receipt'; @@ -425,6 +428,7 @@ function DeletePrinter($printerid) return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer template in db * @@ -433,9 +437,9 @@ function DeletePrinter($printerid) * @param int $templateid Template id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function UpdateTemplate($name, $template, $templateid) { + // phpcs:enable global $conf; $error = 0; $sql = 'UPDATE '.MAIN_DB_PREFIX.'printer_receipt_template'; @@ -451,15 +455,16 @@ function UpdateTemplate($name, $template, $templateid) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Send Test page to Printer * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendTestToPrinter($printerid) { + // phpcs:enable global $conf; $error = 0; $img = new EscposImage(DOL_DOCUMENT_ROOT .'/theme/common/dolibarr_logo_bw.png'); @@ -486,6 +491,7 @@ function SendTestToPrinter($printerid) return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Print Receipt Ticket * @@ -494,9 +500,9 @@ function SendTestToPrinter($printerid) * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function SendToPrinter($object, $templateid, $printerid) { + // phpcs:enable global $conf; $error = 0; $ret = $this->loadTemplate($templateid); @@ -650,15 +656,16 @@ function loadTemplate($templateid) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function Init Printer * * @param int $printerid Printer id * @return int 0 if OK; >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function InitPrinter($printerid) { + // phpcs:enable global $conf; $error=0; $sql = 'SELECT rowid, name, fk_type, fk_profile, parameter'; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 64e33cd50232f..5ffaf0463a6bf 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -39,7 +39,7 @@ class FormAccounting extends Form * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -55,6 +55,7 @@ public function __construct($db) $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of journals with label by nature * @@ -69,9 +70,9 @@ public function __construct($db) * @param int $disabledajaxcombo Disable ajax combo box. * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0) { + // phpcs:enable global $conf,$langs; $out = ''; @@ -137,6 +138,7 @@ function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of accounting category. * Use mysoc->country_id or mysoc->country_code so they must be defined. @@ -149,9 +151,9 @@ function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty * @param int $allcountries All countries * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_accounting_category($selected='',$htmlname='account_category', $useempty=0, $maxlen=0, $help=1, $allcountries=0) { + // phpcs:enable global $db,$langs,$user,$mysoc; if (empty($mysoc->country_id) && empty($mysoc->country_code) && empty($allcountries)) @@ -218,6 +220,7 @@ function select_accounting_category($selected='',$htmlname='account_category', $ print $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select filter with date of transaction * @@ -225,9 +228,9 @@ function select_accounting_category($selected='',$htmlname='account_category', $ * @param string $selectedkey Value * @return string HTML edit field */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '') { + // phpcs:enable $options = array(); $sql = 'SELECT DISTINCT import_key from ' . MAIN_DB_PREFIX . 'accounting_bookkeeping'; @@ -250,6 +253,7 @@ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '' return Form::selectarray($htmlname, $options, $selectedkey); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of accounts with label by chart of accounts * @@ -263,9 +267,9 @@ function select_bookkeeping_importkey($htmlname = 'importkey', $selectedkey = '' * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') { + // phpcs:enable global $conf, $langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -342,6 +346,7 @@ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of auxilary thirdparty accounts * @@ -351,9 +356,9 @@ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event * @param string $morecss More css * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') { + // phpcs:enable $aux_account = array(); @@ -403,6 +408,7 @@ function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of years existing into book keepping * @@ -412,9 +418,9 @@ function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, * @param string $output_format (html/opton (for option html only)/array (to return options arrays * @return string/array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function selectyear_accountancy_bookkepping($selected = '', $htmlname = 'yearid', $useempty = 0, $output_format = 'html') { + // phpcs:enable global $conf; $out_array = array(); diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 7fc07ab46ed98..e01e1f2ad6574 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -33,7 +33,7 @@ class FormActions * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -52,6 +52,7 @@ function __construct($db) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show list of action status * @@ -64,9 +65,9 @@ function __construct($db) * @param string $morecss More css on select field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_select_status_action($formname, $selected, $canedit=1, $htmlname='complete', $showempty=0, $onlyselect=0, $morecss='maxwidth100') { + // phpcs:enable global $langs,$conf; $listofstatus = array( @@ -314,6 +315,7 @@ function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecs } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html select list of type of event * @@ -326,9 +328,9 @@ function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecs * @param int $nooutput 1=No output * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_actions($selected='', $htmlname='actioncode', $excludetype='', $onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0) { + // phpcs:enable global $langs,$user,$form,$conf; if (! is_object($form)) $form=new Form($db); diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index fd9bc3ab3f998..22fa73741ce55 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -29,15 +29,8 @@ */ class FormAdmin { - /** - * @var DoliDB Database handler. - */ - public $db; - - /** - * @var string Error code (or message) - */ - public $error=''; + var $db; + var $error; /** @@ -51,6 +44,7 @@ function __construct($db) return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return html select list with available languages (key='en_US', value='United States' for example) * @@ -66,9 +60,9 @@ function __construct($db) * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @return string Return HTML select string with list of languages */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter=null, $showempty='', $showwarning=0, $disabled=0, $morecss='', $showcode=0, $forcecombo=0) { + // phpcs:enable global $langs; $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT,12); @@ -127,6 +121,7 @@ function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of available menus (eldy_backoffice, ...) * @@ -136,9 +131,9 @@ function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter * @param string $moreattrib More attributes on html select tag * @return integer|null */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') { + // phpcs:enable global $langs,$conf; // Clean parameters @@ -217,6 +212,7 @@ function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') print ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list of available menu families * @@ -225,9 +221,9 @@ function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') * @param string[] $dirmenuarray Directories to scan * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_menu_families($selected, $htmlname, $dirmenuarray) { + // phpcs:enable global $langs,$conf; //$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set @@ -289,6 +285,7 @@ function select_menu_families($selected, $htmlname, $dirmenuarray) } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of timezones * @@ -296,9 +293,9 @@ function select_menu_families($selected, $htmlname, $dirmenuarray) * @param string $htmlname Nom de la zone select * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_timezone($selected,$htmlname) { + // phpcs:enable global $langs,$conf; print ''; if ($showempty) $return.=''; @@ -312,6 +317,7 @@ function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5 return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list for categories (to use in form search selectors) * @@ -324,9 +330,9 @@ function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5 * @return string Html combo list code * @see select_all_categories */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_categories($type, $selected=0, $htmlname='search_categ', $nocateg=0, $showempty=1, $morecss='') { + // phpcs:enable global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -373,6 +379,7 @@ function select_categories($type, $selected=0, $htmlname='search_categ', $nocate } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list for categories (to use in form search selectors) * @@ -384,9 +391,9 @@ function select_categories($type, $selected=0, $htmlname='search_categ', $nocate * @param string $morecss More CSS * @return string Html combo list code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_salesrepresentatives($selected,$htmlname,$user,$showstatus=0,$showempty=1,$morecss='') { + // phpcs:enable global $conf,$langs; $langs->load('users'); @@ -628,6 +635,7 @@ static function showColor($color, $textifnotdefined='') else print $textifnotdefined; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a HTML code to select a color * @@ -640,9 +648,9 @@ static function showColor($color, $textifnotdefined='') * @deprecated Use instead selectColor * @see selectColor() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_color($set_color='', $prefix='f_color', $form_name='', $showcolorbox=1, $arrayofcolors='') { + // phpcs:enable print $this->selectColor($set_color, $prefix, $form_name, $showcolorbox, $arrayofcolors); } @@ -746,6 +754,7 @@ static function selectColor($set_color='', $prefix='f_color', $form_name='', $sh return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Creation d'un icone de couleur * @@ -756,9 +765,9 @@ static function selectColor($set_color='', $prefix='f_color', $form_name='', $sh * @param int $y Hauteur de l'image en pixels * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function CreateColorIcon($color,$module,$name,$x='12',$y='12') { + // phpcs:enable global $conf; $file = $conf->$module->dir_temp.'/'.$name.'.png'; @@ -786,6 +795,7 @@ function CreateColorIcon($color,$module,$name,$x='12',$y='12') ImageDestroy($image); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of week * @@ -794,18 +804,20 @@ function CreateColorIcon($color,$module,$name,$x='12',$y='12') * @param int $useempty Affiche valeur vide dans liste * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dayofweek($selected='',$htmlname='weekid',$useempty=0) { + // phpcs:enable global $langs; - $week = array( 0=>$langs->trans("Day0"), - 1=>$langs->trans("Day1"), - 2=>$langs->trans("Day2"), - 3=>$langs->trans("Day3"), - 4=>$langs->trans("Day4"), - 5=>$langs->trans("Day5"), - 6=>$langs->trans("Day6")); + $week = array( + 0=>$langs->trans("Day0"), + 1=>$langs->trans("Day1"), + 2=>$langs->trans("Day2"), + 3=>$langs->trans("Day3"), + 4=>$langs->trans("Day4"), + 5=>$langs->trans("Day5"), + 6=>$langs->trans("Day6") + ); $select_week = '