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/49] 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 d59ccc63d1c..e8437e66498 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -232,9 +232,10 @@ class Propal extends CommonObject } + // 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 @@ class Propal extends CommonObject * 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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1172,6 +1174,7 @@ class Propal extends CommonObject } + // 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 @@ class Propal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { + // phpcs:enable // i love this function because $this->products is not used in create function... $this->products=$this->lines; @@ -1564,15 +1567,16 @@ class Propal extends CommonObject } + // 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 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define proposal date * @@ -1811,9 +1816,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define end validity date * @@ -1879,9 +1885,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1940,9 +1947,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery * @@ -2001,9 +2009,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set source of demand * @@ -2071,9 +2080,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer reference number * @@ -2143,9 +2153,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -2207,9 +2218,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -2273,9 +2285,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2557,9 +2570,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of proposal (eventually filtered on user) into an array * @@ -2621,9 +2635,9 @@ class Propal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') { + // phpcs:enable global $user; $ga = array(); @@ -2695,15 +2709,16 @@ class Propal extends CommonObject 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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change source demand * @@ -2982,9 +2998,9 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject return $this->LibStatut($this->statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status (draft, validated, ...) * @@ -3122,9 +3139,9 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { + // phpcs:enable global $conf; // Init/load array of translation of status @@ -3158,9 +3175,10 @@ class Propal extends CommonObject 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 @@ class Propal extends CommonObject * @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 @@ class Propal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $this->nb=array(); @@ -4223,15 +4242,16 @@ class PropaleLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update DB line fields total_xxx * Used by migration * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index c7601cf9c1d..ee62ee5680c 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -236,6 +236,7 @@ class Contrat extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -246,9 +247,9 @@ class Contrat extends CommonObject * @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 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -268,9 +270,9 @@ class Contrat extends CommonObject * @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 @@ class Contrat extends CommonObject } } + // 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 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update statut of contract according to services * @@ -1787,9 +1791,9 @@ class Contrat extends CommonObject * @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 @@ class Contrat extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi label of a given contrat status * @@ -1826,9 +1831,9 @@ class Contrat extends CommonObject * @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 @@ class Contrat extends CommonObject } } + // 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 @@ class Contrat extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2085,9 +2092,9 @@ class Contrat extends CommonObject * @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 @@ class Contrat extends CommonObject } } + // 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 @@ class ContratLigne extends CommonObjectLine 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 @@ class ContratLigne extends CommonObjectLine * @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 @@ class ContratLigne extends CommonObjectLine } + // 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 @@ class ContratLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate a contract line * @@ -3129,9 +3140,9 @@ class ContratLigne extends CommonObjectLine * @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 @@ class ContratLigne extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close a contract line * @@ -3187,9 +3199,9 @@ class ContratLigne extends CommonObjectLine * @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 02fd4a95643..7c9396c70e8 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -368,6 +368,7 @@ class Cronjob extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -380,10 +381,10 @@ class Cronjob extends CommonObject * @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 @@ class Cronjob extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Run a job. * Once job is finished, status and nb of run is updated. @@ -928,9 +930,9 @@ class Cronjob extends CommonObject * @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 @@ class Cronjob extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Reprogram a job * @@ -1198,9 +1201,9 @@ class Cronjob extends CommonObject * @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 @@ class Cronjob extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1286,10 +1290,10 @@ class Cronjob extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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 8a46f14c829..e40faafeefd 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 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a expedition line * @@ -389,9 +390,9 @@ class Expedition extends CommonObject * @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 @@ class Expedition extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create the detail (eat-by date) of the expedition line * @@ -414,9 +416,9 @@ class Expedition extends CommonObject * @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 @@ class Expedition extends CommonObject $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 @@ class Expedition extends CommonObject } + // 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 @@ class Expedition extends CommonObject $this->lines[$num] = $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a shipment line with batch record * @@ -922,9 +926,9 @@ class Expedition extends CommonObject * @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 @@ class Expedition extends CommonObject } } + // 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 @@ class Expedition extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1597,9 +1603,9 @@ class Expedition extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; if ($mode==0) @@ -1713,6 +1719,7 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -1720,9 +1727,9 @@ class Expedition extends CommonObject * @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 @@ class Expedition extends CommonObject } } + // 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 @@ class Expedition extends CommonObject } } + // 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 @@ class Expedition extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update/create delivery method. * @@ -1817,9 +1827,9 @@ class Expedition extends CommonObject * * @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 @@ class Expedition extends CommonObject if ($resql < 0) dol_print_error($this->db,''); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Activate delivery method. * @@ -1846,15 +1857,16 @@ class Expedition extends CommonObject * * @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 @@ class Expedition extends CommonObject * * @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 @@ class Expedition extends CommonObject } + // 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 @@ class Expedition extends CommonObject } } + // 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 0dceeae4808..fa581161494 100644 --- a/htdocs/expensereport/class/paymentexpensereport.class.php +++ b/htdocs/expensereport/class/paymentexpensereport.class.php @@ -450,16 +450,17 @@ class PaymentExpenseReport extends CommonObject 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 @@ class PaymentExpenseReport extends CommonObject } + // 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 672ad334422..52815c1303d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1068,7 +1068,7 @@ else 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 4eee6ffe502..22b5e4656a7 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -167,6 +167,7 @@ class FormProduct } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return full path to current warehouse in $tab (recursive function) * @@ -174,10 +175,9 @@ class FormProduct * @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 @@ class FormProduct } } + // 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 @@ class FormProduct * @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 @@ class FormProduct * @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 cdacd56e432..4f81927dca0 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -692,19 +692,20 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert a track that we changed a customer price * @@ -1453,9 +1455,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a price line * @@ -1492,9 +1495,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // 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 @@ class Product extends CommonObject } + // 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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande client pour le produit/service * @@ -2312,9 +2319,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats commande fournisseur pour le produit/service * @@ -2409,9 +2417,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats expedition client pour le produit/service * @@ -2453,9 +2462,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge tableau des stats réception fournisseur pour le produit/service * @@ -2501,9 +2511,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an array formated for showing graphs * @@ -2674,9 +2688,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or customers invoices in which product is included * @@ -2741,9 +2756,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of units or supplier invoices in which product is included * @@ -2778,9 +2794,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify composed product * @@ -3012,9 +3034,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retire le lien entre un sousproduit et un produit/service * @@ -3044,9 +3067,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // 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 @@ class Product extends CommonObject return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Recopie les prix d'un produit/service sur un autre * @@ -3250,9 +3277,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Clone links between products * @@ -3279,9 +3307,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3768,9 +3801,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product * @@ -3869,9 +3903,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adjust stock in a warehouse for product with batch number * @@ -3918,9 +3953,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } } + // 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Move an uploaded file described into $file array into target directory $sdir. * @@ -4138,9 +4176,9 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne tableau de toutes les photos du produit * @@ -4217,9 +4257,9 @@ class Product extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; @@ -4266,15 +4306,16 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load size of image file * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { + // phpcs:enable $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 @@ class Product extends CommonObject 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 @@ class Product extends CommonObject * @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 @@ class Product extends CommonObject } - /** + // 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 16ff44e563c..fc36c64a3eb 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -73,7 +73,7 @@ class Productbatch extends CommonObject $error=0; // Clean parameters - $this->clean_param(); + $this->cleanParam(); // Check parameters // Put here code to add control on parameters values @@ -204,7 +204,7 @@ class Productbatch extends CommonObject $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 @@ class Productbatch extends CommonObject * * @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 19fa3e3e627..ae5cbd0e580 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 @@ class Inventory extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -346,9 +347,9 @@ class Inventory extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 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 651ee59c22e..e0c15d03520 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 @@ class ProductStockEntrepot extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -518,9 +519,9 @@ class ProductStockEntrepot extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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 c29adf0861f..c725d668763 100644 --- a/test/phpunit/CoreTest.php +++ b/test/phpunit/CoreTest.php @@ -250,6 +250,7 @@ class CoreTest extends PHPUnit_Framework_TestCase // 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 @@ class CoreTest extends PHPUnit_Framework_TestCase * @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/49] 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 3d1445b0cce..123b7f6157d 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -64,7 +64,7 @@ class autoTranslator // Translate //ini_set('default_charset','UTF-8'); ini_set('default_charset',$this->_outputpagecode); - $this->parse_refLangTranslationFiles(); + $this->parseRefLangTranslationFiles(); } /** @@ -72,8 +72,7 @@ class autoTranslator * * @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 6ad7ce68ba7..ef6e2d2c5e4 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 @@ class ActionComm extends CommonObject } } + // 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 @@ class ActionComm extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1024,10 +1026,10 @@ class ActionComm extends CommonObject * @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 @@ class ActionComm extends CommonObject return $this->LibStatut($this->percentage,$mode,$hidenastatus,$this->datep); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of action status * @@ -1151,9 +1154,9 @@ class ActionComm extends CommonObject * @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 @@ class ActionComm extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Export events from database into a cal file. * @@ -1361,9 +1365,9 @@ class ActionComm extends CommonObject * @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 ca1a97c5406..afee2690e77 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 @@ class ActionCommReminder extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -175,9 +176,9 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4c2cd368aac..011846ba08e 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -429,6 +429,7 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -436,9 +437,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // 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 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array * $this->client must be loaded @@ -1490,9 +1493,9 @@ class Commande extends CommonOrder * 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 @@ class Commande extends CommonOrder } + // 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 @@ class Commande extends CommonOrder } + // 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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns a array with expeditions lines number * @@ -2026,9 +2032,9 @@ class Commande extends CommonOrder * * 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 @@ class Commande extends CommonOrder 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 @@ class Commande extends CommonOrder * * 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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise relative * @@ -2170,9 +2178,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Applique une remise absolue * @@ -2237,9 +2246,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the order date * @@ -2304,9 +2314,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the planned delivery date * @@ -2369,9 +2380,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of orders (eventuelly filtered on a user) into an array * @@ -2439,9 +2451,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update order demand_reason * @@ -2577,9 +2590,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -2649,9 +2663,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // 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 @@ class Commande extends CommonOrder return $this->LibStatut($this->statut, $this->billed, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -3349,9 +3365,9 @@ class Commande extends CommonOrder * @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 @@ class Commande extends CommonOrder } + // 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 @@ class OrderLine extends CommonOrderLine } } + // 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 0419e2cfc68..bbe7fc7d071 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 @@ class Form return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list of activated countries, into language of user * @@ -666,9 +667,9 @@ class Form * @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 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of incoterms * @@ -762,9 +764,9 @@ class Form * @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 @@ class Form 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 @@ class Form * @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 @@ class Form } } + // 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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes * @@ -955,9 +960,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML code to select a company. * @@ -998,12 +1004,13 @@ class Form * @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 @@ class Form * @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 @@ class Form 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 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of absolute discounts * @@ -1258,9 +1267,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of all contacts (for a third party or all) * @@ -1344,9 +1354,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of users * @@ -1499,12 +1510,13 @@ class Form * @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 @@ class Form * @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 @@ class Form } + // 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 @@ class Form * @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 @@ class Form } + // 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 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of products for a customer * @@ -1968,9 +1983,9 @@ class Form * '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 @@ class Form $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 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers products * @@ -2489,9 +2506,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of suppliers prices for a product * @@ -2712,9 +2730,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of delivery address * @@ -2825,10 +2844,10 @@ class Form * @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 @@ class Form } + // 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 @@ class Form } } + // 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 @@ class Form 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 @@ class Form } + // 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 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of payment methods * @@ -3196,9 +3220,9 @@ class Form * @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 @@ class Form return $return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of bank accounts * @@ -3470,9 +3495,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of categories having choosed type * @@ -3574,9 +3600,9 @@ class Form * @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 @@ class Form return $output; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a confirmation HTML form or AJAX popup * @@ -3664,9 +3691,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a project * @@ -3973,9 +4001,9 @@ class Form * @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 @@ class Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select payment conditions * @@ -4028,9 +4057,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form to select a delivery delay * @@ -4062,9 +4092,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a form + html select a date * @@ -4140,9 +4171,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select form to choose a user * @@ -4180,9 +4212,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with payment mode * @@ -4219,9 +4252,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency code * @@ -4252,9 +4286,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form with multicurrency rate * @@ -4281,9 +4316,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a select box with available absolute discounts * @@ -4329,9 +4365,9 @@ class Form * @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 @@ class Form } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show forms to select a contact * @@ -4419,9 +4456,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html select to select thirdparty * @@ -4468,9 +4506,9 @@ class Form * @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 @@ class Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste des devises, dans la langue de l'utilisateur * @@ -4505,9 +4544,9 @@ class Form * @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 @@ class Form 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 @@ class Form } } + // 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 @@ class Form * @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 @@ class Form } + // 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 @@ class Form * @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 @@ class Form return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to show a form to select a duration on a page * @@ -5254,9 +5297,9 @@ class Form * @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 @@ class Form + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of export templates * @@ -6449,10 +6493,9 @@ class Form * @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 @@ class Form return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select list of groups * @@ -6830,9 +6874,9 @@ class Form * @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 80341e8df0c..a8774244e00 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 @@ class LoanSchedule extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Calculate mensuality * @@ -380,9 +381,9 @@ class LoanSchedule extends CommonObject * @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 @@ class LoanSchedule extends CommonObject * * @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 1cb4f1c4b65..578127fc248 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -230,6 +230,7 @@ class Address } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base toutes les adresses d'une societe * @@ -237,9 +238,9 @@ class Address * @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 @@ class Address } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge depuis la base l'objet adresse * @@ -331,9 +333,9 @@ class Address * @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 9c24aecae85..400dc65b0c2 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -47,14 +47,15 @@ class Client extends Societe $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/49] 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 91cc87e6952..282ac93c72a 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -260,6 +260,7 @@ class AccountingJournal extends CommonObject return $this->LibType($this->nature,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return type of an accounting journal * @@ -267,9 +268,9 @@ class AccountingJournal extends CommonObject * @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 32ebc4fb26e..6ddb4dae1b3 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -271,15 +271,16 @@ class DolibarrApi 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 14d1fb20f4e..c862b8392fd 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -254,15 +254,16 @@ class AdvanceTargetingMailing extends CommonObject } } + // 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 @@ class AdvanceTargetingMailing extends CommonObject + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -327,9 +329,9 @@ class AdvanceTargetingMailing extends CommonObject * @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 @@ class AdvanceTargetingMailing extends CommonObject + // 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 @@ class AdvanceTargetingMailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from database * @@ -707,9 +711,9 @@ class AdvanceTargetingMailing extends CommonObject * @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 095defe986a..6e3cfe499a8 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 @@ class RejetPrelevement } } + // 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 3d3e195b7c9..a0d33d4c28a 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -65,6 +65,7 @@ class Import } + // 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 @@ class Import * @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 @@ class Import + // 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 @@ class Import * @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 62a9a798617..f0c01594191 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -467,14 +467,15 @@ class Opensurveysondage extends CommonObject 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 @@ class Opensurveysondage extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of status * @@ -630,9 +632,9 @@ class Opensurveysondage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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 bb3782be0bb..589321eacb0 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -304,6 +304,7 @@ class Productcustomerprice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all customer prices in memory from database * @@ -314,9 +315,9 @@ class Productcustomerprice extends CommonObject * @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 @@ class Productcustomerprice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects in memory from database * @@ -428,9 +430,9 @@ class Productcustomerprice extends CommonObject * @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 8fa05f5c453..a0aee6fb2b5 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 @@ class Entrepot extends CommonObject } + // 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 @@ class Entrepot extends CommonObject 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 @@ class Entrepot extends CommonObject 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 @@ class Entrepot extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -532,9 +536,9 @@ class Entrepot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('stocks'); @@ -652,14 +656,15 @@ class Entrepot extends CommonObject $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 @@ class Entrepot extends CommonObject 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 @@ class Entrepot extends CommonObject * @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 7cac0419772..b221f0fa4f3 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1176,6 +1176,7 @@ class User extends CommonObject } + // 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 @@ class User extends CommonObject * @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 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user into database from a member object * @@ -1261,9 +1263,9 @@ class User extends CommonObject * @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 @@ class User extends CommonObject } } + // 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 @@ class User extends CommonObject } } + // 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 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send new password by email * @@ -1837,9 +1842,9 @@ class User extends CommonObject * @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 @@ class User extends CommonObject } + // 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 @@ class User extends CommonObject } } + // 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 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add user into a group * @@ -2029,9 +2037,9 @@ class User extends CommonObject * @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 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a user from a group * @@ -2090,9 +2099,9 @@ class User extends CommonObject * @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 @@ class User extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2362,9 +2372,9 @@ class User extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('users'); @@ -2402,6 +2412,7 @@ class User extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2411,9 +2422,9 @@ class User extends CommonObject * 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 @@ class User extends CommonObject 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 @@ class User extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update user using data from the LDAP * @@ -2699,9 +2712,9 @@ class User extends CommonObject * * @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 @@ class User extends CommonObject } + // 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 @@ class User extends CommonObject * * @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 @@ class User extends CommonObject $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 @@ class User extends CommonObject } } + // 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 @@ class User extends CommonObject * @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 @@ class User extends CommonObject $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 @@ class User extends CommonObject 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 @@ class User extends CommonObject * @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 @@ class User extends CommonObject } + // 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 @@ class User extends CommonObject 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 @@ class User extends CommonObject * @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/49] 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 4d8675bc8ee..d3c2070d321 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -27,7 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/xcal.lib.php'; /** - * 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 @@ class ICal 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 @@ class ICal return $this->cal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add to $this->ical array one value and key. * @@ -205,9 +209,9 @@ class ICal * @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 @@ class ICal $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 @@ class ICal $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 @@ class ICal } 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 @@ class ICal return $ntime; // ntime is a GTM time } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return unix date from iCal date format * @@ -329,10 +338,10 @@ class ICal * @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 @@ class ICal 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 @@ class ICal } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Compare two unix timestamp * @@ -379,64 +390,69 @@ class ICal * @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 0fdd3333549..45998a78869 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -827,15 +827,16 @@ class CMailFile 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 @@ class CMailFile } + // 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 @@ class CMailFile * * @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 @@ class CMailFile } + // 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 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create header MIME (mode = 'mail') * @@ -1017,9 +1021,9 @@ class CMailFile * @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 @@ class CMailFile 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 @@ class CMailFile return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attach file to email (mode = 'mail') * @@ -1149,9 +1155,9 @@ class CMailFile * @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 @@ class CMailFile } + // 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 @@ class CMailFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Try to create a socket connection * @@ -1228,9 +1236,9 @@ class CMailFile * @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 @@ class CMailFile 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 @@ class CMailFile * @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 e1a50c63083..d18501d54d9 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 @@ class AntiVir $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 @@ class AntiVir * @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 c65b2ba6fe1..a4665701661 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 @@ class 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 @@ class 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 @@ class Canvas 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 @@ class Canvas * @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 6393d201188..349cea676f1 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 @@ class EcmDirectory // extends CommonObject 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 @@ class EcmDirectory // extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -567,14 +569,15 @@ class EcmDirectory // extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 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 @@ class EcmDirectory // extends CommonObject * @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 @@ class EcmDirectory // extends CommonObject 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 @@ class EcmDirectory // extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=0) { + // phpcs:enable // Define fullpath if (! empty($this->cats[$id_categ]['id_mere'])) { @@ -761,6 +765,7 @@ class EcmDirectory // extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Call trigger based on this instance * @@ -772,9 +777,9 @@ class EcmDirectory // extends CommonObject * @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 95d4b42a4b6..38d155f3328 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 @@ class EcmFiles extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -786,9 +787,9 @@ class EcmFiles extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 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 4f3b666049b..7ff2e2de6f9 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 @@ class CompanyPaymentMode extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -459,43 +460,37 @@ class CompanyPaymentMode extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5c15f82952f..2cd3ba2f6d8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -571,15 +571,16 @@ class Societe extends CommonObject } + // 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1510,9 +1513,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Definit la societe comme un client * @@ -1572,9 +1576,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a discount for third party * @@ -1636,9 +1641,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the price level * @@ -1778,9 +1784,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1816,14 +1823,12 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add link to sales representative * @@ -1855,9 +1861,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2076,9 +2083,9 @@ class Societe extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string 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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject return $contact_phone; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of contacts emails or mobile existing for third party * @@ -2168,9 +2178,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } + // 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject return $contacts; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return property of contact from its id * @@ -2306,9 +2319,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } + // 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject } + // 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 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check customer code * @@ -2545,9 +2565,9 @@ class Societe extends CommonObject * -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 @@ class Societe extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check supplier code * @@ -2581,9 +2602,9 @@ class Societe extends CommonObject * -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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Verify if a profid exists into database for others thirds * @@ -2734,9 +2759,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject return $ok; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return an url to check online a professional id or empty string * @@ -2943,9 +2970,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a third party into database from a member object * @@ -3150,9 +3181,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject 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 @@ class Societe extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set prospect level * @@ -3447,9 +3480,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject return $this->LibProspCommStatut($this->stcomm_id, $mode, $label); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -3473,9 +3507,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject return "Error, mode/status not found"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set outstanding value * @@ -3526,9 +3561,9 @@ class Societe extends CommonObject * @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 @@ class Societe extends CommonObject } } + // 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 @@ class Societe extends CommonObject 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 e6aabf68f6d..61e7303a35b 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 @@ class SocieteAccount extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -402,9 +403,9 @@ class SocieteAccount extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) 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/49] 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 036aa8dc0ba..f94fa4b8a12 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -338,6 +338,7 @@ class Asset extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -345,43 +346,37 @@ class Asset extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) - { - $prefix=''; - if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); - } - if ($mode == 1) + if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); if ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index e6b95d7ad37..7aa9beda627 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -33,12 +33,12 @@ class AssetType extends CommonObject * @var string Name of table without prefix where object is stored */ public $table_element = 'asset_type'; - + /** * @var string ID to identify managed object */ public $element = 'asset_type'; - + public $picto = 'group'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe @@ -282,14 +282,15 @@ class AssetType extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of asset's type * * @return array List of types of members */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array() { + // phpcs:enable global $conf,$langs; $assettypes = array(); diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 433b05aceeb..32910c3ed8a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -640,6 +640,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Link an object to the category * @@ -647,9 +648,9 @@ class Categorie extends CommonObject * @param string $type Type of category ('product', ...) * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_type($obj, $type) { + // phpcs:enable global $user,$langs,$conf; $error=0; @@ -742,6 +743,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object from category * @@ -750,9 +752,9 @@ class Categorie extends CommonObject * * @return int 1 if OK, -1 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function del_type($obj,$type) { + // phpcs:enable global $user,$langs,$conf; $error=0; @@ -966,14 +968,15 @@ class Categorie extends CommonObject return $categories; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return childs of a category * * @return array|int <0 KO, array ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_filles() { + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql.= " WHERE fk_parent = ".$this->id; @@ -996,14 +999,15 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Load this->motherof that is array(id_son=>id_parent, ...) * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function load_motherof() { + // phpcs:enable global $conf; $this->motherof=array(); @@ -1031,6 +1035,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Rebuilding the category tree as an array * Return an array of table('id','id_mere',...) trie selon arbre et avec: @@ -1046,9 +1051,9 @@ class Categorie extends CommonObject * * @return array Array of categories. this->cats and this->motherof are set. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_full_arbo($type, $markafterid=0) { + // phpcs:enable global $conf, $langs; if (! is_numeric($type)) $type = $this->MAP_ID[$type]; @@ -1123,6 +1128,7 @@ class Categorie extends CommonObject return $this->cats; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * For category id_categ and its childs available in this->cats, define property fullpath and fulllabel * @@ -1130,9 +1136,9 @@ class Categorie extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function build_path_from_id_categ($id_categ,$protection=1000) { + // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); if (! empty($this->cats[$id_categ]['fullpath'])) @@ -1166,14 +1172,15 @@ class Categorie extends CommonObject return; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display content of $this->cats * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function debug_cats() { + // phpcs:enable // Display $this->cats foreach($this->cats as $key => $val) { @@ -1188,6 +1195,7 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns all categories * @@ -1195,9 +1203,9 @@ class Categorie extends CommonObject * @param boolean $parent Just parent categories if true * @return array Table of Object Category */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_categories($type=null, $parent=false) { + // phpcs:enable if (! is_numeric($type)) $type = $this->MAP_ID[$type]; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; @@ -1226,14 +1234,15 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check if no category with same label already exists for this cat's parent or root and for this cat's type * * @return integer 1 if already exist, 0 otherwise, -1 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function already_exists() { + // phpcs:enable $type=$this->type; if (! is_numeric($type)) $type=$this->MAP_ID[$type]; @@ -1276,18 +1285,20 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the top level categories (which are not girls) * * @param int $type Type of category (0, 1, ...) * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_main_categories($type=null) { + // phpcs:enable return $this->get_all_categories($type, true); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the path of the category, with the names of the categories * separated by $sep (" >> " by default) @@ -1297,9 +1308,9 @@ class Categorie extends CommonObject * @param int $nocolor 0 * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_all_ways($sep = " >> ", $url='', $nocolor=0) { + // phpcs:enable $ways = array(); $allways = $this->get_all_ways(); // Load array of categories @@ -1346,14 +1357,15 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array containing the list of parent categories * * @return int|array <0 KO, array OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_meres() { + // phpcs:enable $parents = array(); $sql = "SELECT fk_parent FROM ".MAIN_DB_PREFIX."categorie"; @@ -1381,15 +1393,16 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns in a table all possible paths to get to the category * starting with the major categories represented by Tables of categories * * @return array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_all_ways() { + // phpcs:enable $ways = array(); $parents=$this->get_meres(); @@ -1596,6 +1609,7 @@ class Categorie extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Deplace fichier uploade sous le nom $files dans le repertoire sdir * @@ -1603,9 +1617,9 @@ class Categorie extends CommonObject * @param string $file Nom du fichier uploade * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_photo($sdir, $file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dir = $sdir .'/'. get_exdir($this->id,2,0,0,$this,'category') . $this->id ."/"; @@ -1646,6 +1660,7 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return tableau de toutes les photos de la categorie * @@ -1653,9 +1668,9 @@ class Categorie extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_photos($dir,$nbmax=0) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; $nbphoto=0; @@ -1702,15 +1717,16 @@ class Categorie extends CommonObject return $tabobj; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Efface la photo de la categorie et sa vignette * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_photo($file) { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine @@ -1731,15 +1747,16 @@ class Categorie extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load size of image file * * @param string $file Path to file * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_image_size($file) { + // phpcs:enable $infoImg = getimagesize($file); // Recuperation des infos de l'image $this->imgWidth = $infoImg[0]; // Largeur de l'image $this->imgHeight = $infoImg[1]; // Hauteur de l'image diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index fa7a9a1bc9e..26e2c7bec90 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -35,12 +35,12 @@ class Mailing extends CommonObject * @var string ID to identify managed object */ public $element='mailing'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='mailing'; - + public $picto='email'; var $titre; @@ -444,7 +444,7 @@ class Mailing extends CommonObject * * @return int 1 if OK, 0 if error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; @@ -470,7 +470,7 @@ class Mailing extends CommonObject * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; @@ -536,6 +536,7 @@ class Mailing extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -543,42 +544,38 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; $langs->load('mails'); - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans($this->statuts[$statut]); } - if ($mode == 1) - { - return $langs->trans($this->statuts[$statut]); - } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1'); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3'); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 0) return img_picto($langs->trans($this->statuts[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); if ($statut == 1) return img_picto($langs->trans($this->statuts[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); if ($statut == 2) return img_picto($langs->trans($this->statuts[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); if ($statut == 3) return img_picto($langs->trans($this->statuts[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut0'); if ($statut == 1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts[$statut]),'statut1'); @@ -606,39 +603,39 @@ class Mailing extends CommonObject { return $langs->trans('MailingStatusError'); } - if ($mode == 1) + elseif ($mode == 1) { return $langs->trans('MailingStatusSent'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); if ($statut==2) return $langs->trans("MailingStatusRead").' '.img_picto($langs->trans("MailingStatusRead"),'statut4'); if ($statut==3) return $langs->trans("MailingStatusNotContact").' '.img_picto($langs->trans("MailingStatusNotContact"),'statut3'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut==-1) return $langs->trans("MailingStatusError").' '.img_error($desc); if ($statut==1) return $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6'); diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index ba82e007086..76225ff8902 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -34,7 +34,7 @@ class MouvementStock extends CommonObject * @var string Id to identify managed objects */ public $element = 'stockmouvement'; - + /** * @var string Name of table without prefix where object is stored */ @@ -858,6 +858,7 @@ class MouvementStock extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return Url link of origin object * @@ -865,9 +866,9 @@ class MouvementStock extends CommonObject * @param int $origintype Type origin * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_origin($fk_origin, $origintype) { + // phpcs:enable $origin=''; switch ($origintype) { @@ -1012,38 +1013,35 @@ class MouvementStock extends CommonObject return $this->LibStatut($mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($mode=0) { + // phpcs:enable global $langs; - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $langs->trans('StatusNotApplicable'); } - if ($mode == 1) - { - return $langs->trans('StatusNotApplicable'); - } - if ($mode == 2) + elseif ($mode == 2) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 3) + elseif ($mode == 3) { return img_picto($langs->trans('StatusNotApplicable'),'statut9'); } - if ($mode == 4) + elseif ($mode == 4) { return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); } - if ($mode == 5) + elseif ($mode == 5) { return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); } diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0c501a1a09f..2cee8f7a2a1 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -39,7 +39,7 @@ class Productlot extends CommonObject * @var string Id to identify managed objects */ public $element = 'productlot'; - + /** * @var string Name of table without prefix where object is stored */ @@ -475,6 +475,7 @@ class Productlot extends CommonObject return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a given status * @@ -482,9 +483,9 @@ class Productlot extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; //$langs->load('stocks'); diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index a9b44339930..f690cdd8625 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -49,12 +49,12 @@ class SupplierProposal extends CommonObject * @var string ID to identify managed object */ public $element='supplier_proposal'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='supplier_proposal'; - + public $table_element_line='supplier_proposaldet'; public $fk_element='fk_supplier_proposal'; public $picto='propal'; @@ -203,9 +203,10 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add line into array products - * $this->client doit etre charge + * $this->client doit etre charge * * @param int $idproduct Product Id to add * @param int $qty Quantity @@ -215,9 +216,9 @@ class SupplierProposal extends CommonObject * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_product($idproduct, $qty, $remise_percent=0) { + // phpcs:enable global $conf, $mysoc; if (! $qty) $qty = 1; @@ -259,15 +260,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adding line of fixed discount in the proposal in DB * * @param int $idremise Id of fixed discount * @return int >0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function insert_discount($idremise) { + // phpcs:enable global $langs; include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; @@ -1074,6 +1076,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert into DB a supplier_proposal object completely defined by its data members (ex, results from copy). * @@ -1081,9 +1084,9 @@ class SupplierProposal extends CommonObject * @return int Id of the new object if ok, <0 if ko * @see create */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function create_from($user) { + // phpcs:enable $this->products=$this->lines; return $this->create($user); @@ -1504,6 +1507,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set delivery date * @@ -1511,9 +1515,9 @@ class SupplierProposal extends CommonObject * @param int $date_livraison Delivery date * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_date_livraison($user, $date_livraison) { + // phpcs:enable if (! empty($user->rights->supplier_proposal->creer)) { $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal "; @@ -1534,6 +1538,7 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an overall discount on the proposal * @@ -1541,9 +1546,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_percent($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1568,6 +1573,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set an absolute overall discount on the proposal * @@ -1575,9 +1581,9 @@ class SupplierProposal extends CommonObject * @param double $remise Amount discount * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_remise_absolue($user, $remise) { + // phpcs:enable $remise=trim($remise)?trim($remise):0; if (! empty($user->rights->supplier_proposal->creer)) @@ -1841,15 +1847,16 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Set draft status + * Set draft status * * @param User $user Object user that modify * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_draft($user) { + // phpcs:enable global $conf,$langs; $sql = "UPDATE ".MAIN_DB_PREFIX."supplier_proposal SET fk_statut = 0"; @@ -1868,6 +1875,7 @@ class SupplierProposal extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of askprice (eventually filtered on user) into an array * @@ -1881,9 +1889,9 @@ class SupplierProposal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datec', $sortorder='DESC') { + // phpcs:enable global $conf,$user; $ga = array(); @@ -2133,16 +2141,17 @@ class SupplierProposal extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return label of a status (draft, validated, ...) + * Return label of a status (draft, validated, ...) * - * @param int $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label + * @param int $statut id statut + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=1) { + // phpcs:enable // Init/load array of translation of status if (empty($this->labelstatut) || empty($this->labelstatut_short)) { @@ -2162,21 +2171,22 @@ class SupplierProposal extends CommonObject $statuttrans=''; if ($statut==0) $statuttrans='statut0'; - if ($statut==1) $statuttrans='statut1'; - if ($statut==2) $statuttrans='statut3'; - if ($statut==3) $statuttrans='statut5'; - if ($statut==4) $statuttrans='statut6'; + elseif ($statut==1) $statuttrans='statut1'; + elseif ($statut==2) $statuttrans='statut3'; + elseif ($statut==3) $statuttrans='statut5'; + elseif ($statut==4) $statuttrans='statut6'; if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); - if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 1) return $this->labelstatut_short[$statut]; + elseif ($mode == 2) return img_picto($this->labelstatut[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + elseif ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + elseif ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2184,9 +2194,9 @@ class SupplierProposal extends CommonObject * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user,$mode) { + // phpcs:enable global $conf, $user, $langs; $now=dol_now(); @@ -2338,14 +2348,15 @@ class SupplierProposal extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf, $user; $this->nb=array(); @@ -2658,7 +2669,7 @@ class SupplierProposalLine extends CommonObjectLine * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -2668,7 +2679,7 @@ class SupplierProposalLine extends CommonObjectLine * @var string ID to identify managed object */ public $element='supplier_proposaldet'; - + /** * @var string Name of table without prefix where object is stored */ @@ -2678,12 +2689,12 @@ class SupplierProposalLine extends CommonObjectLine // From llx_supplier_proposaldet var $rowid; // deprecated - + /** * @var int ID */ public $id; - + var $fk_supplier_proposal; var $fk_parent_line; var $desc; // Description ligne @@ -3185,15 +3196,16 @@ class SupplierProposalLine extends CommonObjectLine } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update DB line fields total_xxx * Used by migration * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base 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/49] 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 8d8281745fa..e453bd331c2 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 @@ class DolibarrApiAccess implements iAuthenticate 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 bba4e2ff001..4a1d2b047ab 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 @@ class Account extends CommonObject * @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 @@ class Account extends CommonObject * @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 @@ class Account extends CommonObject * @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 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { global $langs; @@ -1114,7 +1114,7 @@ class Account extends CommonObject * * @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 @@ class Account extends CommonObject * @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 @@ class Account extends CommonObject * @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 @@ class AccountLine extends CommonObject } + // 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 @@ class AccountLine extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update conciliation field * @@ -1962,9 +1964,9 @@ class AccountLine extends CommonObject * @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 @@ class AccountLine extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Increase/decrease value date of a rowid * @@ -2025,9 +2028,9 @@ class AccountLine extends CommonObject * @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 @@ class AccountLine extends CommonObject 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 @@ class AccountLine extends CommonObject * @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 @@ class AccountLine extends CommonObject 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 @@ class AccountLine extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -2255,9 +2264,9 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable global $langs; //$langs->load('companies'); /* diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 74df6c24ad6..df3507d4dca 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 @@ class PaymentVarious extends CommonObject } } + // 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 @@ class PaymentVarious extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -493,38 +495,38 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string 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 c78ca6707eb..2330e81d3a0 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 @@ class Deplacement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -307,38 +308,38 @@ class Deplacement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string 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 1fd2ad8bbef..3a2b3f900a1 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 @@ class Paiement extends CommonObject } + // 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 @@ class Paiement extends CommonObject } } + // 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 @@ class Paiement extends CommonObject 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 @@ class Paiement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1130,9 +1134,9 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage $langs->load('compta'); @@ -1174,15 +1178,16 @@ class Paiement extends CommonObject 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 7eba6afec29..dbb8932d7f5 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 @@ class BonPrelevement extends CommonObject $this->_fetched = 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add invoice to withdrawal * @@ -122,9 +123,9 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject } } + // 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 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set direct debit order to "credited" status. * @@ -413,9 +416,9 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set withdrawal to transmited status * @@ -561,9 +565,9 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject 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 @@ class BonPrelevement extends CommonObject } } + // 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 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a notification * @@ -1251,9 +1261,9 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write recipient of request (customer) * @@ -1483,9 +1494,9 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject 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 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject } + // 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 @@ class BonPrelevement extends CommonObject 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 @@ class BonPrelevement extends CommonObject * @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 @@ class BonPrelevement extends CommonObject 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 @@ class BonPrelevement extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -1902,9 +1918,9 @@ class BonPrelevement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable if (empty($this->labelstatut)) { global $langs; @@ -1914,39 +1930,35 @@ class BonPrelevement extends CommonObject $this->labelstatut[2]=$langs->trans("StatusCredited"); } - if ($mode == 0) + if ($mode == 0 || $mode == 1) { return $this->labelstatut[$statut]; } - if ($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 5aa11229452..7630800ad15 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -486,15 +486,16 @@ class PaymentSalary extends CommonObject } } + // 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 @@ class PaymentSalary extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -591,9 +593,9 @@ class PaymentSalary extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($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 bfa8c97a058..409ee99aaae 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -461,6 +461,7 @@ class Cchargesociales return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -468,9 +469,9 @@ class Cchargesociales * @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 bad851450a7..726eef6feff 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 @@ class ChargeSociales extends CommonObject } } + // 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 @@ class ChargeSociales extends CommonObject 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 @@ class ChargeSociales extends CommonObject return $this->LibStatut($this->paye,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -420,55 +424,50 @@ class ChargeSociales extends CommonObject * @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 ($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/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 4a989554b69..ca233eb43ea 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -600,15 +600,16 @@ class PaymentSocialContribution extends CommonObject } + // 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 @@ class PaymentSocialContribution extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -643,9 +645,9 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($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 5bc8105049e..c2512af70ef 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -192,15 +192,16 @@ class CSMSFile } + // 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 @@ class CSMSFile } } + // 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 @@ class CSMSFile * @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 a00f91ac5bc..ca493b98041 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -713,6 +713,7 @@ abstract class CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a link between element $this->element and a contact * @@ -722,9 +723,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } else return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Copy contact from one element to current * @@ -843,9 +845,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a link to contact line * @@ -867,9 +870,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to contact line * @@ -895,9 +899,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete all links between an object $this and all its contacts * @@ -933,9 +938,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get array of all contacts for an object * @@ -971,9 +977,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array with list of possible values for type of contacts * @@ -1080,9 +1087,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject 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 @@ abstract class CommonObject 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 @@ abstract class CommonObject 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 @@ abstract class CommonObject * * @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 @@ abstract class CommonObject 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 @@ abstract class CommonObject 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 @@ abstract class CommonObject 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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties id_previous and id_next by comparing $fieldid with $this->ref * @@ -1546,9 +1561,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject // 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 @@ abstract class CommonObject * @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 @@ abstract class CommonObject return $rows; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a lower rank * @@ -2300,9 +2317,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject $this->updateLineUp($rowid, $rang); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update a line to have a higher rank * @@ -2319,9 +2337,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // 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 @@ abstract class CommonObject } } + // 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 @@ abstract class CommonObject } } + // 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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update note of element * @@ -2558,9 +2580,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update public note (kept for backward compatibility) * @@ -2611,12 +2634,13 @@ abstract class CommonObject * @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 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add objects linked in llx_element_element. * @@ -2864,9 +2889,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } + // 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 @@ abstract class CommonObject } + // 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 @@ abstract class CommonObject * @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 @@ abstract class CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete a link to resource line * @@ -4278,9 +4306,9 @@ abstract class CommonObject * @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 @@ abstract class CommonObject /* 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 @@ abstract class CommonObject * @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 @@ abstract class CommonObject /* 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 @@ abstract class CommonObject * @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 @@ abstract class CommonObject { //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 @@ abstract class CommonObject return $buyPrice; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show photos of an object (nbmax maximum), into several columns * @@ -6479,9 +6510,9 @@ abstract class CommonObject * @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 b1bcbc65567..ba14c2828b6 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -333,15 +333,16 @@ class Loan extends CommonObject } } + // 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 @@ class Loan extends CommonObject return $this->LibStatut($this->paid,$mode,$alreadypaid); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label for given status * @@ -374,54 +376,49 @@ class Loan extends CommonObject * @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 32b4080187f..add1aef496d 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -478,15 +478,16 @@ class PaymentLoan extends CommonObject } + // 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 75fe5282bd1..b02f1710bb5 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -223,6 +223,7 @@ class Propalmergepdfproduct extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load object in memory from the database * @@ -230,9 +231,9 @@ class Propalmergepdfproduct extends CommonObject * @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 @@ class Propalmergepdfproduct extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete object in database * @@ -445,9 +447,9 @@ class Propalmergepdfproduct extends CommonObject * @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 @@ class Propalmergepdfproduct extends CommonObject } } + // 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 0d991ace9fe..8d7dfbb7ce4 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 @@ class PriceExpression } } + // 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 @@ class PriceExpression } + // 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 ca81e40beb6..69639677f73 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 @@ class PriceGlobalVariableUpdater return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update next_update into database * @@ -559,9 +560,9 @@ class PriceGlobalVariableUpdater * @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 @@ class PriceGlobalVariableUpdater } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update last_status into database * @@ -604,9 +606,9 @@ class PriceGlobalVariableUpdater * @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/49] 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 41764c38bd6..6c49b87185e 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -132,6 +132,7 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function sending an email has the adherent with the text supplied in parameter. * @@ -147,9 +148,9 @@ class Adherent extends CommonObject * @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 @@ class Adherent extends CommonObject } + // 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 @@ class Adherent extends CommonObject * @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 @@ class Adherent extends CommonObject } + // 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 @@ class Adherent extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Method to load member from its name * @@ -1030,9 +1034,9 @@ class Adherent extends CommonObject * @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 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction qui recupere pour un adherent les parametres * first_subscription_date @@ -1204,9 +1209,9 @@ class Adherent extends CommonObject * * @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 @@ class Adherent extends CommonObject } + // 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 @@ class Adherent extends CommonObject } + // 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 @@ class Adherent extends CommonObject 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 @@ class Adherent extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) { + // phpcs:enable global $langs; $langs->load("members"); if ($mode == 0) @@ -2013,7 +2021,7 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } 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 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -2117,15 +2126,16 @@ class Adherent extends CommonObject } } + // 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 @@ class Adherent extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -2269,9 +2280,9 @@ class Adherent extends CommonObject * 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 @@ class Adherent extends CommonObject } + // 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 b7d510a3e0f..9b24461c60d 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 @@ class AdherentType extends CommonObject } } + // 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 @@ class AdherentType extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -431,9 +433,9 @@ class AdherentType extends CommonObject * 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 @@ class AdherentType extends CommonObject } + // 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 90452816be8..6ad63a0f682 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 @@ class Subscription extends CommonObject 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 c4dae079c3c..859b9140f86 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -163,15 +163,16 @@ class Dolistore } } + // 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 @@ class Dolistore } } + // 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 @@ class Dolistore 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 @@ class Dolistore 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 @@ class Dolistore return $this->url."&".$param; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * version compare * @@ -370,9 +377,9 @@ class Dolistore * @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 18b284f9187..2c777d671fc 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -344,15 +344,16 @@ class Localtax extends CommonObject 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 @@ class Localtax extends CommonObject } } + // 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 @@ class Localtax extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * localtax payed * Total de la localtax payed @@ -431,9 +434,9 @@ class Localtax extends CommonObject * @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 @@ class Localtax extends CommonObject } } + // 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 @@ class Localtax extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -646,9 +651,9 @@ class Localtax extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($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 0240ff8a34c..0f4107bf3ad 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 @@ class Holiday extends CommonObject 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 @@ class Holiday extends CommonObject * @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 @@ class Holiday extends CommonObject 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 @@ class Holiday extends CommonObject 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 @@ class Holiday extends CommonObject 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 @@ class Holiday extends CommonObject 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 @@ class Holiday extends CommonObject } + // 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 60493b0b7f0..8ff5c2da52b 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 @@ class Establishment extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Give a label from a status * @@ -272,35 +273,35 @@ class Establishment extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // 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 c24d5a8214a..bcd9773c719 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 @@ class ActionsCardProduct } + // 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 @@ class ActionsCardProduct * @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 @@ class ActionsCardProduct } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -304,9 +306,9 @@ class ActionsCardProduct * @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 3d10988de85..2f0489b6f91 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 @@ class ActionsCardService } + // 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 @@ class ActionsCardService * @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 @@ class ActionsCardService } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -282,9 +284,9 @@ class ActionsCardService * @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/49] 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 4cd6fe81820..ecaeedad9f3 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 @@ class Contact extends CommonObject $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 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -484,9 +483,9 @@ class Contact extends CommonObject * 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 @@ class Contact extends CommonObject } + // 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 @@ class Contact extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update field alert birthday * @@ -578,9 +579,9 @@ class Contact extends CommonObject * @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 @@ class Contact extends CommonObject $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 @@ class Contact extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load number of elements the contact is used as a link for * ref_facturation @@ -861,9 +863,9 @@ class Contact extends CommonObject * * @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 @@ class Contact extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -1201,9 +1204,9 @@ class Contact extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode) { + // phpcs:enable global $langs; if ($mode == 0) @@ -1240,15 +1243,16 @@ class Contact extends CommonObject } + // 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 fd685ad74fd..46d21eba031 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -70,6 +70,7 @@ class Export } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load an exportable dataset * @@ -77,9 +78,9 @@ class Export * @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 @@ class Export } + // 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 @@ class Export * @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 @@ class Export return $sql; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build the conditionnal string from filter the query * @@ -279,9 +282,9 @@ class Export * @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 @@ class Export return $Condition; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Build an input field used to filter the query * @@ -373,9 +377,9 @@ class Export * @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 @@ class Export 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 @@ class Export * @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 @@ class Export } } + // 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 a8774244e00..71217444b16 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -461,14 +461,15 @@ class LoanSchedule extends CommonObject } } + // 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/49] 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 b8ddcebf18c..79b16bdbf55 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -238,9 +238,9 @@ - + diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 26e2c7bec90..4b7b31b6b13 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -439,14 +439,15 @@ class Mailing extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Delete targets emailing * * @return int 1 if OK, 0 if error */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function delete_targets() { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$this->id; @@ -464,15 +465,16 @@ class Mailing extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Change status of each recipient * * @param User $user Objet user qui valide * @return int <0 if KO, >0 if OK */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function reset_targets_status($user) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " SET statut = 0"; $sql.= " WHERE fk_mailing = ".$this->id; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d2039a200cb..958924c4da5 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -38,12 +38,12 @@ class Don extends CommonObject * @var string ID to identify managed object */ public $element='don'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='don'; - + public $fk_element = 'fk_donation'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe var $picto = 'generic'; @@ -96,6 +96,7 @@ class Don extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -103,9 +104,9 @@ class Don extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { + // phpcs:enable if (empty($this->labelstatut) || empty($this->labelstatushort)) { global $langs; @@ -124,39 +125,39 @@ class Don extends CommonObject { return $this->labelstatut[$statut]; } - if ($mode == 1) + elseif ($mode == 1) { return $this->labelstatutshort[$statut]; } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatutshort[$statut]; if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatut[$statut]; if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); @@ -694,6 +695,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Validate a promise of donation * @@ -702,9 +704,9 @@ class Don extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function valid_promesse($id, $userid, $notrigger=0) { + // phpcs:enable global $langs, $user; $error=0; @@ -745,6 +747,7 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the donation as paid, the donation was received * @@ -752,9 +755,9 @@ class Don extends CommonObject * @param int $modepayment mode of payment * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $modepayment=0) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; if ($modepayment) { @@ -781,15 +784,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set donation to status cancelled * * @param int $id id of donation * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($id) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = -1 WHERE rowid = ".$id; $resql=$this->db->query($sql); @@ -811,15 +815,16 @@ class Don extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Sum of donations * * @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses * @return int Summ of donations */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function sum_donations($param) { + // phpcs:enable global $conf; $result=0; @@ -839,14 +844,15 @@ class Don extends CommonObject return $result; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 3a839c2e759..575a5355877 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -453,6 +453,7 @@ class PaymentDonation extends CommonObject return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -460,10 +461,10 @@ class PaymentDonation extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut,$mode=0) { - global $langs; + // phpcs:enable + global $langs; return ''; } @@ -577,15 +578,16 @@ class PaymentDonation extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update link between the donation payment and the generated line in llx_bank * * @param int $id_bank Id if bank * @return int >0 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_fk_bank($id_bank) { + // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG); diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 7ccb88d82ee..9f5fdc485e3 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -547,6 +547,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Classify the expense report as paid * @@ -555,9 +556,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($id, $fuser, $notrigger = 0) { + // phpcs:enable $error = 0; $this->db->begin(); @@ -619,6 +620,7 @@ class ExpenseReport extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns the label of a statut * @@ -626,30 +628,30 @@ class ExpenseReport extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) return $langs->transnoentities($this->statuts[$status]); - if ($mode == 1) + elseif ($mode == 1) return $langs->transnoentities($this->statuts_short[$status]); - if ($mode == 2) + elseif ($mode == 2) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts_short[$status]); - if ($mode == 3) + elseif ($mode == 3) return img_picto($langs->transnoentities($this->statuts_short[$status]), $this->statuts_logo[$status]); - if ($mode == 4) + elseif ($mode == 4) return img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]).' '.$langs->transnoentities($this->statuts[$status]); - if ($mode == 5) + elseif ($mode == 5) return ''.$langs->transnoentities($this->statuts_short[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); - if ($mode == 6) + elseif ($mode == 6) return $langs->transnoentities($this->statuts[$status]).' '.img_picto($langs->transnoentities($this->statuts_short[$status]),$this->statuts_logo[$status]); } @@ -794,6 +796,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_line_by_project * @@ -801,9 +804,9 @@ class ExpenseReport extends CommonObject * @param User $user User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_line_by_project($projectid,$user='') { + // phpcs:enable global $conf,$db,$langs; $langs->load('trips'); @@ -951,14 +954,15 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * fetch_lines * * @return int <0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines=array(); $sql = ' SELECT de.rowid, de.comments, de.qty, de.value_unit, de.date, de.rang,'; @@ -1195,15 +1199,16 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_save_from_refuse * * @param User $fuser User * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_save_from_refuse($fuser) { + // phpcs:enable global $conf,$langs; // Sélection de la date de début de la NDF @@ -1368,6 +1373,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_unpaid * @@ -1375,9 +1381,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($fuser, $notrigger = 0) { + // phpcs:enable $error = 0; if ($this->fk_c_deplacement_statuts != 5) @@ -1428,6 +1434,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * set_cancel * @@ -1436,9 +1443,9 @@ class ExpenseReport extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_cancel($fuser,$detail, $notrigger=0) { + // phpcs:enable $error = 0; $this->date_cancel = $this->db->idate(gmmktime()); if ($this->fk_statut != 4) @@ -1613,6 +1620,7 @@ class ExpenseReport extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you add a line. * @@ -1620,9 +1628,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_add($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht + $ligne_total_ht; $this->total_tva = $this->total_tva + $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -1642,6 +1650,7 @@ class ExpenseReport extends CommonObject endif; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update total of an expense report when you delete a line. * @@ -1649,9 +1658,9 @@ class ExpenseReport extends CommonObject * @param string $ligne_total_tva Amount of all taxes * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_totaux_del($ligne_total_ht,$ligne_total_tva) { + // phpcs:enable $this->total_ht = $this->total_ht - $ligne_total_ht; $this->total_tva = $this->total_tva - $ligne_total_tva; $this->total_ttc = $this->total_ht + $this->total_tva; @@ -2058,6 +2067,7 @@ class ExpenseReport extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * periode_existe * @@ -2066,9 +2076,9 @@ class ExpenseReport extends CommonObject * @param Date $date_fin End date * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function periode_existe($fuser, $date_debut, $date_fin) { + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql.= " FROM ".MAIN_DB_PREFIX.$this->table_element; $sql.= " WHERE fk_user_author = '{$fuser->id}'"; @@ -2115,15 +2125,16 @@ class ExpenseReport extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of people with permission to validate expense reports. * Search for permission "approve expense report" * * @return array Array of user ids */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_users_approver_expensereport() { + // phpcs:enable $users_validator=array(); $sql = "SELECT DISTINCT ur.fk_user"; @@ -2222,14 +2233,15 @@ class ExpenseReport extends CommonObject return $ret; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Charge indicateurs this->nb pour le tableau de bord * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $conf; $this->nb=array(); @@ -2257,6 +2269,7 @@ class ExpenseReport extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -2264,9 +2277,9 @@ class ExpenseReport extends CommonObject * @param string $option 'topay' or 'toapprove' * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board($user, $option='topay') { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -2696,6 +2709,7 @@ class ExpenseReportLine } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des differents etats d'une note de frais. * Les valeurs de la liste sont les id de la table c_expensereport_statuts @@ -2706,9 +2720,9 @@ class ExpenseReportLine * @param int $useshortlabel Use short labels * @return string HTML select with status */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1, $useshortlabel=0) { + // phpcs:enable global $db, $langs; $tmpep=new ExpenseReport($db); @@ -2733,6 +2747,7 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt print ''; } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of types of notes with select value = id * @@ -2742,9 +2757,9 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt * @param int $active 1=Active only, 0=Unactive only, -1=All * @return string Select html */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_fees_id($selected='',$htmlname='type',$showempty=0, $active=1) { + // phpcs:enable global $db,$langs,$user; $langs->load("trips"); diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 21e8df59efc..a37f9d35c18 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -36,22 +36,22 @@ class MyObject extends CommonObject * @var string ID to identify managed object */ public $element = 'myobject'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element = 'mymodule_myobject'; - + /** * @var int Does myobject support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe */ public $ismultientitymanaged = 0; - + /** * @var int Does myobject support extrafields ? 0=No, 1=Yes */ public $isextrafieldmanaged = 1; - + /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -122,22 +122,22 @@ class MyObject extends CommonObject * @var int Name of subtable line */ //public $table_element_line = 'myobjectdet'; - + /** * @var int Field with ID of parent key if this field has a parent */ //public $fk_element = 'fk_myobject'; - + /** * @var int Name of subtable class that manage subtable lines */ //public $class_element_line = 'MyObjectline'; - + /** * @var array Array of child tables (child tables to delete before deleting a record) */ //protected $childtables=array('myobjectdet'); - + /** * @var MyObjectLine[] Array of subtable lines */ @@ -368,6 +368,7 @@ class MyObject extends CommonObject return $this->LibStatut($this->status, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -375,9 +376,9 @@ class MyObject extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status, $mode=0) { + // phpcs:enable if (empty($this->labelstatus)) { global $langs; 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/49] 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 2fcd4e63bd7..e7fa7a3d2ef 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 @@ class CActionComm } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of event types: array(id=>label) or array(code=>label) * @@ -125,9 +126,9 @@ class CActionComm * @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 e858f599cc8..70e642cbf90 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 @@ class RemiseCheque extends CommonObject } + // 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 @@ class RemiseCheque extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -857,14 +859,15 @@ class RemiseCheque extends CommonObject } } + // 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 @@ class RemiseCheque extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the creation date * @@ -906,9 +910,9 @@ class RemiseCheque extends CommonObject * @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 @@ class RemiseCheque extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set the ref of bordereau * @@ -941,9 +946,9 @@ class RemiseCheque extends CommonObject * @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 @@ class RemiseCheque extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -1064,9 +1070,9 @@ class RemiseCheque extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string 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 @@ class RemiseCheque extends CommonObject 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 fc92302cf7d..d8434caefd8 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 @@ class LignePrelevement return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for a status * @@ -135,28 +136,28 @@ class LignePrelevement * @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 06c65500527..7e413854846 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 @@ abstract class ActionsContactCardCommon //} } - /** + // 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 @@ abstract class ActionsContactCardCommon } } + // 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 66f0c730938..878f4bee67e 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -102,14 +102,15 @@ class Fournisseur extends Societe } } + // 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 @@ class Fournisseur extends Societe } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a supplier category * @@ -151,9 +153,9 @@ class Fournisseur extends Societe * @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 @@ class Fournisseur extends Societe } } + // 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 9b52b3119f6..545e53d350a 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 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -99,9 +100,9 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets * @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 13de6e62ccf..4d3a4a55c74 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -333,15 +333,16 @@ class Dolresource extends CommonObject } } + // 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 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load resource objects into $this->lines * @@ -488,9 +490,9 @@ class Dolresource extends CommonObject * @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 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -584,9 +587,9 @@ class Dolresource extends CommonObject * @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 @@ class Dolresource extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load all objects into $this->lines * @@ -662,9 +666,9 @@ class Dolresource extends CommonObject * @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 @@ class Dolresource extends CommonObject } } + // 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 @@ class Dolresource extends CommonObject * @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 @@ class Dolresource extends CommonObject return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update element resource into database * @@ -759,9 +765,9 @@ class Dolresource extends CommonObject * @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 @@ class Dolresource extends CommonObject } + // 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 @@ class Dolresource extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -974,9 +982,9 @@ class Dolresource extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 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 6ed6038af81..b95ba78e2be 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -60,6 +60,7 @@ class FormResource } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html form to select a resource * @@ -75,9 +76,9 @@ class FormResource * @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 @@ class FormResource return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return html list of tickets type * @@ -167,9 +169,9 @@ class FormResource * @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 98d20bd0ad5..33360116c97 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 @@ class UserGroup extends CommonObject return $this->LibStatut(0,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -810,9 +811,9 @@ class UserGroup extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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 @@ class UserGroup extends CommonObject return $result; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * @@ -904,9 +906,9 @@ class UserGroup extends CommonObject * 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 @@ class UserGroup extends CommonObject } + // 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 @@ class UserGroup extends CommonObject * @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 d4e29841821..039bea84bc6 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 @@ class Website extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -702,38 +703,32 @@ class Website extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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/49] 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 4687a841807..51b031b5c7c 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 @@ class FactureRec extends CommonInvoice } + // 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 @@ class FactureRec extends CommonInvoice 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 @@ class FactureRec extends CommonInvoice * @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 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if ($recur) @@ -1227,7 +1229,7 @@ class FactureRec extends CommonInvoice else return $langs->trans("Draft"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($recur) { @@ -1240,7 +1242,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); } } - if ($mode == 3) + elseif ($mode == 3) { if ($recur) { @@ -1254,7 +1256,7 @@ class FactureRec extends CommonInvoice else return img_picto($langs->trans('Draft'),'statut0'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if ($recur) @@ -1268,7 +1270,7 @@ class FactureRec extends CommonInvoice 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 da0d66b2784..cb38b954736 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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set customer ref * @@ -1774,9 +1777,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice return true; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -2479,9 +2486,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice else return $situation_percent < $obj->situation_percent; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update invoice line with percentage * @@ -3045,9 +3053,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set percent discount * @@ -3143,9 +3152,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set absolute discount * @@ -3208,9 +3218,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of invoices (eventually filtered on a user) into an array * @@ -3414,9 +3425,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Supprime une demande de prelevement * @@ -3717,9 +3732,9 @@ class Facture extends CommonInvoice * @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 @@ class Facture extends CommonInvoice } + // 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 @@ class Facture extends CommonInvoice } } + // 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 @@ class Facture extends CommonInvoice } } + // 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 @@ class Facture extends CommonInvoice } } + // 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 @@ class FactureLigne extends CommonInvoiceLine } } + // 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 @@ class FactureLigne extends CommonInvoiceLine } } + // 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 @@ class FactureLigne extends CommonInvoiceLine * @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 a5f7c3134d7..b1197260240 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 @@ class Tva extends CommonObject 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 @@ class Tva extends CommonObject } } + // 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 @@ class Tva extends CommonObject } + // 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 @@ class Tva extends CommonObject } } + // 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 @@ class Tva extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -807,9 +812,9 @@ class Tva extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($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 1949f696a86..3e18b7944f2 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 @@ class ActionsCardCompany extends ActionsCardCommon } + // 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 @@ class ActionsCardCompany extends ActionsCardCommon * @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/49] 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 c6848bfe689..f2e2bbaf04c 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -528,15 +528,16 @@ class AccountingAccount extends CommonObject } } + // 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 @@ class AccountingAccount extends CommonObject } } + // 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 @@ class AccountingAccount extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un statut donne * @@ -608,9 +611,9 @@ class AccountingAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label 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 @@ class AccountingAccount extends CommonObject 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 fe91fc74436..b84534af37a 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -75,16 +75,17 @@ abstract class ActionsAdherentCardCommon //} } - /** + // 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 @@ abstract class ActionsAdherentCardCommon } } + // 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 c5d6a89a152..be7af41e894 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 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -74,9 +75,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @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 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -130,9 +132,9 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon * @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 566434c1d5a..5831b943d76 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 @@ include_once DOL_DOCUMENT_ROOT.'/contact/canvas/actions_contactcard_common.class */ 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 @@ class ActionsContactCardDefault extends ActionsContactCardCommon return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Assign custom values for canvas * @@ -73,9 +74,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @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 @@ class ActionsContactCardDefault extends ActionsContactCardCommon } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fetch datas list and save into ->list_datas * @@ -129,9 +131,9 @@ class ActionsContactCardDefault extends ActionsContactCardCommon * @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 ffff8ef1941..37685001aba 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 @@ class EmailSenderProfile extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return the status * @@ -317,43 +318,36 @@ class EmailSenderProfile extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function LibStatut($status,$mode=0) { 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 61c633c720b..e9e1d8fe6c9 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 @@ class FormProjets return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a combo list with projects qualified for a third party / user * @@ -71,9 +72,9 @@ class FormProjets * @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 @@ class FormProjets else return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array with projects qualified for a third party * @@ -139,9 +141,9 @@ class FormProjets * @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 @@ class FormProjets } + // 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 @@ class FormProjets * @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 1db9fe4d3d8..a549485ac4c 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -88,6 +88,7 @@ class FormSms return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show the form to input an sms. * @@ -95,9 +96,9 @@ class FormSms * @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 b1ecbbf483c..3d9d92189a3 100644 --- a/htdocs/core/class/menu.class.php +++ b/htdocs/core/class/menu.class.php @@ -96,14 +96,15 @@ class Menu $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 42be08bfe34..c700b8c84a1 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -999,6 +999,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * @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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds boxes * @@ -1125,9 +1127,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * * @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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it return $err; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds access rights * @@ -1646,9 +1656,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * @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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Adds directories definitions * @@ -2027,9 +2042,9 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it * * @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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } + // 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it 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 bd61dab4ff4..42ce154c648 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 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if a code is used (by other element) * @@ -231,9 +232,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * @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 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if a barcode value match syntax * @@ -263,9 +265,9 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode * @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 bc08063ea21..2d3c4bebfe6 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 @@ abstract class ModeleNumRefFicheinter } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create an intervention document on disk using template defined into FICHEINTER_ADDON_PDF * @@ -160,9 +162,9 @@ abstract class ModeleNumRefFicheinter * @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 b1dc86d4e4d..c931abce4ed 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 @@ class ModelePDFCards } +// 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 @@ class ModelePDFCards * @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 77a31689237..57502a52365 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 @@ class ProductFournisseur extends Product + // 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 @@ class ProductFournisseur extends Product } + // 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 @@ class ProductFournisseur extends Product } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Modify the purchase price for a supplier * @@ -212,9 +215,9 @@ class ProductFournisseur extends Product * @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 @@ class ProductFournisseur extends Product } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Loads the price information of a provider * @@ -448,9 +452,9 @@ class ProductFournisseur extends Product * @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 @@ class ProductFournisseur extends Product } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List all supplier prices of a product * @@ -539,9 +544,9 @@ class ProductFournisseur extends Product * @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 @@ class ProductFournisseur extends Product } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load properties for minimum price * @@ -638,9 +644,9 @@ class ProductFournisseur extends Product * @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 @@ class ProductFournisseur extends Product return $thirdparty->getNomUrl($withpicto,$option,$maxlen,$notooltip); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Display price of product * @@ -829,9 +836,9 @@ class ProductFournisseur extends Product * 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 c33e015ec79..139183e0375 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 @@ class MailmanSpip 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 @@ class MailmanSpip 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 @@ class MailmanSpip 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 @@ class MailmanSpip return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Subscribe an email to all mailing-lists * @@ -311,9 +315,9 @@ class MailmanSpip * @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 @@ class MailmanSpip } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Unsubscribe an email from all mailing-lists * Used when a user is resiliated @@ -384,9 +389,9 @@ class MailmanSpip * @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 30b1667afcf..2577f5bed5d 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 @@ abstract class ActionsCardCommon $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 @@ abstract class ActionsCardCommon * @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 @@ abstract class ActionsCardCommon } } + // 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 c662ce2ae6f..5fd7ee01faf 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 @@ class ActionsCardIndividual extends ActionsCardCommon 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 @@ class ActionsCardIndividual extends ActionsCardCommon * @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 4b313808e0d..3f446f13a5b 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 @@ class WebsitePage extends CommonObject return $this->LibStatut($this->status,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi le libelle d'un status donne * @@ -474,9 +475,9 @@ class WebsitePage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($status,$mode=0) { + // phpcs:enable global $langs; if ($mode == 0) @@ -485,27 +486,27 @@ class WebsitePage extends CommonObject 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/49] 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 26227048782..6d4c32d82bb 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -94,6 +94,7 @@ abstract class CommonStickerGenerator $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP strem. * @@ -103,8 +104,8 @@ abstract class CommonStickerGenerator * @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 class CommonStickerGenerator */ 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 class CommonStickerGenerator * @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 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Print dot line * @@ -146,9 +149,9 @@ abstract class CommonStickerGenerator * @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 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Function realisant une croix aux 4 coins des cartes * @@ -188,9 +192,9 @@ abstract class CommonStickerGenerator * @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 @@ abstract class CommonStickerGenerator $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 @@ abstract class CommonStickerGenerator * @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 @@ abstract class CommonStickerGenerator } } + // 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 @@ abstract class CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * protected Set format * @@ -257,9 +264,9 @@ abstract class CommonStickerGenerator * @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 a2ac7a1f458..b1a92ae0f5f 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 @@ class DiscountAbsolute + // 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 @@ class DiscountAbsolute * @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 @@ class DiscountAbsolute } + // 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 52d9b47ecdf..548721be05f 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -137,6 +137,7 @@ class DolEditor } } + // 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 @@ class DolEditor * @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 55ecc77291a..f3d6041515c 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 @@ class DolGraph } + // 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 @@ class DolGraph * @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 @@ class DolGraph + // 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 @@ class DolGraph } } + // 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 @@ class DolGraph } } + // 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 @@ class DolGraph 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 @@ class DolGraph 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 @@ class DolGraph 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 @@ class DolGraph * @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 @@ class DolGraph } + // 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 @@ class DolGraph * @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 a00da884aba..36881b76f84 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 @@ class dolReceiptPrinter extends Escpos } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Add a printer in db * @@ -359,9 +360,9 @@ class dolReceiptPrinter extends Escpos * @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 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer in db * @@ -385,9 +387,9 @@ class dolReceiptPrinter extends Escpos * @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 @@ class dolReceiptPrinter extends Escpos 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 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Update a printer template in db * @@ -433,9 +437,9 @@ class dolReceiptPrinter extends Escpos * @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 @@ class dolReceiptPrinter extends Escpos } + // 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 @@ class dolReceiptPrinter extends Escpos return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to Print Receipt Ticket * @@ -494,9 +500,9 @@ class dolReceiptPrinter extends Escpos * @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 @@ class dolReceiptPrinter extends Escpos } + // 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 64e33cd5023..5ffaf0463a6 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 @@ class FormAccounting extends Form $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of journals with label by nature * @@ -69,9 +70,9 @@ class FormAccounting extends Form * @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 @@ class FormAccounting extends Form 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 @@ class FormAccounting extends Form * @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 @@ class FormAccounting extends Form print $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return select filter with date of transaction * @@ -225,9 +228,9 @@ class FormAccounting extends Form * @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 @@ class FormAccounting extends Form 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 @@ class FormAccounting extends Form * @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 @@ class FormAccounting extends Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of auxilary thirdparty accounts * @@ -351,9 +356,9 @@ class FormAccounting extends Form * @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 @@ class FormAccounting extends Form return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of years existing into book keepping * @@ -412,9 +418,9 @@ class FormAccounting extends Form * @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 7fc07ab46ed..e01e1f2ad65 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 @@ class FormActions } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show list of action status * @@ -64,9 +65,9 @@ class FormActions * @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 @@ class FormActions } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output html select list of type of event * @@ -326,9 +328,9 @@ class FormActions * @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 fd9bc3ab3f9..22fa73741ce 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 @@ class FormAdmin 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 @@ class FormAdmin * @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 @@ class FormAdmin return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of available menus (eldy_backoffice, ...) * @@ -136,9 +131,9 @@ class FormAdmin * @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 @@ class FormAdmin print ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list of available menu families * @@ -225,9 +221,9 @@ class FormAdmin * @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 @@ class FormAdmin } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of timezones * @@ -296,9 +293,9 @@ class FormAdmin * @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 'global->THEME_ELDY_USE_HOVER?" checked":"").'>'; + print ' '.$langs->trans("UsePersonalValue").''; + print ''; + print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + print ''; + print ''; + */ + } + else + { + print ''; + print ''.$langs->trans("HighlightLinesChecked").''; + print ''; + //print ''; + //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; + if ($edit) + { + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb'; + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); + print $formother->selectColor($color,'THEME_ELDY_USE_CHECKED','formcolor',1).' '; + } + else + { + if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color='ffefbb'; + else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED,array()),''); + if ($color) + { + if ($color != 'ffefbb') print ''; + else print $langs->trans("Default"); + } + else print $langs->trans("None"); + } + print '   ('.$langs->trans("Default").': ffefbb) '; + print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); + print ''; + print ''; print ''; } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 16ca7cc7201..5f5e37d38a8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1703,6 +1703,7 @@ InstallModuleFromWebHasBeenDisabledByFile=Install of external module from applic ConfFileMustContainCustom=Installing or building an external module from application need to save the module files into directory %s. To have this directory processed by Dolibarr, you must setup your conf/conf.php to add the 2 directive lines:
    $dolibarr_main_url_root_alt='/custom';
    $dolibarr_main_document_root_alt='%s/custom'; HighlightLinesOnMouseHover=Highlight table lines when mouse move passes over HighlightLinesColor=Highlight color of the line when the mouse passes over (keep empty for no highlight) +HighlightLinesChecked=Highlight color of the line when it is checked (keep empty for no highlight) TextTitleColor=Text color of Page title LinkColor=Color of links PressF5AfterChangingThis=Press CTRL+F5 on keyboard or clear your browser cache after changing this value to have it effective diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index b6e744672e8..222e7a14593 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -4,6 +4,7 @@ * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -107,6 +108,7 @@ if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_ if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER=$colorbacklinepairhover; +if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked; if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; @@ -143,9 +145,11 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( // Hover color $colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); +$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '0')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_CHECKED)); if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) { $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); + $colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_CHECKED)); } //$colortopbordertitle1=$colorbackhmenu1; @@ -191,6 +195,7 @@ $colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); +if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',',colorStringToArray($colorbacklinepairchecked)); $colorbackbody=join(',',colorStringToArray($colorbackbody)); $colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); $colortexttitle=join(',',colorStringToArray($colortexttitle)); @@ -218,6 +223,7 @@ print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; +print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; print '$colortexttitlenotab='.$colortexttitlenotab."\n"; print '$colortexttitle='.$colortexttitle."\n"; print '$colortext='.$colortext."\n"; @@ -2931,6 +2937,12 @@ div.pagination li.paginationafterarrows { background: rgb() !important; /* Must be background to be stronger than background of odd or even */ } + +.highlight { + background: rgb() !important; /* Must be background to be stronger than background of odd or even */ +} + + .nohover:hover { background: unset; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index aa02805c5cc..873319b39d1 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5,6 +5,7 @@ * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,6 +109,7 @@ if (! isset($conf->global->THEME_ELDY_TOPMENU_BACK1)) $conf->global->THEME_ELDY_ if (! isset($conf->global->THEME_ELDY_VERMENU_BACK1)) $conf->global->THEME_ELDY_VERMENU_BACK1=$colorbackvmenu1; if (! isset($conf->global->THEME_ELDY_BACKTITLE1)) $conf->global->THEME_ELDY_BACKTITLE1=$colorbacktitle1; if (! isset($conf->global->THEME_ELDY_USE_HOVER)) $conf->global->THEME_ELDY_USE_HOVER==$colorbacklinepairhover; +if (! isset($conf->global->THEME_ELDY_USE_CHECKED)) $conf->global->THEME_ELDY_USE_CHECKED=$colorbacklinepairchecked; if (! isset($conf->global->THEME_ELDY_LINEBREAK)) $conf->global->THEME_ELDY_LINEBREAK=$colorbacklinebreak; if (! isset($conf->global->THEME_ELDY_TEXTTITLENOTAB)) $conf->global->THEME_ELDY_TEXTTITLENOTAB=$colortexttitlenotab; if (! isset($conf->global->THEME_ELDY_TEXTLINK)) $conf->global->THEME_ELDY_TEXTLINK=$colortextlink; @@ -145,9 +147,11 @@ $fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty( // Hover color $colorbacklinepairhover=((! isset($conf->global->THEME_ELDY_USE_HOVER) || (string) $conf->global->THEME_ELDY_USE_HOVER === '0')?'':($conf->global->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_HOVER)); +$colorbacklinepairchecked=((! isset($conf->global->THEME_ELDY_USE_CHECKED) || (string) $conf->global->THEME_ELDY_USE_CHECKED === '0')?'':($conf->global->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$conf->global->THEME_ELDY_USE_CHECKED)); if (! empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)) { $colorbacklinepairhover=((! isset($user->conf->THEME_ELDY_USE_HOVER) || $user->conf->THEME_ELDY_USE_HOVER === '0')?'':($user->conf->THEME_ELDY_USE_HOVER === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_HOVER)); + $colorbacklinepairchecked=((! isset($user->conf->THEME_ELDY_USE_CHECKED) || $user->conf->THEME_ELDY_USE_CHECKED === '0')?'':($user->conf->THEME_ELDY_USE_CHECKED === '1'?'edf4fb':$user->conf->THEME_ELDY_USE_CHECKED)); } if (empty($colortopbordertitle1)) $colortopbordertitle1=$colorbackhmenu1; @@ -193,6 +197,7 @@ $colorbacklineimpair2=join(',',colorStringToArray($colorbacklineimpair2)); $colorbacklinepair1=join(',',colorStringToArray($colorbacklinepair1)); $colorbacklinepair2=join(',',colorStringToArray($colorbacklinepair2)); if ($colorbacklinepairhover != '') $colorbacklinepairhover=join(',',colorStringToArray($colorbacklinepairhover)); +if ($colorbacklinepairchecked != '') $colorbacklinepairchecked=join(',',colorStringToArray($colorbacklinepairchecked)); $colorbackbody=join(',',colorStringToArray($colorbackbody)); $colortexttitlenotab=join(',',colorStringToArray($colortexttitlenotab)); $colortexttitle=join(',',colorStringToArray($colortexttitle)); @@ -211,6 +216,7 @@ print 'colorbacklineimpair2='.$colorbacklineimpair2."\n"; print 'colorbacklinepair1='.$colorbacklinepair1."\n"; print 'colorbacklinepair2='.$colorbacklinepair2."\n"; print 'colorbacklinepairhover='.$colorbacklinepairhover."\n"; +print 'colorbacklinepairchecked='.$colorbacklinepairchecked."\n"; print '$colortexttitlenotab='.$colortexttitlenotab."\n"; print '$colortexttitle='.$colortexttitle."\n"; print '$colortext='.$colortext."\n"; @@ -2907,6 +2913,12 @@ ul.noborder li:nth-child(odd):not(.liste_titre) { } + +.highlight { + background: rgb() !important; /* Must be background to be stronger than background of odd or even */ +} + + .oddeven, .evenodd, .impair, .nohover .impair:hover, tr.impair td.nohover { font-family: ; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 5c2869847c6..6cb418ff641 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2010-2015 Regis Houssin * Copyright (C) 2013 Florian Henry + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -137,6 +138,12 @@ if (empty($reshook)) { $tabparam["THEME_ELDY_USE_HOVER"] = 0; } + if (GETPOST('check_THEME_ELDY_USE_CHECKED') == 'on') { + $tabparam["THEME_ELDY_USE_CHECKED"] = 1; + } else { + $tabparam["THEME_ELDY_USE_CHECKED"] = 0; + } + $result = dol_set_user_param($db, $conf, $object, $tabparam); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); From fd6281b364ab571242e09aa3c7ead48764216393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 20:00:09 +0200 Subject: [PATCH 21/49] move phpcs:ignore --- htdocs/core/class/fiscalyear.class.php | 21 ++++++----- htdocs/core/modules/bank/modules_bank.php | 3 +- .../expensereport/modules_expensereport.php | 3 +- .../export/export_excel2007.modules.php | 15 ++++---- htdocs/core/modules/export/modules_export.php | 3 +- .../core/modules/facture/modules_facture.php | 5 ++- .../holiday/mod_holiday_immaculate.php | 11 +++--- .../modules/holiday/mod_holiday_madonna.php | 3 +- .../modules/livraison/mod_livraison_jade.php | 7 ++-- .../modules/mailings/xinputfile.modules.php | 3 +- .../modules/mailings/xinputuser.modules.php | 7 ++-- .../modules/payment/mod_payment_cicada.php | 5 ++- .../modules_product_batch.class.php | 11 +++--- .../fourn/class/fournisseur.facture.class.php | 37 ++++++++++++------- 14 files changed, 79 insertions(+), 55 deletions(-) diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 0bc58a64e64..4e9b4021ee5 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -250,6 +250,7 @@ class Fiscalyear extends CommonObject return $this->LibStatut($this->statut,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Give a label from a status * @@ -257,38 +258,38 @@ class Fiscalyear extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - // 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]),'statut4').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$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]),'statut4'); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut4').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]),'statut8').' '.$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]),'statut4'); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } } diff --git a/htdocs/core/modules/bank/modules_bank.php b/htdocs/core/modules/bank/modules_bank.php index 300b06896b7..faae304222d 100644 --- a/htdocs/core/modules/bank/modules_bank.php +++ b/htdocs/core/modules/bank/modules_bank.php @@ -37,6 +37,7 @@ abstract class ModeleBankAccountDoc extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -44,9 +45,9 @@ abstract class ModeleBankAccountDoc 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 = 'bankaccount'; diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index f0a1573b996..11396f84435 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -29,6 +29,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -36,9 +37,9 @@ abstract class ModeleExpenseReport 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='expensereport'; diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 46f4d8960c2..0c13dfde688 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -37,12 +37,12 @@ class ExportExcel2007 extends ExportExcel * @var int ID */ public $id; - + /** * @var string proper name for given parameter */ public $label; - + var $extension; var $version; @@ -98,14 +98,15 @@ class ExportExcel2007 extends ExportExcel } - /** - * Close Excel file - * - * @return int <0 if KO, >0 if OK - */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Close Excel file + * + * @return int <0 if KO, >0 if OK + */ function close_file() { + // phpcs:enable global $conf; if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) diff --git a/htdocs/core/modules/export/modules_export.php b/htdocs/core/modules/export/modules_export.php index ae409d71b05..6c155510f30 100644 --- a/htdocs/core/modules/export/modules_export.php +++ b/htdocs/core/modules/export/modules_export.php @@ -42,6 +42,7 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac var $libversion=array(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load into memory list of available export format * @@ -49,9 +50,9 @@ class ModeleExports extends CommonDocGenerator // This class can't be abstrac * @param integer $maxfilenamelength Max length of value to show * @return array List of templates (same content than array this->driverlabel) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function liste_modeles($db,$maxfilenamelength=0) { + // phpcs:enable dol_syslog(get_class($this)."::liste_modeles"); $dir=DOL_DOCUMENT_ROOT."/core/modules/export/"; diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 521e6471561..12d41903edb 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -42,6 +42,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator */ public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -49,9 +50,9 @@ abstract class ModelePDFFactures 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='invoice'; @@ -65,7 +66,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator } /** - * Classe mere des modeles de numerotation des references de facture + * Classe mere des modeles de numerotation des references de facture */ abstract class ModeleNumRefFactures { diff --git a/htdocs/core/modules/holiday/mod_holiday_immaculate.php b/htdocs/core/modules/holiday/mod_holiday_immaculate.php index afd9d35387c..16b7adce4ac 100644 --- a/htdocs/core/modules/holiday/mod_holiday_immaculate.php +++ b/htdocs/core/modules/holiday/mod_holiday_immaculate.php @@ -118,16 +118,17 @@ class mod_holiday_immaculate extends ModelNumRefHolidays return $numFinal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return next value + * Return next value * - * @param User $fuser User object - * @param Object $objforref Holiday object - * @return string Value if OK, 0 if KO + * @param User $fuser User object + * @param Object $objforref Holiday object + * @return string Value if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function holiday_get_num($fuser, $objforref) { + // phpcs:enable return $this->getNextValue($fuser, $objforref); } } diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index 91bf0f511bb..ba951bb557c 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -136,6 +136,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next value * @@ -143,9 +144,9 @@ class mod_holiday_madonna extends ModelNumRefHolidays * @param Object $objforref Holiday object * @return string Value if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function holiday_get_num($fuser,$objforref) { + // phpcs:enable return $this->getNextValue($fuser,$objforref); } } diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 9cf6de78aea..2bc64bdcb63 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -142,16 +142,17 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free ref * - * @param Societe $objsoc Object thirdparty + * @param Societe $objsoc Object thirdparty * @param Object $object Object livraison - * @return string Texte descripif + * @return string Texte descriptif */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function livraison_get_num($objsoc=0,$object='') { + // phpcs:enable return $this->getNextValue($objsoc,$object); } } diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 30c719689f2..7de27a0c753 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -110,6 +110,7 @@ class mailing_xinputfile extends MailingTargets return $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -117,9 +118,9 @@ class mailing_xinputfile extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable global $conf,$langs,$_FILES; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 89c626c447d..2364eeb08ef 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -108,6 +108,7 @@ class mailing_xinputuser extends MailingTargets return $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -115,9 +116,9 @@ class mailing_xinputuser extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable global $conf,$langs,$_FILES; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -154,8 +155,8 @@ class mailing_xinputuser extends MailingTargets } else { - $langs->load("errors"); - $this->error = $langs->trans("ErrorBadEmail",$email); + $langs->load("errors"); + $this->error = $langs->trans("ErrorBadEmail",$email); return -1; } } diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 94fc445a1e2..5e87f33f8c1 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -138,16 +138,17 @@ class mod_payment_cicada extends ModeleNumRefPayments } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function payment_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/product_batch/modules_product_batch.class.php b/htdocs/core/modules/product_batch/modules_product_batch.class.php index 02e3be660b8..31e0ec676b2 100644 --- a/htdocs/core/modules/product_batch/modules_product_batch.class.php +++ b/htdocs/core/modules/product_batch/modules_product_batch.class.php @@ -21,8 +21,8 @@ /** - * \class ModeleProductCode - * \brief Parent class for product code generators + * \class ModeleProductCode + * \brief Parent class for product code generators */ /** @@ -44,16 +44,17 @@ abstract class ModelePDFProductBatch extends CommonDocGenerator public $error=''; - /** - * Return list of active generation modules + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return list of active generation modules * * @param DoliDB $db Database handler * @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='product_batch'; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f9f352c1f70..e8ef92a7d63 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -668,14 +668,15 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load this->lines * * @return int 1 si ok, < 0 si erreur */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_lines() { + // phpcs:enable $this->lines = array(); $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.vat_src_code, f.tva_tx'; @@ -894,15 +895,16 @@ class FactureFournisseur extends CommonInvoice } } + // 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'; @@ -1146,17 +1148,18 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Tag invoice as a payed invoice + * Tag invoice as a payed invoice * * @param User $user Object user * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet. Not implementd yet. * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet. Not implementd yet. * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_paid($user, $close_code='', $close_note='') { + // phpcs:enable global $conf,$langs; $error=0; @@ -1195,6 +1198,7 @@ class FactureFournisseur extends CommonInvoice } + // 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, @@ -1203,9 +1207,9 @@ class FactureFournisseur extends CommonInvoice * @param User $user Object user that change status * @return int <0 si ok, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function set_unpaid($user) { + // phpcs:enable global $conf,$langs; $error=0; @@ -1407,6 +1411,7 @@ class FactureFournisseur extends CommonInvoice } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set draft status * @@ -1414,9 +1419,9 @@ class FactureFournisseur extends CommonInvoice * @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; @@ -1972,16 +1977,17 @@ class FactureFournisseur extends CommonInvoice } } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Renvoi liste des factures remplacables * Statut validee ou abandonnee pour raison autre + non payee + aucun paiement + pas deja remplacee * * @param int $socid Id societe * @return array Tableau des factures ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_replacable_supplier_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -2019,6 +2025,7 @@ class FactureFournisseur extends CommonInvoice } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi liste des factures qualifiables pour correction par avoir * Les factures qui respectent les regles suivantes sont retournees: @@ -2027,9 +2034,9 @@ class FactureFournisseur extends CommonInvoice * @param int $socid Id societe * @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_qualified_avoir_supplier_invoices($socid=0) { + // phpcs:enable global $conf; $return = array(); @@ -2070,15 +2077,16 @@ class FactureFournisseur extends CommonInvoice } } + // 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; $sql = 'SELECT ff.rowid, ff.date_lim_reglement as datefin, ff.fk_statut'; @@ -2367,14 +2375,15 @@ class FactureFournisseur extends CommonInvoice $this->total_ttc = $xnbp*119.6; } + // 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(); @@ -3106,14 +3115,16 @@ class SupplierInvoiceLine extends CommonObjectLine return -2; } } - /** + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Mise a jour de l'objet ligne de commande en base * * @return int <0 si ko, >0 si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_total() { + // phpcs:enable $this->db->begin(); // Mise a jour ligne en base From 48d8a444e0e7b11a5601f896f9796a83aecb17dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 20:58:05 +0200 Subject: [PATCH 22/49] correct merge --- .../class/supplier_proposal.class.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 533b35ab0ab..ecd940fea96 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2702,29 +2702,18 @@ class SupplierProposalLine extends CommonObjectLine public $oldline; // From llx_supplier_proposaldet -<<<<<<< HEAD - var $rowid; // deprecated -======= public $rowid; // deprecated ->>>>>>> upstream/develop /** * @var int ID */ public $id; -<<<<<<< HEAD - var $fk_supplier_proposal; - var $fk_parent_line; - var $desc; // Description ligne - var $fk_product; // Id produit predefini -======= public $fk_supplier_proposal; public $fk_parent_line; public $desc; // Description ligne public $fk_product; // Id produit predefini ->>>>>>> upstream/develop /** * @deprecated * @see product_type From c6cef85ccdbc1e86221ad35144c77804cf8e80ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 21:16:17 +0200 Subject: [PATCH 23/49] move phpcs:ignore --- .../core/modules/expensereport/modules_expensereport.php | 5 +++-- htdocs/core/modules/export/export_excel2007.modules.php | 2 +- htdocs/core/modules/societe/mod_codecompta_panicum.php | 3 ++- htdocs/core/modules/usergroup/modules_usergroup.class.php | 7 ++++--- htdocs/livraison/class/livraison.class.php | 8 ++------ 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/core/modules/expensereport/modules_expensereport.php b/htdocs/core/modules/expensereport/modules_expensereport.php index 11396f84435..9ff7f671f9f 100644 --- a/htdocs/core/modules/expensereport/modules_expensereport.php +++ b/htdocs/core/modules/expensereport/modules_expensereport.php @@ -52,6 +52,7 @@ abstract class ModeleExpenseReport extends CommonDocGenerator } } +// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * expensereport_pdf_create * @@ -65,9 +66,9 @@ abstract class ModeleExpenseReport extends CommonDocGenerator * @param int $hideref Hide ref * @return int 0 if KO, 1 if OK */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expensereport_pdf_create(DoliDB $db, ExpenseReport $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + // phpcs:enable return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } @@ -142,7 +143,7 @@ abstract class ModeleNumRefExpenseReport /** * Renvoie version du module numerotation * - * @return string Valeur + * @return string Valeur */ function getVersion() { diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php index 5b2fd563427..74e35ff5b18 100644 --- a/htdocs/core/modules/export/export_excel2007.modules.php +++ b/htdocs/core/modules/export/export_excel2007.modules.php @@ -98,7 +98,7 @@ class ExportExcel2007 extends ExportExcel } - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close Excel file * diff --git a/htdocs/core/modules/societe/mod_codecompta_panicum.php b/htdocs/core/modules/societe/mod_codecompta_panicum.php index 1e990b42d69..2dd6a81de02 100644 --- a/htdocs/core/modules/societe/mod_codecompta_panicum.php +++ b/htdocs/core/modules/societe/mod_codecompta_panicum.php @@ -67,6 +67,7 @@ class mod_codecompta_panicum extends ModeleAccountancyCode return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set accountancy account code for a third party into this->code * @@ -75,9 +76,9 @@ class mod_codecompta_panicum extends ModeleAccountancyCode * @param int $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { + // phpcs:enable $this->code=''; if (is_object($societe)) { diff --git a/htdocs/core/modules/usergroup/modules_usergroup.class.php b/htdocs/core/modules/usergroup/modules_usergroup.class.php index ec976239b9b..caa79594080 100644 --- a/htdocs/core/modules/usergroup/modules_usergroup.class.php +++ b/htdocs/core/modules/usergroup/modules_usergroup.class.php @@ -44,16 +44,17 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator public $error=''; - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return list of active generation modules * * @param DoliDB $db Database handler * @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 = 'group'; @@ -63,4 +64,4 @@ abstract class ModelePDFUserGroup extends CommonDocGenerator $list = getListOfModels($db, $type, $maxfilenamelength); return $list; } -} \ No newline at end of file +} diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index e3c03b723b1..c5e4b36ed25 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -1100,25 +1100,21 @@ class LivraisonLigne extends CommonObjectLine */ public $label; -<<<<<<< HEAD - var $description; // Description produit -======= /** * @var string product description */ public $description; ->>>>>>> upstream/develop /** * @deprecated * @see product_ref */ - var $ref; + public $ref; /** * @deprecated * @see product_label; */ - var $libelle; + public $libelle; public $product_ref; public $product_label; From 3847df1de6c4a87525e5ec9996100743c13a6f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 21:53:53 +0200 Subject: [PATCH 24/49] move phpcs:ignore --- htdocs/core/class/commoninvoice.class.php | 19 ++--- htdocs/core/db/mysqli.class.php | 72 ++++++++++++------- htdocs/core/modules/dons/modules_don.php | 7 +- .../modules/export/export_csv.modules.php | 20 ++++-- .../core/modules/holiday/modules_holiday.php | 7 +- .../modules/livraison/modules_livraison.php | 3 +- .../thirdparties_services_expired.modules.php | 7 +- .../core/modules/project/modules_project.php | 5 +- .../mod_commande_fournisseur_muguet.php | 3 +- .../pdf/pdf_muscadet.modules.php | 12 ++-- .../core/modules/user/modules_user.class.php | 3 +- 11 files changed, 98 insertions(+), 60 deletions(-) diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 54d9aed45e9..e9be4b1f9da 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -325,6 +325,7 @@ abstract class CommonInvoice extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return if an invoice can be deleted * Rule is: @@ -337,9 +338,9 @@ abstract class CommonInvoice extends CommonObject * * @return int <=0 if no, >0 if yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function is_erasable() { + // phpcs:enable global $conf; // We check if invoice is a temporary number (PROVxxxx) @@ -450,6 +451,7 @@ abstract class CommonInvoice extends CommonObject return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of a status * @@ -460,9 +462,9 @@ abstract class CommonInvoice extends CommonObject * @param int $type Type invoice * @return string Label of status */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=0) { + // phpcs:enable global $langs; $langs->load('bills'); @@ -485,7 +487,7 @@ abstract class CommonInvoice extends CommonObject else return $langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 1) + elseif ($mode == 1) { $prefix='Short'; if (! $paye) @@ -503,7 +505,7 @@ abstract class CommonInvoice extends CommonObject else return $langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 2) + elseif ($mode == 2) { $prefix='Short'; if (! $paye) @@ -521,7 +523,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6').' '.$langs->trans('Bill'.$prefix.'StatusPaid'); } } - if ($mode == 3) + elseif ($mode == 3) { $prefix='Short'; if (! $paye) @@ -539,7 +541,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6'); } } - if ($mode == 4) + elseif ($mode == 4) { $prefix=''; if (! $paye) @@ -557,7 +559,7 @@ abstract class CommonInvoice extends CommonObject else return img_picto($langs->trans('BillStatusPaid'),'statut6').' '.$langs->trans('BillStatusPaid'); } } - if ($mode == 5 || $mode == 6) + elseif ($mode == 5 || $mode == 6) { $prefix=''; if ($mode == 5) $prefix='Short'; @@ -582,6 +584,7 @@ abstract class CommonInvoice extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi une date limite de reglement de facture en fonction des * conditions de reglements de la facture et date de facturation @@ -589,9 +592,9 @@ abstract class CommonInvoice extends CommonObject * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function calculate_date_lim_reglement($cond_reglement=0) { + // phpcs:enable if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index cd434791310..868712a31d0 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -167,17 +167,18 @@ class DoliDBMysqli extends DoliDB return $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Select a database + * Select a database * - * @param string $database Name of database - * @return boolean true if OK, false if KO + * @param string $database Name of database + * @return boolean true if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { + // phpcs:enable dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); - return $this->db->select_db($database); + return $this->db->select_db($database); } @@ -286,44 +287,47 @@ class DoliDBMysqli extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * * @param mysqli_result $resultset Curseur de la requete voulue * @return object|null Object result line or null if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_object($resultset)) { $resultset=$this->_results; } return $resultset->fetch_object(); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param mysqli_result $resultset Resultset of request * @return array|null Array or null if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } return $resultset->fetch_array(); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param mysqli_result $resultset Resultset of request * @return array|null|0 Array or null if KO or end of cursor or 0 if resultset is bool */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_bool($resultset)) { @@ -337,6 +341,7 @@ class DoliDBMysqli extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of lines for result of a SELECT * @@ -344,14 +349,15 @@ class DoliDBMysqli extends DoliDB * @return int Nb of lines * @see affected_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } return $resultset->num_rows; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * @@ -359,9 +365,9 @@ class DoliDBMysqli extends DoliDB * @return int Nombre de lignes * @see num_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } // mysql necessite un link de base pour cette fonction contrairement @@ -462,6 +468,7 @@ class DoliDBMysqli extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get last ID after an insert INSERT * @@ -469,9 +476,9 @@ class DoliDBMysqli extends DoliDB * @param string $fieldid Field name * @return int|string Id of row */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { + // phpcs:enable return $this->db->insert_id; } @@ -545,14 +552,15 @@ class DoliDBMysqli extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return connexion ID * * @return string Id connexion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { + // phpcs:enable $resql=$this->query('SELECT CONNECTION_ID()'); if ($resql) { @@ -562,8 +570,9 @@ class DoliDBMysqli extends DoliDB else return '?'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Create a new database + * Create a new database * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated * We force to create database with charset this->forcecharset and collate this->forcecollate * @@ -573,9 +582,9 @@ class DoliDBMysqli extends DoliDB * @param string $owner Username of database owner * @return bool|mysqli_result resource defined if OK, null if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { + // phpcs:enable if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->forcecollate; @@ -595,6 +604,7 @@ class DoliDBMysqli extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List tables into a database * @@ -602,9 +612,9 @@ class DoliDBMysqli extends DoliDB * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') { + // phpcs:enable $listtables=array(); $like = ''; @@ -622,15 +632,16 @@ class DoliDBMysqli extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List information of columns into a table. * * @param string $table Name of table * @return array Tableau des informations des champs de la table */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { + // phpcs:enable $infotables=array(); $sql="SHOW FULL COLUMNS FROM ".$table.";"; @@ -647,6 +658,7 @@ class DoliDBMysqli extends DoliDB return $infotables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a table into database * @@ -659,9 +671,9 @@ class DoliDBMysqli extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // phpcs:enable // FIXME: $fulltext_keys parameter is unused // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra @@ -730,16 +742,17 @@ class DoliDBMysqli extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Drop a table into database + * Drop a table into database * * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { - $sql = "DROP TABLE ".$table; + // phpcs:enable + $sql = "DROP TABLE ".$table; if (! $this->query($sql)) return -1; @@ -747,6 +760,7 @@ class DoliDBMysqli extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a pointer of line with description of a table or field * @@ -754,9 +768,9 @@ class DoliDBMysqli extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return bool|mysqli_result Resultset x (x->Field, x->Type, ...) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { + // phpcs:enable $sql="DESC ".$table." ".$field; dol_syslog(get_class($this)."::DDLDescTable ".$sql,LOG_DEBUG); @@ -764,6 +778,7 @@ class DoliDBMysqli extends DoliDB return $this->_results; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new field into table * @@ -773,9 +788,9 @@ class DoliDBMysqli extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { + // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; @@ -815,6 +830,7 @@ class DoliDBMysqli extends DoliDB return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update format of a field into a table * @@ -823,9 +839,9 @@ class DoliDBMysqli extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { + // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { @@ -861,6 +877,7 @@ class DoliDBMysqli extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a field from table * @@ -868,19 +885,20 @@ class DoliDBMysqli extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { + // phpcs:enable $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; dol_syslog(get_class($this)."::DDLDropField ".$sql,LOG_DEBUG); if ($this->query($sql)) { return 1; } - $this->error=$this->lasterror(); - return -1; + $this->error=$this->lasterror(); + return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user and privileges to connect to database (even if database does not exists yet) * @@ -890,9 +908,9 @@ class DoliDBMysqli extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { + // phpcs:enable $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql=$this->query($sql); diff --git a/htdocs/core/modules/dons/modules_don.php b/htdocs/core/modules/dons/modules_don.php index 07bb84ef5d6..d8fbe92c2c7 100644 --- a/htdocs/core/modules/dons/modules_don.php +++ b/htdocs/core/modules/dons/modules_don.php @@ -39,16 +39,17 @@ abstract class ModeleDon extends CommonDocGenerator */ public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * - * @param DoliDB $db Database handler - * @param integer $maxfilenamelength Max length of value to show + * @param DoliDB $db Database handler + * @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='donation'; diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index a0f8f0df543..c3dfc84f94c 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -149,6 +149,7 @@ class ExportCsv extends ModeleExports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Open output file * @@ -156,9 +157,9 @@ class ExportCsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function open_file($file,$outputlangs) { + // phpcs:enable global $langs; dol_syslog("ExportCsv::open_file file=".$file); @@ -177,19 +178,21 @@ class ExportCsv extends ModeleExports return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output header into file * * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { + // phpcs:enable return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output title line into file * @@ -199,9 +202,9 @@ class ExportCsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { + // phpcs:enable global $conf; if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) @@ -225,7 +228,8 @@ class ExportCsv extends ModeleExports } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Output record line into file * * @param array $array_selected_sorted Array with list of field to export @@ -234,9 +238,9 @@ class ExportCsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { + // phpcs:enable global $conf; if (! empty($conf->global->EXPORT_CSV_FORCE_CHARSET)) @@ -278,26 +282,28 @@ class ExportCsv extends ModeleExports return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output footer into file * * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { + // phpcs:enable return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close file handle * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { + // phpcs:enable fclose($this->handle); return 0; } diff --git a/htdocs/core/modules/holiday/modules_holiday.php b/htdocs/core/modules/holiday/modules_holiday.php index 160c84b84db..07234c447e6 100644 --- a/htdocs/core/modules/holiday/modules_holiday.php +++ b/htdocs/core/modules/holiday/modules_holiday.php @@ -44,16 +44,17 @@ abstract class ModelePDFHoliday extends CommonDocGenerator public $error=''; - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @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 = 'holiday'; diff --git a/htdocs/core/modules/livraison/modules_livraison.php b/htdocs/core/modules/livraison/modules_livraison.php index ab38adb46af..f9f7a5380f3 100644 --- a/htdocs/core/modules/livraison/modules_livraison.php +++ b/htdocs/core/modules/livraison/modules_livraison.php @@ -41,6 +41,7 @@ abstract class ModelePDFDeliveryOrder extends CommonDocGenerator */ public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -48,9 +49,9 @@ abstract class ModelePDFDeliveryOrder 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='delivery'; diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 3a6484f37bb..4f6f3c4ecdb 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -29,12 +29,12 @@ class mailing_thirdparties_services_expired extends MailingTargets var $require_module=array('contrat'); var $picto='company'; - + /** * @var DoliDB Database handler. */ public $db; - + var $arrayofproducts=array(); @@ -78,6 +78,7 @@ class mailing_thirdparties_services_expired extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -85,9 +86,9 @@ class mailing_thirdparties_services_expired extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @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(); // ----- Your code start here ----- diff --git a/htdocs/core/modules/project/modules_project.php b/htdocs/core/modules/project/modules_project.php index 3053230a6a9..e6a688e97e8 100644 --- a/htdocs/core/modules/project/modules_project.php +++ b/htdocs/core/modules/project/modules_project.php @@ -37,16 +37,17 @@ abstract class ModelePDFProjects extends CommonDocGenerator public $error=''; - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return list of active generation modules * * @param DoliDB $db Database handler * @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='project'; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index 1f0593e3083..60612e90259 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -143,6 +143,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la reference de commande suivante non utilisee * @@ -150,9 +151,9 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders * @param Object $object Object * @return string Texte descripif */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc=0,$object='') { + // phpcs:enable return $this->getNextValue($objsoc,$object); } } diff --git a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php index 12d7f2c9391..4823e109658 100644 --- a/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/pdf/pdf_muscadet.modules.php @@ -196,6 +196,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build pdf onto disk * @@ -207,9 +208,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs='',$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$hookmanager,$mysoc,$nblignes; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -705,6 +706,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show payments table * @@ -714,12 +716,13 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Object langs for output * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_versements(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -729,9 +732,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Langs object * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -784,6 +787,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders return $posy; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show total to pay * @@ -794,9 +798,9 @@ class pdf_muscadet extends ModelePDFSuppliersOrders * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); diff --git a/htdocs/core/modules/user/modules_user.class.php b/htdocs/core/modules/user/modules_user.class.php index 8ba2b638c38..e7f071f01fd 100644 --- a/htdocs/core/modules/user/modules_user.class.php +++ b/htdocs/core/modules/user/modules_user.class.php @@ -44,6 +44,7 @@ abstract class ModelePDFUser extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -51,9 +52,9 @@ abstract class ModelePDFUser 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='user'; From 7799774ca1a8ad287bbce9648e1e8d2bab362867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 22:52:55 +0200 Subject: [PATCH 25/49] move phpcs:ignore --- htdocs/compta/bank/class/account.class.php | 21 ++-- htdocs/core/class/html.formfile.class.php | 12 ++- .../class/html.formsocialcontrib.class.php | 9 +- htdocs/core/class/rssparser.class.php | 18 ++-- htdocs/core/db/sqlite3.class.php | 84 +++++++++------ .../core/modules/bank/doc/pdf_ban.modules.php | 3 +- .../contract/doc/pdf_strato.modules.php | 5 +- .../modules/contract/mod_contract_serpis.php | 5 +- .../expedition/doc/pdf_rouget.modules.php | 12 ++- .../doc/pdf_standard.modules.php | 5 +- .../modules/mailings/thirdparties.modules.php | 101 +++++++++--------- .../core/modules/payment/mod_payment_ant.php | 3 +- .../product/mod_codeproduct_elephant.php | 6 +- .../stock/doc/pdf_standard.modules.php | 3 +- .../core/modules/stock/modules_movement.php | 3 +- htdocs/core/modules/stock/modules_stock.php | 5 +- 16 files changed, 173 insertions(+), 122 deletions(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 515f0d1170f..d55b0f10253 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -294,6 +294,7 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a link between bank line record and its source * @@ -304,9 +305,9 @@ class Account extends CommonObject * @param string $type Type of link ('payment', 'company', 'member', ...) * @return int <0 if KO, id line if OK */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_url_line($line_id, $url_id, $url, $label, $type) { + // phpcs:enable $sql = "INSERT INTO ".MAIN_DB_PREFIX."bank_url ("; $sql.= "fk_bank"; $sql.= ", url_id"; @@ -334,6 +335,7 @@ class Account extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * TODO Move this into AccountLine * Return array with links from llx_bank_url @@ -343,9 +345,9 @@ class Account extends CommonObject * @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:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_url($fk_bank='', $url_id='', $type='') { + // phpcs:enable $lines = array(); // Check parameters @@ -784,15 +786,16 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update BBAN (RIB) account fields * * @param User $user Object user making update * @return int <0 if KO, >0 if OK */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_bban(User $user = null) { + // phpcs:enable global $conf,$langs; // Clean parameters @@ -1071,6 +1074,7 @@ class Account extends CommonObject return $this->LibStatut($this->clos,$mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return label of given object status * @@ -1078,9 +1082,9 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function LibStatut($statut, $mode = 0) { + // phpcs:enable global $langs; $langs->load('banks'); @@ -1109,14 +1113,15 @@ class Account extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un compte peut etre supprimer ou non (sans mouvements) * * @return boolean vrai si peut etre supprime, faux sinon */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function can_be_deleted() { + // phpcs:enable $can_be_deleted=false; $sql = "SELECT COUNT(rowid) as nb"; @@ -1177,6 +1182,7 @@ class Account extends CommonObject return $solde; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Load indicators for dashboard (this->nbtodo and this->nbtodolate) * @@ -1184,9 +1190,9 @@ class Account extends CommonObject * @param int $filteraccountid To get info for a particular account id * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_board(User $user, $filteraccountid = 0) { + // phpcs:enable global $conf, $langs; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe @@ -1233,14 +1239,15 @@ class Account extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * @param int $filteraccountid To get info for a particular account id * @return int <0 if ko, >0 if ok */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board($filteraccountid = 0) { + // phpcs:enable global $user; if ($user->societe_id) return -1; // protection pour eviter appel par utilisateur externe diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index aea6acd6661..c1bc479fc73 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -58,6 +58,7 @@ class FormFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form to upload a new file. * @@ -77,9 +78,9 @@ class FormFile * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='', $sectiondir='') { + // phpcs:enable global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); @@ -231,6 +232,7 @@ class FormFile } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show the box with list of available documents for object * @@ -253,9 +255,9 @@ class FormFile * @return int <0 if KO, number of shown files if OK * @deprecated Use print xxx->showdocuments() instead. */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') { + // phpcs:enable $this->numoffiles=0; print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$notused,$noform,$param,$title,$buttonlabel,$codelang); return $this->numoffiles; @@ -981,6 +983,7 @@ class FormFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show list of documents in $filearray (may be they are all in same directory but may not) * This also sync database if $upload_dir is defined. @@ -1010,9 +1013,9 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_autoecmfiles */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0) { + // phpcs:enable global $user, $conf, $langs, $hookmanager; global $sortfield, $sortorder, $maxheightmini; global $dolibarr_main_url_root; @@ -1379,6 +1382,7 @@ class FormFile } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show list of documents in a directory * @@ -1397,9 +1401,9 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_documents */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0) { + // phpcs:enable global $user, $conf, $langs, $form; global $sortfield, $sortorder; global $search_doc_ref; diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index 653fe4b74b6..99e36878390 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -31,7 +31,7 @@ class FormSocialContrib * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -48,9 +48,10 @@ class FormSocialContrib $this->db = $db; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return list of social contributions. - * Use mysoc->country_id or mysoc->country_code so they must be defined. + * Return list of social contributions. + * Use mysoc->country_id or mysoc->country_code so they must be defined. * * @param string $selected Preselected type * @param string $htmlname Name of field in form @@ -60,9 +61,9 @@ class FormSocialContrib * @param string $morecss Add more CSS on select * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_type_socialcontrib($selected='',$htmlname='actioncode', $useempty=0, $maxlen=40, $help=1, $morecss='minwidth300') { + // phpcs:enable global $conf,$db,$langs,$user,$mysoc; if (empty($mysoc->country_id) && empty($mysoc->country_code)) diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index 9b6dc2eee7d..23e888de0fc 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -30,7 +30,7 @@ class RssParser * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -461,6 +461,7 @@ class RssParser + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Triggered when opened tag is found * @@ -469,9 +470,9 @@ class RssParser * @param array $attrs Attributes of tags * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_start_element($p, $element, &$attrs) { + // phpcs:enable $el = $element = strtolower($element); $attrs = array_change_key_case($attrs, CASE_LOWER); @@ -582,6 +583,7 @@ class RssParser } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Triggered when CDATA is found * @@ -589,9 +591,9 @@ class RssParser * @param string $text Tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_cdata($p, $text) { + // phpcs:enable if ($this->_format == 'atom' and $this->incontent) { $this->append_content($text); @@ -603,6 +605,7 @@ class RssParser } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Triggered when closed tag is found * @@ -610,9 +613,9 @@ class RssParser * @param string $el Tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function feed_end_element($p, $el) { + // phpcs:enable $el = strtolower($el); if ($el == 'item' or $el == 'entry') @@ -673,15 +676,16 @@ class RssParser $str1 .= $str2; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Enter description here ... * * @param string $text Text * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function append_content($text) { + // phpcs:enable if ( $this->initem ) { $this->concat($this->current_item[ $this->incontent ], $text); } @@ -759,7 +763,7 @@ function xml2php($xml) } //Let see if the new child is not in the array - if($tab==false && in_array($key,array_keys($array))) + if ($tab==false && in_array($key,array_keys($array))) { //If this element is already in the array we will create an indexed array $tmp = $array[$key]; @@ -783,7 +787,7 @@ function xml2php($xml) } - if($fils==0) + if ($fils==0) { return (string) $xml; } diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index b62a6b2474f..6babfd881d4 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -296,17 +296,18 @@ class DoliDBSqlite3 extends DoliDB return $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Select a database * * @param string $database Name of database * @return boolean true if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { + // phpcs:enable dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); - // sqlite_select_db() does not exist + // sqlite_select_db() does not exist //return sqlite_select_db($this->db,$database); return true; } @@ -491,15 +492,16 @@ class DoliDBSqlite3 extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * * @param SQLite3Result $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_object($resultset)) { $resultset=$this->_results; } //return $resultset->fetch(PDO::FETCH_OBJ); @@ -511,15 +513,16 @@ class DoliDBSqlite3 extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param SQLite3Result $resultset Resultset of request * @return false|array Array or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } //return $resultset->fetch(PDO::FETCH_ASSOC); @@ -527,15 +530,16 @@ class DoliDBSqlite3 extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param SQLite3Result $resultset Resultset of request * @return false|array Array or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_bool($resultset)) { @@ -549,6 +553,7 @@ class DoliDBSqlite3 extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of lines for result of a SELECT * @@ -556,10 +561,10 @@ class DoliDBSqlite3 extends DoliDB * @return int Nb of lines * @see affected_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { - // FIXME: SQLite3Result does not have a queryString member + // phpcs:enable + // FIXME: SQLite3Result does not have a queryString member // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } @@ -569,6 +574,7 @@ class DoliDBSqlite3 extends DoliDB return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of lines for result of a SELECT * @@ -576,10 +582,10 @@ class DoliDBSqlite3 extends DoliDB * @return int Nb of lines * @see affected_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { - // FIXME: SQLite3Result does not have a queryString member + // phpcs:enable + // FIXME: SQLite3Result does not have a queryString member // If resultset not provided, we take the last used by connexion if (! is_object($resultset)) { $resultset=$this->_results; } @@ -698,6 +704,7 @@ class DoliDBSqlite3 extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get last ID after an insert INSERT * @@ -705,9 +712,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $fieldid Field name * @return int Id of row */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { + // phpcs:enable return $this->db->lastInsertRowId(); } @@ -780,18 +787,20 @@ class DoliDBSqlite3 extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return connexion ID * * @return string Id connexion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { + // phpcs:enable return '?'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new database * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated @@ -803,9 +812,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $owner Username of database owner * @return SQLite3Result resource defined if OK, null if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { + // phpcs:enable if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->forcecollate; @@ -825,6 +834,7 @@ class DoliDBSqlite3 extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List tables into a database * @@ -832,9 +842,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') { + // phpcs:enable $listtables=array(); $like = ''; @@ -852,16 +862,17 @@ class DoliDBSqlite3 extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * List information of columns into a table. + * List information of columns into a table. * * @param string $table Name of table * @return array Tableau des informations des champs de la table * TODO modify for sqlite */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { + // phpcs:enable $infotables=array(); $sql="SHOW FULL COLUMNS FROM ".$table.";"; @@ -878,6 +889,7 @@ class DoliDBSqlite3 extends DoliDB return $infotables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a table into database * @@ -890,10 +902,10 @@ class DoliDBSqlite3 extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { - // FIXME: $fulltext_keys parameter is unused + // phpcs:enable + // FIXME: $fulltext_keys parameter is unused // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra // ex. : $fields['rowid'] = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); @@ -957,15 +969,16 @@ class DoliDBSqlite3 extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a table into database * * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { + // phpcs:enable $sql = "DROP TABLE ".$table; if (! $this->query($sql)) @@ -974,6 +987,7 @@ class DoliDBSqlite3 extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a pointer of line with description of a table or field * @@ -981,9 +995,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return SQLite3Result Resource */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { + // phpcs:enable $sql="DESC ".$table." ".$field; dol_syslog(get_class($this)."::DDLDescTable ".$sql,LOG_DEBUG); @@ -991,6 +1005,7 @@ class DoliDBSqlite3 extends DoliDB return $this->_results; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new field into table * @@ -1000,9 +1015,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { + // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; @@ -1035,6 +1050,7 @@ class DoliDBSqlite3 extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update format of a field into a table * @@ -1043,9 +1059,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { + // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { @@ -1058,6 +1074,7 @@ class DoliDBSqlite3 extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a field from table * @@ -1065,9 +1082,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { + // phpcs:enable $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; dol_syslog(get_class($this)."::DDLDropField ".$sql,LOG_DEBUG); if (! $this->query($sql)) @@ -1079,8 +1096,9 @@ class DoliDBSqlite3 extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Create a user and privileges to connect to database (even if database does not exists yet) + * Create a user and privileges to connect to database (even if database does not exists yet) * * @param string $dolibarr_main_db_host Ip serveur * @param string $dolibarr_main_db_user Nom user a creer @@ -1088,9 +1106,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { + // phpcs:enable $sql = "INSERT INTO user "; $sql.= "(Host,User,password,Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv,Index_Priv,Alter_priv,Lock_tables_priv)"; $sql.= " VALUES ('".$this->escape($dolibarr_main_db_host)."','".$this->escape($dolibarr_main_db_user)."',password('".addslashes($dolibarr_main_db_pass)."')"; @@ -1312,6 +1330,7 @@ class DoliDBSqlite3 extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * calc_daynr * @@ -1320,9 +1339,9 @@ class DoliDBSqlite3 extends DoliDB * @param int $day Day * @return int Formatted date */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_daynr($year, $month, $day) { + // phpcs:enable $y = $year; if ($y == 0 && $month == 0) return 0; $num = (365* $y + 31 * ($month - 1) + $day); @@ -1335,6 +1354,7 @@ class DoliDBSqlite3 extends DoliDB return $num + floor($y / 4) - $temp; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * calc_weekday * @@ -1342,25 +1362,27 @@ class DoliDBSqlite3 extends DoliDB * @param bool $sunday_first_day_of_week ??? * @return int */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_weekday($daynr, $sunday_first_day_of_week) { - $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); - return $ret; + // phpcs:enable + $ret = floor(($daynr + 5 + ($sunday_first_day_of_week ? 1 : 0)) % 7); + return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * calc_days_in_year * * @param string $year Year * @return int Nb of days in year */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_days_in_year($year) { - return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365); + // phpcs:enable + return (($year & 3) == 0 && ($year%100 || ($year%400 == 0 && $year)) ? 366 : 365); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * calc_week * @@ -1371,9 +1393,9 @@ class DoliDBSqlite3 extends DoliDB * @param string $calc_year ??? * @return string ??? */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private static function calc_week($year, $month, $day, $week_behaviour, &$calc_year) { + // phpcs:enable $daynr=self::calc_daynr($year,$month,$day); $first_daynr=self::calc_daynr($year,1,1); $monday_first= ($week_behaviour & self::WEEK_MONDAY_FIRST) ? 1 : 0; diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 9143d87ea73..6ecdc3b34dc 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -85,6 +85,7 @@ class pdf_ban extends ModeleBankAccountDoc } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction generant le projet sur le disque * @@ -92,9 +93,9 @@ class pdf_ban extends ModeleBankAccountDoc * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { + // phpcs:enable global $conf, $hookmanager, $langs, $user; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 843d6df8afe..c7c393c96e3 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -159,7 +159,8 @@ class pdf_strato extends ModelePDFContract $this->posxdesc=$this->marge_gauche+1; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Function to build pdf onto disk * * @param CommonObject $object Id of object to generate @@ -170,9 +171,9 @@ class pdf_strato extends ModelePDFContract * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$hookmanager,$mysoc; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index beeabd6b140..ca7ba32184f 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -135,16 +135,17 @@ class mod_contract_serpis extends ModelNumRefContracts } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next value * * @param Societe $objsoc third party object - * @param Object $objforref contract object + * @param Object $objforref contract object * @return string Value if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contract_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 65866306f06..8086667a4f5 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -36,17 +36,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_rouget extends ModelePdfExpedition { - /** + /** * @var DoliDb Database handler */ public $db; - /** + /** * @var string model name */ public $name; - /** + /** * @var string model description (short text) */ public $description; @@ -173,6 +173,7 @@ class pdf_rouget extends ModelePdfExpedition } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build pdf onto disk * @@ -184,9 +185,9 @@ class pdf_rouget extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$conf,$langs,$hookmanager; $object->fetch_thirdparty(); @@ -652,6 +653,7 @@ class pdf_rouget extends ModelePdfExpedition } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show total to pay * @@ -662,9 +664,9 @@ class pdf_rouget extends ModelePdfExpedition * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $sign=1; diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 43c76a2c497..ec06221e5de 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -190,7 +190,8 @@ class pdf_standard extends ModeleExpenseReport } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Function to build pdf onto disk * * @param Object $object Object to generate @@ -201,9 +202,9 @@ class pdf_standard extends ModeleExpenseReport * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 7a0744e7c65..ad19264620a 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -31,7 +31,7 @@ class mailing_thirdparties extends MailingTargets var $require_module=array("societe"); // This module allows to select by categories must be also enabled if category module is not activated var $picto='company'; - + /** * @var DoliDB Database handler. */ @@ -52,6 +52,7 @@ class mailing_thirdparties extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -59,9 +60,9 @@ class mailing_thirdparties extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @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()) + function add_to_target($mailing_id, $filtersarray=array()) { + // phpcs:enable global $conf, $langs; $cibles = array(); @@ -96,53 +97,53 @@ class mailing_thirdparties extends MailingTargets $sql.= " AND c.rowid='".$this->db->escape($_POST['filter'])."'"; } - $addDescription= ""; - if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') - { - $sql.= " AND s.client=" . $_POST["filter_client"]; - $addDescription= $langs->trans('ProspectCustomer')."="; - if ($_POST["filter_client"] == 0) - { - $addDescription.= $langs->trans('NorProspectNorCustomer'); - } - else if ($_POST["filter_client"] == 1) - { - $addDescription.= $langs->trans('Customer'); - } - else if ($_POST["filter_client"] == 2) - { - $addDescription.= $langs->trans('Prospect'); - } - else if ($_POST["filter_client"] == 3) - { - $addDescription.= $langs->trans('ProspectCustomer'); - } - else - { - $addDescription.= "Unknown status ".$_POST["filter_client"]; - } - } - if (isset($_POST["filter_status"])) - { - if (strlen($addDescription) > 0) - { - $addDescription.= ";"; - } - $addDescription.= $langs->trans("Status")."="; - if ($_POST["filter_status"] == '1') - { - $sql.= " AND s.status=1"; - $addDescription.= $langs->trans("Enabled"); - } - else - { - $sql.= " AND s.status=0"; - $addDescription.= $langs->trans("Disabled"); - } - } - $sql.= " ORDER BY email"; + $addDescription= ""; + if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') + { + $sql.= " AND s.client=" . $_POST["filter_client"]; + $addDescription= $langs->trans('ProspectCustomer')."="; + if ($_POST["filter_client"] == 0) + { + $addDescription.= $langs->trans('NorProspectNorCustomer'); + } + elseif ($_POST["filter_client"] == 1) + { + $addDescription.= $langs->trans('Customer'); + } + elseif ($_POST["filter_client"] == 2) + { + $addDescription.= $langs->trans('Prospect'); + } + elseif ($_POST["filter_client"] == 3) + { + $addDescription.= $langs->trans('ProspectCustomer'); + } + else + { + $addDescription.= "Unknown status ".$_POST["filter_client"]; + } + } + if (isset($_POST["filter_status"])) + { + if (strlen($addDescription) > 0) + { + $addDescription.= ";"; + } + $addDescription.= $langs->trans("Status")."="; + if ($_POST["filter_status"] == '1') + { + $sql.= " AND s.status=1"; + $addDescription.= $langs->trans("Enabled"); + } + else + { + $sql.= " AND s.status=0"; + $addDescription.= $langs->trans("Disabled"); + } + } + $sql.= " ORDER BY email"; - // Stock recipients emails into targets table + // Stock recipients emails into targets table $result=$this->db->query($sql); if ($result) { @@ -313,7 +314,7 @@ class mailing_thirdparties extends MailingTargets } - /** + /** * Can include an URL link on each record provided by selector shown on target page. * * @param int $id ID diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 1bd19c5e43c..d059f0ccebc 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -124,6 +124,7 @@ class mod_payment_ant extends ModeleNumRefPayments } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -131,9 +132,9 @@ class mod_payment_ant extends ModeleNumRefPayments * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 3f8796927d9..f55595a63d5 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -198,14 +198,15 @@ class mod_codeproduct_elephant extends ModeleProductCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check if mask/numbering use prefix * * @return int 0 or 1 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { + // phpcs:enable global $conf; $mask = $conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; @@ -274,6 +275,7 @@ class mod_codeproduct_elephant extends ModeleProductCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un code est pris ou non (par autre tiers) * @@ -282,9 +284,9 @@ class mod_codeproduct_elephant extends ModeleProductCode * @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 ref FROM ".MAIN_DB_PREFIX."product"; $sql.= " WHERE ref = '".$code."'"; if ($product->id > 0) $sql.= " AND rowid <> ".$product->id; diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index a9a55e75cfc..66799612d8f 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -146,6 +146,7 @@ class pdf_standard extends ModelePDFStock } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -157,9 +158,9 @@ class pdf_standard extends ModelePDFStock * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/stock/modules_movement.php b/htdocs/core/modules/stock/modules_movement.php index e6a3f0dcf03..33672e415ea 100644 --- a/htdocs/core/modules/stock/modules_movement.php +++ b/htdocs/core/modules/stock/modules_movement.php @@ -36,6 +36,7 @@ abstract class ModelePDFMovement extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -43,9 +44,9 @@ abstract class ModelePDFMovement 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='mouvement'; diff --git a/htdocs/core/modules/stock/modules_stock.php b/htdocs/core/modules/stock/modules_stock.php index 914facb4ed0..a74df6198ce 100644 --- a/htdocs/core/modules/stock/modules_stock.php +++ b/htdocs/core/modules/stock/modules_stock.php @@ -29,16 +29,17 @@ abstract class ModelePDFStock extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @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='stock'; From ecc6c118a6f78da1fa4881fc540ae1cbcf24b2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 4 Sep 2018 23:26:37 +0200 Subject: [PATCH 26/49] move phpcs:ignore --- htdocs/core/class/dolgraph.class.php | 3 +- htdocs/core/class/html.formbarcode.class.php | 18 +++--- htdocs/core/db/mssql.class.php | 62 ++++++++++++------- .../core/modules/mailings/fraise.modules.php | 9 +-- .../doc/doc_generic_project_odt.modules.php | 27 +++++--- .../project/doc/pdf_beluga.modules.php | 3 +- .../modules/project/task/modules_task.php | 3 +- 7 files changed, 80 insertions(+), 45 deletions(-) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index f3d6041515c..28ab38bf56d 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -682,6 +682,7 @@ class DolGraph } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build a graph onto disk using Artichow library and return img string to it * @@ -689,9 +690,9 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return void */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps private function draw_artichow($file,$fileurl) { + // phpcs:enable global $artichow_defaultfont; dol_syslog(get_class($this)."::draw_artichow this->type=".join(',',$this->type)); diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 6780f01735a..bcc6e2646fc 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -32,17 +32,17 @@ class FormBarCode * @var DoliDB Database handler. */ public $db; - + /** - * @var string Error code (or message) - */ - public $error=''; + * @var string Error code (or message) + */ + public $error=''; /** - * Constructor + * Constructor * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler */ function __construct($db) { @@ -103,6 +103,7 @@ class FormBarCode return $select_encoder; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return form to select type of barcode * @@ -111,9 +112,9 @@ class FormBarCode * @param int $useempty Affiche valeur vide dans liste * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_barcode_type($selected='',$htmlname='barcodetype_id',$useempty=0) { + // phpcs:enable global $langs,$conf; $sql = "SELECT rowid, code, libelle"; @@ -163,6 +164,7 @@ class FormBarCode } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form to select type of barcode * @@ -171,9 +173,9 @@ class FormBarCode * @param string $htmlname Nom du formulaire select * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_barcode_type($page, $selected='', $htmlname='barcodetype_id') { + // phpcs:enable global $langs,$conf; if ($htmlname != "none") { diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 9561747caf3..dd1553ec12f 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -139,15 +139,16 @@ class DoliDBMssql extends DoliDB return $line; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Select a database * * @param string $database Name of database * @return boolean true if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { + // phpcs:enable return @mssql_select_db($database, $this->db); } @@ -460,49 +461,53 @@ class DoliDBMssql extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * * @param resource $resultset Curseur de la requete voulue * @return object|false Object result line or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return mssql_fetch_object($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param resource $resultset Resultset of request * @return array|false Array or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return mssql_fetch_array($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param resource $resultset Resultset of request * @return array|false Array or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return @mssql_fetch_row($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of lines for result of a SELECT * @@ -510,14 +515,15 @@ class DoliDBMssql extends DoliDB * @return int Nb of lines * @see affected_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function num_rows($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return mssql_num_rows($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * @@ -525,9 +531,9 @@ class DoliDBMssql extends DoliDB * @return int Nombre de lignes * @see num_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } // mssql necessite un link de base pour cette fonction contrairement @@ -645,6 +651,7 @@ class DoliDBMssql extends DoliDB } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get last ID after an insert INSERT * @@ -652,9 +659,9 @@ class DoliDBMssql extends DoliDB * @param string $fieldid Field name * @return int Id of row or -1 on error */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { + // phpcs:enable $res = $this->query("SELECT @@IDENTITY as id"); if ($res && $data = $this->fetch_array($res)) { @@ -709,14 +716,15 @@ class DoliDBMssql extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return connexion ID * * @return string Id connexion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { + // phpcs:enable $resql=$this->query('SELECT CONNECTION_ID()'); if ($resql) { @@ -726,6 +734,7 @@ class DoliDBMssql extends DoliDB else return '?'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new database * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated @@ -737,9 +746,9 @@ class DoliDBMssql extends DoliDB * @param string $owner Username of database owner * @return false|resource|true resource defined if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { + // phpcs:enable /*if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->forcecollate; */ @@ -763,6 +772,7 @@ class DoliDBMssql extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List tables into a database * @@ -770,22 +780,23 @@ class DoliDBMssql extends DoliDB * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database,$table='') { + // phpcs:enable $this->_results = mssql_list_tables($database, $this->db); return $this->_results; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List information of columns into a table. * * @param string $table Name of table * @return array Tableau des informations des champs de la table */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { + // phpcs:enable // FIXME: Dummy method // TODO: Implement @@ -795,6 +806,7 @@ class DoliDBMssql extends DoliDB return $infotables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a table into database * @@ -807,9 +819,9 @@ class DoliDBMssql extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // phpcs:enable // FIXME: $fulltext_keys parameter is unused // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra @@ -875,15 +887,16 @@ class DoliDBMssql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a table into database * * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { + // phpcs:enable $sql = "DROP TABLE ".$table; if (! $this->query($sql)) @@ -892,6 +905,7 @@ class DoliDBMssql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a pointer of line with description of a table or field * @@ -899,9 +913,9 @@ class DoliDBMssql extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return false|resource|true Resource */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { + // phpcs:enable $sql="DESC ".$table." ".$field; dol_syslog($sql); @@ -909,6 +923,7 @@ class DoliDBMssql extends DoliDB return $this->_results; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new field into table * @@ -918,9 +933,9 @@ class DoliDBMssql extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { + // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; @@ -946,6 +961,7 @@ class DoliDBMssql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update format of a field into a table * @@ -954,9 +970,9 @@ class DoliDBMssql extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { + // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { @@ -970,6 +986,7 @@ class DoliDBMssql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a field from table * @@ -977,9 +994,9 @@ class DoliDBMssql extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { + // phpcs:enable $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; dol_syslog($sql,LOG_DEBUG); if (! $this->query($sql)) @@ -990,6 +1007,7 @@ class DoliDBMssql extends DoliDB else return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user and privileges to connect to database (even if database does not exists yet) * @@ -999,10 +1017,10 @@ class DoliDBMssql extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { - $sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'"; + // phpcs:enable + $sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'"; dol_syslog(get_class($this)."::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log $resql=$this->query($sql); if (! $resql) @@ -1150,19 +1168,21 @@ class DoliDBMssql extends DoliDB return array(); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Escape a field name according to escape's syntax * * @param string $fieldname Field's name to escape * @return string field's name escaped */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function EscapeFieldName($fieldname) { + // phpcs:enable return "[".$fieldname."]"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get information on field * @@ -1170,9 +1190,9 @@ class DoliDBMssql extends DoliDB * @param mixed $fields String for one field or array of string for multiple field * @return false|object */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function GetFieldInformation($table,$fields) { + // phpcs:enable $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; if (is_array($fields)) { diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index ab0cca6e0d4..817de256a1d 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -53,7 +53,7 @@ class mailing_fraise extends MailingTargets */ function __construct($db) { - $this->db=$db; + $this->db = $db; } @@ -219,6 +219,7 @@ class mailing_fraise extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -226,9 +227,9 @@ class mailing_fraise extends MailingTargets * @param array $filtersarray Param to filter sql request. Deprecated. Should use $_POST instead. * @return int < 0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable // Deprecation warning if ($filtersarray) { dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING); @@ -269,8 +270,8 @@ class mailing_fraise extends MailingTargets // Filter on type if ($_POST['filter_type']) $sql.= " AND ta.rowid='".$_POST['filter_type']."'"; // Filter on category - if ($_POST['filter_category']) $sql.= " AND c.rowid='".$_POST['filter_category']."'"; - $sql.= " ORDER BY a.email"; + if ($_POST['filter_category']) $sql.= " AND c.rowid='".$_POST['filter_category']."'"; + $sql.= " ORDER BY a.email"; //print $sql; // Add targets into table diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index c86f0186811..219b3821ce3 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -103,6 +103,7 @@ class doc_generic_project_odt extends ModelePDFProjects } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -111,9 +112,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param string $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; $resarray=array( @@ -141,6 +142,7 @@ class doc_generic_project_odt extends ModelePDFProjects return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -148,9 +150,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasks($task,$outputlangs) { + // phpcs:enable global $conf; $resarray = array( @@ -181,6 +183,7 @@ class doc_generic_project_odt extends ModelePDFProjects return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -188,9 +191,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_contacts($contact,$outputlangs) { + // phpcs:enable global $conf; $pc='projcontacts_'; // prefix to avoid typos @@ -238,6 +241,7 @@ class doc_generic_project_odt extends ModelePDFProjects return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -245,9 +249,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_file($file,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -257,6 +261,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -264,9 +269,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_reference($refdetail,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -280,6 +285,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -287,9 +293,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasksressource($taskressource,$outputlangs) { + // phpcs:enable global $conf; //dol_syslog(get_class($this).'::get_substitutionarray_tasksressource taskressource='.var_export($taskressource,true),LOG_DEBUG); return array( @@ -303,6 +309,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -310,9 +317,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_taskstime($tasktime,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -331,6 +338,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -338,9 +346,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_task_file($file,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -440,6 +448,7 @@ class doc_generic_project_odt extends ModelePDFProjects return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -448,9 +457,9 @@ class doc_generic_project_odt extends ModelePDFProjects * @param string $srctemplatepath Full path of source filename for generator using a template file * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index f4542cac67b..d2a678047ab 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -110,6 +110,7 @@ class pdf_beluga extends ModelePDFProjects } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction generant le projet sur le disque * @@ -117,9 +118,9 @@ class pdf_beluga extends ModelePDFProjects * @param Translate $outputlangs Lang output object * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs) { + // phpcs:enable global $conf, $hookmanager, $langs, $user; $formproject=new FormProjets($this->db); diff --git a/htdocs/core/modules/project/task/modules_task.php b/htdocs/core/modules/project/task/modules_task.php index 8857d4fbd81..c9d7aa52bf4 100644 --- a/htdocs/core/modules/project/task/modules_task.php +++ b/htdocs/core/modules/project/task/modules_task.php @@ -38,6 +38,7 @@ abstract class ModelePDFTask extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -45,9 +46,9 @@ abstract class ModelePDFTask 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='project_task'; From f7c3ca9d20ade10cfaa9bd7f670b028041263b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 5 Sep 2018 18:49:06 +0200 Subject: [PATCH 27/49] move phpcs:ignore --- htdocs/core/class/html.formother.class.php | 60 +++++++++------ .../modules/cheque/mod_chequereceipt_mint.php | 3 +- .../cheque/mod_chequereceipt_thyme.php | 3 +- .../doc/doc_generic_order_odt.modules.php | 3 +- .../doc/doc_generic_contract_odt.modules.php | 3 +- .../expedition/mod_expedition_ribera.php | 3 +- .../expedition/mod_expedition_safor.php | 3 +- .../modules/import/import_csv.modules.php | 42 +++++++---- .../modules/mailings/modules_mailings.php | 15 ++-- .../modules/member/doc/pdf_standard.class.php | 6 +- .../doc/pdf_standardlabel.class.php | 26 ++++--- .../doc/doc_generic_product_odt.modules.php | 3 +- .../societe/mod_codeclient_elephant.php | 6 +- ..._generic_supplier_proposal_odt.modules.php | 3 +- .../user/doc/doc_generic_user_odt.modules.php | 6 +- htdocs/projet/class/task.class.php | 75 ++++++++++--------- 16 files changed, 156 insertions(+), 104 deletions(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index ed371cc1e23..93b17669c2c 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -58,6 +58,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML select list of export models * @@ -68,13 +69,13 @@ class FormOther * @param int $fk_user Utilisateur créant le modèle * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null) { + // phpcs:enable $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."export_model"; $sql.= " WHERE type = '".$type."'"; - if(!empty($fk_user))$sql.=" AND fk_user=".$fk_user; + if (!empty($fk_user)) $sql.=" AND fk_user=".$fk_user; $sql.= " ORDER BY rowid"; $result = $this->db->query($sql); if ($result) @@ -110,6 +111,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of export models * @@ -119,9 +121,9 @@ class FormOther * @param int $useempty Affiche valeur vide dans liste * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0) { + // phpcs:enable $sql = "SELECT rowid, label"; $sql.= " FROM ".MAIN_DB_PREFIX."import_model"; $sql.= " WHERE type = '".$type."'"; @@ -160,6 +162,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of ecotaxes with label * @@ -167,9 +170,9 @@ class FormOther * @param string $htmlname Name of combo list * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_ecotaxes($selected='', $htmlname='ecotaxe_id') { + // phpcs:enable global $langs; $sql = "SELECT e.rowid, e.code, e.label, e.price, e.organization,"; @@ -217,6 +220,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of revenue stamp for country * @@ -225,9 +229,9 @@ class FormOther * @param string $country_code Country Code * @return string HTML select list */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='') { + // phpcs:enable global $langs; $out=''; @@ -275,6 +279,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list to select a percent * @@ -287,9 +292,9 @@ class FormOther * @param int $showempty Add also an empty line * @return string HTML select string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0) { + // phpcs:enable $return = ''; if ($useempty) @@ -829,6 +841,7 @@ class FormOther return $select_week; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of month * @@ -839,9 +852,9 @@ class FormOther * @param string $morecss More Css * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_month($selected='', $htmlname='monthid', $useempty=0, $longlabel=0, $morecss='') { + // phpcs:enable global $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -871,6 +884,7 @@ class FormOther return $select_month; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML combo list of years * @@ -885,9 +899,9 @@ class FormOther * @param string $morecss More CSS * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_year($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='', $morecss='valignmiddle widthauto') { + // phpcs:enable print $this->selectyear($selected,$htmlname,$useempty,$min_year,$max_year,$offset,$invert,$option,$morecss); } @@ -944,6 +958,7 @@ class FormOther return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show form to select address * @@ -955,9 +970,9 @@ class FormOther * @param int $originid Id de l'origine * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_address($page, $selected, $socid, $htmlname='address_id', $origin='', $originid='') { + // phpcs:enable global $langs,$conf; global $form; @@ -1206,6 +1221,7 @@ class FormOther } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select list of a dictionary * @@ -1218,9 +1234,9 @@ class FormOther * @param string $moreattrib More attributes on HTML select tag * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_dictionary($htmlname,$dictionarytable,$keyfield='code',$labelfield='label',$selected='',$useempty=0,$moreattrib='') { + // phpcs:enable global $langs, $conf; $langs->load("admin"); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 32e0d373631..b3b6fb96b66 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -138,6 +138,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -145,9 +146,9 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function chequereceipt_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index ec276d52935..caf063da7d4 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -124,6 +124,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -131,9 +132,9 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function chequereceipt_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 166c7f389d1..f7f51302972 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -177,6 +177,7 @@ class doc_generic_order_odt extends ModelePDFCommandes return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -188,9 +189,9 @@ class doc_generic_order_odt extends ModelePDFCommandes * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index b58a67a2cb0..413daf7ba25 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -167,6 +167,7 @@ class doc_generic_contract_odt extends ModelePDFContract return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -178,9 +179,9 @@ class doc_generic_contract_odt extends ModelePDFContract * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/expedition/mod_expedition_ribera.php b/htdocs/core/modules/expedition/mod_expedition_ribera.php index 8865fed7d77..dadde0fd814 100644 --- a/htdocs/core/modules/expedition/mod_expedition_ribera.php +++ b/htdocs/core/modules/expedition/mod_expedition_ribera.php @@ -121,6 +121,7 @@ class mod_expedition_ribera extends ModelNumRefExpedition return $numFinal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -128,9 +129,9 @@ class mod_expedition_ribera extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expedition_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index c74d621f01d..2a20c22a88d 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -133,6 +133,7 @@ class mod_expedition_safor extends ModelNumRefExpedition return $this->prefix.$yymm."-".$num; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -140,9 +141,9 @@ class mod_expedition_safor extends ModelNumRefExpedition * @param Object $objforref Shipment object * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function expedition_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 36a5d3d70ba..2b8d2825f75 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -109,18 +109,20 @@ class ImportCsv extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output header of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header_example($outputlangs) { + // phpcs:enable return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output title line of an example file for this format * @@ -128,13 +130,14 @@ class ImportCsv extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title_example($outputlangs,$headerlinefields) { + // phpcs:enable $s=join($this->separator,array_map('cleansep',$headerlinefields)); return $s."\n"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output record of an example file for this format * @@ -142,36 +145,38 @@ class ImportCsv extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record_example($outputlangs,$contentlinevalues) { + // phpcs:enable $s=join($this->separator,array_map('cleansep',$contentlinevalues)); return $s."\n"; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output footer of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer_example($outputlangs) { + // phpcs:enable return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Open input file * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_open_file($file) { + // phpcs:enable global $langs; $ret=1; @@ -195,39 +200,42 @@ class ImportCsv extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of records. File must be closed. * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_get_nb_of_lines($file) { - return dol_count_nb_of_line($file); + // phpcs:enable + return dol_count_nb_of_line($file); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Input header line from file * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_header() { + // phpcs:enable return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of next record in input file. * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_record() { + // phpcs:enable global $conf; $arrayres=fgetcsv($this->handle,100000,$this->separator,$this->enclosure,$this->escape); @@ -276,19 +284,21 @@ class ImportCsv extends ModeleImports return $newarrayres; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close file handle * * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_close_file() { + // phpcs:enable fclose($this->handle); return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert a record into database * @@ -300,9 +310,9 @@ class ImportCsv extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys) { + // phpcs:enable global $langs,$conf,$user; global $thirdparty_static; // Specific to thirdparty import global $tablewithentity_cache; // Cache to avoid to call desc at each rows on tables @@ -577,9 +587,13 @@ class ImportCsv extends ModeleImports $listfields[] = $fieldname; // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert - if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) $listvalues[] = ($newval=='0'?$newval:"null"); - elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) $listvalues[] = "''"; - else $listvalues[] = "'".$this->db->escape($newval)."'"; + if (empty($newval) && $arrayrecord[($key-1)]['type'] < 0) { + $listvalues[] = ($newval=='0'?$newval:"null"); + } elseif (empty($newval) && $arrayrecord[($key-1)]['type'] == 0) { + $listvalues[] = "''"; + } else { + $listvalues[] = "'".$this->db->escape($newval)."'"; + } } $i++; } diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index 9d1a0458e88..e0316a75390 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -35,12 +35,12 @@ class MailingTargets // This can't be abstract as it is used for some method * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ public $error=''; - + var $tooltip=''; @@ -117,15 +117,16 @@ class MailingTargets // This can't be abstract as it is used for some method return ''; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Met a jour nombre de destinataires * * @param int $mailing_id Id of emailing * @return int < 0 si erreur, nb destinataires si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function update_nb($mailing_id) { + // phpcs:enable // Mise a jour nombre de destinataire dans table des mailings $sql = "SELECT COUNT(*) nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " WHERE fk_mailing = ".$mailing_id; @@ -150,6 +151,7 @@ class MailingTargets // This can't be abstract as it is used for some method return $nb; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -157,9 +159,9 @@ class MailingTargets // This can't be abstract as it is used for some method * @param array $cibles Array with targets * @return int < 0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id, $cibles) { + // phpcs:enable global $conf; $this->db->begin(); @@ -234,15 +236,16 @@ class MailingTargets // This can't be abstract as it is used for some method return $j; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Supprime tous les destinataires de la table des cibles * - * @param int $mailing_id Id of emailing + * @param int $mailing_id Id of emailing * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clear_target($mailing_id) { + // phpcs:enable $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql .= " WHERE fk_mailing = ".$mailing_id; diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 1531248d746..524d1446427 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -47,6 +47,7 @@ class pdf_standard extends CommonStickerGenerator // use this method in future refactoring } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - __LOGO__ is replace with company logo @@ -62,9 +63,9 @@ class pdf_standard extends CommonStickerGenerator * @param string $photo Photo (full path to image file used as replacement for key __PHOTOS__ into left, right, header or footer text) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='') { + // phpcs:enable global $db,$mysoc,$conf,$langs; global $forceimgscalewidth,$forceimgscaleheight; @@ -236,6 +237,7 @@ class pdf_standard extends CommonStickerGenerator } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP stream. * @@ -246,9 +248,9 @@ class pdf_standard extends CommonStickerGenerator * @param int $nooutput 1=Generate only file on disk and do not return it on response * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs, $srctemplatepath, $mode='member', $nooutput=0) { + // phpcs:enable global $user,$conf,$langs,$mysoc,$_Avery_Labels; $this->code=$srctemplatepath; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 1ca929c08cf..0047dda7669 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -1,10 +1,10 @@ - * Copyright (C) 2002-2003 Jean-Louis Bergamo - * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2015 Francis Appels +/* Copyright (C) 2003 Steve Dillon + * Copyright (C) 2003 Laurent Passebecq + * Copyright (C) 2001-2003 Rodolphe Quiedeville + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2006-2013 Laurent Destailleur + * Copyright (C) 2015 Francis Appels * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,15 @@ */ /** - * \file htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php - * \ingroup core - * \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise + * \file htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php + * \ingroup core + * \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise */ require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php'; /** - * Class to generate stick sheet with format Avery or other personalised + * Class to generate stick sheet with format Avery or other personalised */ class pdf_standardlabel extends CommonStickerGenerator { @@ -46,6 +46,7 @@ class pdf_standardlabel extends CommonStickerGenerator // use this method in future refactoring } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0) * - %LOGO% is replace with company logo @@ -60,9 +61,9 @@ class pdf_standardlabel extends CommonStickerGenerator * @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='') { + // phpcs:enable global $mysoc, $conf, $langs; global $forceimgscalewidth, $forceimgscaleheight; @@ -226,6 +227,7 @@ class pdf_standardlabel extends CommonStickerGenerator + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP strem. * @@ -236,9 +238,9 @@ class pdf_standardlabel extends CommonStickerGenerator * @param string $filename Short file name of PDF output file * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='',$filename='tmp_address_sheet.pdf') { + // phpcs:enable global $user,$conf,$langs,$mysoc,$_Avery_Labels; $this->code=$srctemplatepath; diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index c93e4b50fe3..b92c05e6f48 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -191,6 +191,7 @@ class doc_generic_product_odt extends ModelePDFProduct return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -202,9 +203,9 @@ class doc_generic_product_odt extends ModelePDFProduct * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $product,$langs,$conf,$mysoc,$hookmanager,$user; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index b8d3ad53092..5aba06db359 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -216,14 +216,15 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check if mask/numbering use prefix * * @return int 0 or 1 */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { + // phpcs:enable global $conf; $mask = $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; @@ -292,6 +293,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un code est pris ou non (par autre tiers) * @@ -301,9 +303,9 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if available, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $soc, $type=0) { + // phpcs:enable $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; if ($type == 1) $sql.= " WHERE code_fournisseur = '".$code."'"; else $sql.= " WHERE code_client = '".$code."'"; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index a95ad54ba02..da3eb6ef734 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -207,6 +207,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -218,9 +219,9 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 2ba83623020..5318220beb8 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -190,6 +190,7 @@ class doc_generic_user_odt extends ModelePDFUser return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -201,9 +202,9 @@ class doc_generic_user_odt extends ModelePDFUser * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) @@ -423,6 +424,7 @@ class doc_generic_user_odt extends ModelePDFUser return -1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * get substitution array for object * @@ -431,9 +433,9 @@ class doc_generic_user_odt extends ModelePDFUser * @param string $array_key key for array * @return array array of substitutions */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:enable $array_other = array(); foreach($object as $key => $value) { if (!is_array($value) && !is_object($value)) { diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index a908f3315fd..aec0f40443e 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1719,6 +1719,7 @@ class Task extends CommonObject return $this->LibStatut($this->fk_statut, $mode); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return status label for an object * @@ -1726,9 +1727,9 @@ class Task extends CommonObject * @param integer $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=0) { + // phpcs:enable // list of Statut of the task $this->statuts[0]='Draft'; $this->statuts[1]='ToDo'; @@ -1747,59 +1748,59 @@ class Task extends CommonObject { 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]),'statut1').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts_short[$statut]); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts_short[$statut]); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]),'statut0').' '.$langs->trans($this->statuts[$statut]); - if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); - if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); - if ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); - if ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); - if ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]),'statut1').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]),'statut3').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==3) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==4) return img_picto($langs->trans($this->statuts_short[$statut]),'statut6').' '.$langs->trans($this->statuts[$statut]); + elseif ($statut==5) return img_picto($langs->trans($this->statuts_short[$statut]),'statut5').' '.$langs->trans($this->statuts[$statut]); } - if ($mode == 5) + elseif ($mode == 5) { /*if ($statut==0) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); */ - //return $this->progress.' %'; + //else return $this->progress.' %'; return ' '; } - if ($mode == 6) + elseif ($mode == 6) { /*if ($statut==0) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut0'); - if ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); - if ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); - if ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); - if ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); + elseif ($statut==1) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut1'); + elseif ($statut==2) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut3'); + elseif ($statut==3) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==4) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); + elseif ($statut==5) return $langs->trans($this->statuts[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut5'); */ - //return $this->progress.' %'; + //else return $this->progress.' %'; return ' '; } } @@ -1837,15 +1838,16 @@ class Task extends CommonObject } + // 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; // For external user, no check is done on company because readability is managed by public status of project and assignement. @@ -1911,14 +1913,15 @@ class Task extends CommonObject } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Charge indicateurs this->nb de tableau de bord * * @return int <0 if ko, >0 if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function load_state_board() { + // phpcs:enable global $user; $mine=0; $socid=$user->societe_id; From 85df267a5b05affa52569987e0b32b7d71642533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 5 Sep 2018 20:36:44 +0200 Subject: [PATCH 28/49] move phpcs:ignore --- .../class/html.formintervention.class.php | 5 +- htdocs/core/db/Database.interface.php | 90 +++++++++++-------- .../modules/cheque/doc/pdf_blochet.class.php | 9 +- .../doc/doc_generic_shipment_odt.modules.php | 3 +- .../modules/export/export_excel.modules.php | 35 +++++--- .../doc/doc_generic_invoice_odt.modules.php | 3 +- .../modules/import/import_xlsx.modules.php | 70 ++++++++------- .../livraison/mod_livraison_saphir.php | 9 +- .../mailings/advthirdparties.modules.php | 5 +- .../modules/product/modules_product.class.php | 21 +++-- .../doc/doc_generic_proposal_odt.modules.php | 3 +- .../core/modules/propale/modules_propale.php | 3 +- .../modules/rapport/pdf_paiement.class.php | 6 +- 13 files changed, 156 insertions(+), 106 deletions(-) diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index 3d5f2c9b640..ae35b74fad9 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -31,7 +31,7 @@ class FormIntervention * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -49,6 +49,7 @@ class FormIntervention } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show a combo list with contracts qualified for a third party * @@ -59,9 +60,9 @@ class FormIntervention * @param int $showempty Show empty line * @return int Nbre of project if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_interventions($socid=-1, $selected='', $htmlname='interventionid', $maxlength=16, $showempty=1) { + // phpcs:enable global $db,$user,$conf,$langs; $out=''; diff --git a/htdocs/core/db/Database.interface.php b/htdocs/core/db/Database.interface.php index b4c5d770253..db233dda1b4 100644 --- a/htdocs/core/db/Database.interface.php +++ b/htdocs/core/db/Database.interface.php @@ -35,14 +35,15 @@ interface Database */ function ifsql($test, $resok, $resko); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param resource $resultset Resultset of request * @return array Array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fetch_row($resultset); + function fetch_row($resultset); + // phpcs:enable /** * Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field. @@ -67,6 +68,7 @@ interface Database */ function begin(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new database * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated @@ -78,8 +80,8 @@ interface Database * @param string $owner Username of database owner * @return resource resource defined if OK, null if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLCreateDb($database, $charset = '', $collation = '', $owner = ''); + function DDLCreateDb($database, $charset = '', $collation = '', $owner = ''); + // phpcs:enable /** * Return version of database server into an array @@ -97,6 +99,7 @@ interface Database */ static function convertSQLFromMysql($line, $type = 'ddl'); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * @@ -104,8 +107,8 @@ interface Database * @return int Nombre de lignes * @see num_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function affected_rows($resultset); + function affected_rows($resultset); + // phpcs:enable /** * Return description of last error @@ -114,6 +117,7 @@ interface Database */ function error(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List tables into a database * @@ -121,8 +125,8 @@ interface Database * @param string $table Nmae of table filter ('xxx%') * @return array List of tables in an array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLListTables($database, $table = ''); + function DDLListTables($database, $table = ''); + // phpcs:enable /** * Return last request executed with query() @@ -148,14 +152,15 @@ interface Database */ function decrypt($value); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param resource $resultset Resultset of request * @return array Array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fetch_array($resultset); + function fetch_array($resultset); + // phpcs:enable /** * Return last error label @@ -172,6 +177,7 @@ interface Database */ function escape($stringtoencode); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get last ID after an insert INSERT * @@ -179,8 +185,8 @@ interface Database * @param string $fieldid Field name * @return int Id of row */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function last_insert_id($tab, $fieldid = 'rowid'); + function last_insert_id($tab, $fieldid = 'rowid'); + // phpcs:enable /** * Return full path of restore program @@ -253,6 +259,7 @@ interface Database */ function getDefaultCollationDatabase(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return number of lines for result of a SELECT * @@ -260,8 +267,8 @@ interface Database * @return int Nb of lines * @see affected_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function num_rows($resultset); + function num_rows($resultset); + // phpcs:enable /** * Return full path of dump program @@ -284,6 +291,7 @@ interface Database */ function errno(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a table into database * @@ -296,17 +304,18 @@ interface Database * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null); + function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null); + // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a table into database * * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLDropTable($table); + function DDLDropTable($table); + // phpcs:enable /** * Return list of available charset that can be used to store data in database @@ -315,6 +324,7 @@ interface Database */ function getListOfCharacterSet(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new field into table * @@ -324,9 +334,10 @@ interface Database * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLAddField($table, $field_name, $field_desc, $field_position = ""); + function DDLAddField($table, $field_name, $field_desc, $field_position = ""); + // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a field from table * @@ -334,9 +345,10 @@ interface Database * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLDropField($table, $field_name); + function DDLDropField($table, $field_name); + // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update format of a field into a table * @@ -345,8 +357,8 @@ interface Database * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLUpdateField($table, $field_name, $field_desc); + function DDLUpdateField($table, $field_name, $field_desc); + // phpcs:enable /** * Return list of available collation that can be used for database @@ -355,6 +367,7 @@ interface Database */ function getListOfCollation(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a pointer of line with description of a table or field * @@ -362,8 +375,8 @@ interface Database * @param string $field Optionnel : Name of field if we want description of field * @return resource Resource */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLDescTable($table, $field = ""); + function DDLDescTable($table, $field = ""); + // phpcs:enable /** * Return version of database server @@ -379,6 +392,7 @@ interface Database */ function getDefaultCharacterSetDatabase(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user and privileges to connect to database (even if database does not exists yet) * @@ -388,13 +402,13 @@ interface Database * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser( $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name - ); + ); + // phpcs:enable /** * Convert (by PHP) a PHP server TZ string date into a Timestamps date (GMT if gm=true) @@ -425,14 +439,15 @@ interface Database */ function commit($log = ''); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List information of columns into a table. * * @param string $table Name of table * @return array Array with inforation on table */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLInfoTable($table); + function DDLInfoTable($table); + // phpcs:enable /** * Free last resultset used. @@ -457,29 +472,32 @@ interface Database */ function lastqueryerror(); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return connexion ID * * @return string Id connexion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function DDLGetConnectId(); + function DDLGetConnectId(); + // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * * @param resource $resultset Curseur de la requete voulue * @return Object Object result line or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fetch_object($resultset); + function fetch_object($resultset); + // phpcs:enable + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Select a database * * @param string $database Name of database * @return boolean true if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function select_db($database); + function select_db($database); + // phpcs:enable } diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 464bd7eed05..159f8664390 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -74,6 +74,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts $this->tab_height = 200; //$this->line_height * $this->line_per_page; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction to generate document on disk * @@ -83,9 +84,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Translate $outputlangs Lang output object * @return int 1=ok, 0=ko */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $_dir, $number, $outputlangs) { + // phpcs:enable global $user,$conf,$langs,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -198,6 +199,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Generate Header * @@ -207,9 +209,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Translate $outputlangs Object language for output * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Header(&$pdf, $page, $pages, $outputlangs) { + // phpcs:enable global $langs; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -305,6 +307,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output array * @@ -314,9 +317,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts * @param Translate $outputlangs Object lang * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Body(&$pdf, $pagenb, $pages, $outputlangs) { + // phpcs:enable // x=10 - Num // x=30 - Banque // x=100 - Emetteur diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 9971c3acd81..2ca4300bb26 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -177,6 +177,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -188,9 +189,9 @@ class doc_generic_shipment_odt extends ModelePdfExpedition * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/export/export_excel.modules.php b/htdocs/core/modules/export/export_excel.modules.php index 6c50b3c46de..665a6925c6b 100644 --- a/htdocs/core/modules/export/export_excel.modules.php +++ b/htdocs/core/modules/export/export_excel.modules.php @@ -37,7 +37,7 @@ class ExportExcel extends ModeleExports */ public $id; - /** + /** * @var string Export Excel label */ public $label; @@ -48,8 +48,8 @@ class ExportExcel extends ModeleExports public $label_lib; public $version_lib; - public $workbook; // Handle fichier - public $worksheet; // Handle onglet + public $workbook; // Handle file + public $worksheet; // Handle sheet public $row; public $col; public $file; // To save filename @@ -168,6 +168,7 @@ class ExportExcel extends ModeleExports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Open output file * @@ -175,9 +176,9 @@ class ExportExcel extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function open_file($file,$outputlangs) { + // phpcs:enable global $user,$conf,$langs; if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) @@ -238,21 +239,23 @@ class ExportExcel extends ModeleExports return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Write header + * Write header * - * @param Translate $outputlangs Object lang to translate values + * @param Translate $outputlangs Object lang to translate values * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { + // phpcs:enable //$outputlangs->charset_output='ISO-8859-1'; // Because Excel 5 format is ISO return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output title line into file * @@ -262,9 +265,9 @@ class ExportExcel extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { + // phpcs:enable global $conf; // Create a format for the column headings @@ -309,6 +312,7 @@ class ExportExcel extends ModeleExports return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output record line into file * @@ -318,9 +322,9 @@ class ExportExcel extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { + // phpcs:enable global $conf; // Create a format for the column headings @@ -428,27 +432,29 @@ class ExportExcel extends ModeleExports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write footer * * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { + // phpcs:enable return 0; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Close Excel file * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { + // phpcs:enable global $conf; if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) @@ -467,15 +473,16 @@ class ExportExcel extends ModeleExports } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Clean a cell to respect rules of Excel file cells * * @param string $newvalue String to clean * @return string Value cleaned */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function excel_clean($newvalue) { + // phpcs:enable // Rule Dolibarr: No HTML $newvalue=dol_string_nohtmltag($newvalue); diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 623473d5595..a73d6f13296 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -176,6 +176,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -187,9 +188,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 9ac1d8bc6a6..31f09a7893f 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -38,9 +38,9 @@ class ImportXlsx extends ModeleImports */ public $db; - var $datatoimport; + public $datatoimport; - /** + /** * @var string Error code (or message) */ public $error=''; @@ -115,38 +115,40 @@ class ImportXlsx extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output header of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header_example($outputlangs) { - global $user,$conf,$langs; - // create a temporary object, the final output will be generated in footer - if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) { + // phpcs:enable + global $user,$conf,$langs; + // create a temporary object, the final output will be generated in footer + if (!empty($conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR)) { $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM; $cacheSettings = array ( - 'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR - ); - PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); + 'dir' => $conf->global->MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR + ); + PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings); } - $this->workbook = new PHPExcel(); - $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION); - $this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file); - $this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file); - $this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file); + $this->workbook = new PHPExcel(); + $this->workbook->getProperties()->setCreator($user->getFullName($outputlangs).' - Dolibarr '.DOL_VERSION); + $this->workbook->getProperties()->setTitle($outputlangs->trans("Import").' - '.$file); + $this->workbook->getProperties()->setSubject($outputlangs->trans("Import").' - '.$file); + $this->workbook->getProperties()->setDescription($outputlangs->trans("Import").' - '.$file); - $this->workbook->setActiveSheetIndex(0); - $this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet")); - $this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(16); + $this->workbook->setActiveSheetIndex(0); + $this->workbook->getActiveSheet()->setTitle($outputlangs->trans("Sheet")); + $this->workbook->getActiveSheet()->getDefaultRowDimension()->setRowHeight(16); - return ''; - } + return ''; + } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output title line of an example file for this format * @@ -154,9 +156,9 @@ class ImportXlsx extends ModeleImports * @param array $headerlinefields Array of fields name * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title_example($outputlangs,$headerlinefields) { + // phpcs:enable global $conf; $this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true); $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT); @@ -172,6 +174,7 @@ class ImportXlsx extends ModeleImports return ''; // final output will be generated in footer } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output record of an example file for this format * @@ -179,9 +182,9 @@ class ImportXlsx extends ModeleImports * @param array $contentlinevalues Array of lines * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record_example($outputlangs,$contentlinevalues) { + // phpcs:enable $col = 0; $row = 2; foreach($contentlinevalues as $cell) { @@ -192,16 +195,17 @@ class ImportXlsx extends ModeleImports return ''; // final output will be generated in footer } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output footer of an example file for this format * * @param Translate $outputlangs Output language * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer_example($outputlangs) { - // return te file content as a string + // phpcs:enable + // return the file content as a string $tempfile = tempnam(sys_get_temp_dir(), 'dol'); $objWriter = new PHPExcel_Writer_Excel2007($this->workbook); $objWriter->save($tempfile); @@ -215,15 +219,16 @@ class ImportXlsx extends ModeleImports + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Open input file * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_open_file($file) { + // phpcs:enable global $langs; $ret=1; @@ -238,15 +243,16 @@ class ImportXlsx extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return nb of records. File must be closed. * * @param string $file Path of filename * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_get_nb_of_lines($file) { + // phpcs:enable $reader = new PHPExcel_Reader_Excel2007(); $this->workbook = $reader->load($file); @@ -259,14 +265,15 @@ class ImportXlsx extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Input header line from file * * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_header() { + // phpcs:enable // This is not called by the import code !!! $this->headers = array(); $colcount = PHPExcel_Cell::columnIndexFromString($this->workbook->getActiveSheet()->getHighestDataColumn()); @@ -277,14 +284,15 @@ class ImportXlsx extends ModeleImports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return array of next record in input file. * * @return Array Array of field values. Data are UTF8 encoded. [fieldpos] => (['val']=>val, ['type']=>-1=null,0=blank,1=not empty string) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_read_record() { + // phpcs:enable global $conf; $rowcount = $this->workbook->getActiveSheet()->getHighestDataRow(); @@ -301,19 +309,22 @@ class ImportXlsx extends ModeleImports return $array; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close file handle * * @return integer */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_close_file() { + // phpcs:enable $this->workbook->disconnectWorksheets(); unset($this->workbook); } + // What is this doing here ? it is common to all imports, is should be in the parent class + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Insert a record into database * @@ -325,10 +336,9 @@ class ImportXlsx extends ModeleImports * @param array $updatekeys Array of keys to use to try to do an update first before insert. This field are defined into the module descriptor. * @return int <0 if KO, >0 if OK */ - // What is this doing here ? it is common to all imports, is should be in the parent class - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function import_insert($arrayrecord,$array_match_file_to_database,$objimport,$maxfields,$importid,$updatekeys) { + // phpcs:enable global $langs,$conf,$user; global $thirdparty_static; // Specific to thirdparty import global $tablewithentity_cache; // Cache to avoid to call desc at each rows on tables diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index 4fed4689738..bad82554ff3 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -139,16 +139,17 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder } - /** - * Return next free ref - * + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return next free ref + * * @param Societe $objsoc Object thirdparty * @param Object $object Objet livraison * @return string Texte descripif */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function livraison_get_num($objsoc=0,$object='') { + // phpcs:enable return $this->getNextValue($objsoc,$object); } } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 59fc4f14039..f41992bee14 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -32,7 +32,7 @@ class mailing_advthirdparties extends MailingTargets var $require_module=array("none"); // This module should not be displayed as Selector in mailling var $picto='company'; - + /** * @var DoliDB Database handler. */ @@ -52,6 +52,7 @@ class mailing_advthirdparties extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -61,9 +62,9 @@ class mailing_advthirdparties extends MailingTargets * @param array $contactid Array of contact id to add * @return int <0 if error, number of emails added if ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target_spec($mailing_id,$socid,$type_of_target, $contactid) { + // phpcs:enable global $conf, $langs; dol_syslog(get_class($this)."::add_to_target socid=".var_export($socid,true).' contactid='.var_export($contactid,true)); diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 3202bf9ca1d..b632f387d05 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -39,16 +39,17 @@ abstract class ModelePDFProduct extends CommonDocGenerator public $error=''; - /** - * Return list of active generation modules - * + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return list of active generation modules + * * @param DoliDB $db Database handler * @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='product'; @@ -140,6 +141,7 @@ abstract class ModeleProductCode return $langs->trans("NotAvailable"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi la liste des modeles de numérotation * @@ -147,9 +149,9 @@ abstract class ModeleProductCode * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { + // phpcs:enable $liste=array(); $sql =""; @@ -202,7 +204,7 @@ abstract class ModeleProductCode if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')'; $s.='
    '; } - if ($type == 1) + elseif ($type == 1) { $s.=$langs->trans("RequiredIfService").': '; if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=''; @@ -210,7 +212,7 @@ abstract class ModeleProductCode if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=' '.yn(1,1,2).' ('.$langs->trans("ForcedToByAModule",$langs->transnoentities("yes")).')'; $s.='
    '; } - if ($type == -1) + elseif ($type == -1) { $s.=$langs->trans("Required").': '; if (! empty($conf->global->MAIN_COMPANY_CODE_ALWAYS_REQUIRED) && ! empty($this->code_null)) $s.=''; @@ -239,14 +241,15 @@ abstract class ModeleProductCode return $s; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Check if mask/numbering use prefix * * @return int 0=no, 1=yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { + // phpcs:enable return 0; } } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 1e0d084fbba..96bd6bfbfda 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -207,6 +207,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -218,9 +219,9 @@ class doc_generic_proposal_odt extends ModelePDFPropales * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/propale/modules_propale.php b/htdocs/core/modules/propale/modules_propale.php index 0c046746486..c7514ab973c 100644 --- a/htdocs/core/modules/propale/modules_propale.php +++ b/htdocs/core/modules/propale/modules_propale.php @@ -42,6 +42,7 @@ abstract class ModelePDFPropales extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * @@ -49,9 +50,9 @@ abstract class ModelePDFPropales 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='propal'; diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 801b3820bc5..154d37115dd 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -83,6 +83,7 @@ class pdf_paiement } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fonction generant la rapport sur le disque * @@ -92,9 +93,9 @@ class pdf_paiement * @param string $outputlangs Lang output object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($_dir, $month, $year, $outputlangs) { + // phpcs:enable include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; global $conf, $hookmanager, $langs, $user; @@ -406,6 +407,7 @@ class pdf_paiement } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output body * @@ -415,9 +417,9 @@ class pdf_paiement * @param Translate $outputlangs Object langs * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function Body(&$pdf, $page, $lines, $outputlangs) { + // phpcs:enable global $langs; $default_font_size = pdf_getPDFFontSize($outputlangs); From 3ecf78843870954e58d8431073e70d8d80b713be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 Sep 2018 18:29:01 +0200 Subject: [PATCH 29/49] move phpcs:ignore --- .../accountancy/class/bookkeeping.class.php | 16 ++++--- .../core/class/commondocgenerator.class.php | 45 ++++++++++++------- htdocs/core/class/html.formmail.class.php | 18 +++++--- htdocs/core/modules/action/rapport.pdf.php | 3 +- .../modules/commande/mod_commande_saphir.php | 5 ++- .../printsheet/doc/pdf_tcpdflabel.class.php | 3 +- .../task/doc/doc_generic_task_odt.modules.php | 27 +++++++---- .../project/task/mod_task_universal.php | 5 ++- 8 files changed, 78 insertions(+), 44 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index cacf9b0a641..00bf3c15dcb 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1553,15 +1553,16 @@ class BookKeeping extends CommonObject return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Export bookkeping * * @param string $model Model * @return int Result */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function export_bookkeping($model = 'ebp') { + // phpcs:enable global $conf; $sql = "SELECT rowid, doc_date, doc_type,"; @@ -1706,11 +1707,12 @@ class BookKeeping extends CommonObject */ } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of accounts with label by chart of accounts * - * @param string $selectid Preselected chart of accounts - * @param string $htmlname Name of field in html form + * @param string $selectid Preselected chart of accounts + * @param string $htmlname Name of field in html form * @param int $showempty Add an empty field * @param array $event Event options * @param int $select_in Value is a aa.rowid (0 default) or aa.account_number (1) @@ -1718,9 +1720,9 @@ class BookKeeping extends CommonObject * @param int $aabase Set accounting_account base class to display empty=all or from 1 to 8 will display only account beginning by this number * @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, $aabase = '') { + // phpcs:enable global $conf; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -1777,15 +1779,16 @@ class BookKeeping extends CommonObject return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Description of a root accounting account * * @param string $account Accounting account * @return string Root account */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_racine($account = null) { + // phpcs:enable global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; @@ -1818,15 +1821,16 @@ class BookKeeping extends CommonObject } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Description of accounting account * * @param string $account Accounting account * @return string Account desc */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_compte_desc($account = null) { + // phpcs:enable global $conf; $pcgver = $conf->global->CHARTOFACCOUNTS; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5a1bcd8440d..a818bfe7a2f 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -48,6 +48,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -55,9 +56,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_user($user,$outputlangs) { + // phpcs:enable global $conf; $logotouse=$conf->user->dir_output.'/'.get_exdir($user->id, 2, 0, 1, $user, 'user').'/'.$user->photo; @@ -85,6 +86,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -92,9 +94,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_mysoc($mysoc,$outputlangs) { + // phpcs:enable global $conf; if (empty($mysoc->forme_juridique) && ! empty($mysoc->forme_juridique_code)) @@ -144,6 +146,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -151,9 +154,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_thirdparty($object,$outputlangs) { + // phpcs:enable global $conf; if (empty($object->country) && ! empty($object->country_code)) @@ -224,6 +227,7 @@ abstract class CommonDocGenerator return $array_thirdparty; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -232,9 +236,9 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { + // phpcs:enable global $conf; if(empty($object->country) && ! empty($object->country_code)) @@ -297,15 +301,16 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_other($outputlangs) { + // phpcs:enable global $conf; $now=dol_now('gmt'); // gmt @@ -334,6 +339,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -342,9 +348,9 @@ abstract class CommonDocGenerator * @param string $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; $sumpayed=$sumdeposit=$sumcreditnote=''; @@ -481,6 +487,7 @@ abstract class CommonDocGenerator return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -488,9 +495,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_lines($line,$outputlangs) { + // phpcs:enable global $conf; $resarray= array( @@ -559,6 +566,7 @@ abstract class CommonDocGenerator return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -567,9 +575,9 @@ abstract class CommonDocGenerator * @param array_key $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; dol_include_once('/core/lib/product.lib.php'); $object->list_delivery_methods($object->shipping_method_id); @@ -621,6 +629,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -628,10 +637,10 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_shipment_lines($line, $outputlangs) { - global $conf; + // phpcs:enable + global $conf; dol_include_once('/core/lib/product.lib.php'); $resarray = array( @@ -668,6 +677,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple subtitution key => subtitution value * @@ -676,17 +686,17 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) { + // phpcs:enable $array_other = array(); - if(!empty($object)) { + if (!empty($object)) { foreach($object as $key => $value) { - if(!empty($value)) { - if(!is_array($value) && !is_object($value)) { + if (!empty($value)) { + if (!is_array($value) && !is_object($value)) { $array_other['object_'.$key] = $value; } - if(is_array($value) && $recursive){ + if (is_array($value) && $recursive) { $array_other['object_'.$key] = $this->get_substitutionarray_each_var_object($value,$outputlangs,false); } } @@ -696,6 +706,7 @@ abstract class CommonDocGenerator } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Fill array with couple extrafield key => extrafield value * @@ -706,9 +717,9 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) + function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) { + // phpcs:enable global $conf; foreach($extrafields->attribute_label as $key=>$label) { diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index cdc6a20ffa1..f648712e43c 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -136,14 +136,15 @@ class FormMail extends Form return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Clear list of attached files in send mail form (also stored in session) * * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function clear_attached_files() { + // phpcs:enable global $conf,$user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -158,6 +159,7 @@ class FormMail extends Form unset($_SESSION["listofmimes".$keytoavoidconflict]); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Add a file into the list of attached files (stored in SECTION array) * @@ -166,9 +168,9 @@ class FormMail extends Form * @param string $type Mime type (can be dol_mimetype($file)) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_attached_files($path, $file='', $type='') { + // phpcs:enable $listofpaths=array(); $listofnames=array(); $listofmimes=array(); @@ -191,15 +193,16 @@ class FormMail extends Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Remove a file from the list of attached files (stored in SECTION array) * * @param string $keytodelete Key in file array (0, 1, 2, ...) * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function remove_attached_files($keytodelete) { + // phpcs:enable $listofpaths=array(); $listofnames=array(); $listofmimes=array(); @@ -220,14 +223,15 @@ class FormMail extends Form } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of attached files (stored in SECTION array) * * @return array array('paths'=> ,'names'=>, 'mimes'=> ) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_attached_files() { + // phpcs:enable $listofpaths=array(); $listofnames=array(); $listofmimes=array(); @@ -239,6 +243,7 @@ class FormMail extends Form return array('paths'=>$listofpaths, 'names'=>$listofnames, 'mimes'=>$listofmimes); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show the form to input an email * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files @@ -248,12 +253,13 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function show_form($addfileaction='addfile',$removefileaction='removefile') { + // phpcs:enable print $this->get_form($addfileaction,$removefileaction); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get the form to input an email * this->withfile: 0=No attaches files, 1=Show attached files, 2=Can add new attached files @@ -264,9 +270,9 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return string Form to show */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_form($addfileaction='addfile', $removefileaction='removefile') { + // phpcs:enable global $conf, $langs, $user, $hookmanager, $form; if (! is_object($form)) $form=new Form($this->db); diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index 8fb183a2446..ae7e6cd63c6 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -92,6 +92,7 @@ class CommActionRapport $this->subject=$langs->transnoentitiesnoconv("ActionsReport").' '.$this->year."-".$this->month; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Write the object to document file to disk * @@ -100,9 +101,9 @@ class CommActionRapport * @param Translate $outputlangs Lang object for output language * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($socid = 0, $catid = 0, $outputlangs='') { + // phpcs:enable global $user,$conf,$langs,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 21235229793..ae856072049 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -132,16 +132,17 @@ class mod_commande_saphir extends ModeleNumRefCommandes } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * * @param Societe $objsoc Object third party - * @param string $objforref Object for number to search + * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 659cb8e07f6..de1aa1b5d5e 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -266,6 +266,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build PDF on disk, then output on HTTP strem. * @@ -276,9 +277,9 @@ class pdf_tcpdflabel extends CommonStickerGenerator * @param string $filename Short file name of PDF output file * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='',$filename='tmp_address_sheet.pdf') { + // phpcs:enable global $user,$conf,$langs,$mysoc,$_Avery_Labels; $this->code=$srctemplatepath; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b0d0d7d5069..5dcd7586472 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -104,6 +104,7 @@ class doc_generic_task_odt extends ModelePDFTask } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -112,9 +113,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param string $array_key Name of the key for return array * @return array Array of substitution */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_object($object,$outputlangs,$array_key='object') { + // phpcs:enable global $conf; $resarray=array( @@ -148,6 +149,7 @@ class doc_generic_task_odt extends ModelePDFTask return $resarray; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -155,9 +157,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasks($task,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -178,6 +180,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -185,9 +188,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_contacts($contact,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -202,6 +205,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -209,9 +213,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_file($file,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -221,6 +225,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -228,9 +233,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_project_reference($refdetail,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -244,6 +249,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -251,9 +257,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_tasksressource($taskressource,$outputlangs) { + // phpcs:enable global $conf; //dol_syslog(get_class($this).'::get_substitutionarray_tasksressource taskressource='.var_export($taskressource,true),LOG_DEBUG); return array( @@ -267,6 +273,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -274,9 +281,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_taskstime($tasktime,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -291,6 +298,7 @@ class doc_generic_task_odt extends ModelePDFTask ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Define array with couple substitution key => substitution value * @@ -298,9 +306,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_substitutionarray_task_file($file,$outputlangs) { + // phpcs:enable global $conf; return array( @@ -400,6 +408,7 @@ class doc_generic_task_odt extends ModelePDFTask return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -408,9 +417,9 @@ class doc_generic_task_odt extends ModelePDFTask * @param string $srctemplatepath Full path of source filename for generator using a template file * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index cc3175be159..6a6f90b1523 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -127,6 +127,7 @@ class mod_task_universal extends ModeleNumRefTask } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next reference not yet used as a reference * @@ -134,9 +135,9 @@ class mod_task_universal extends ModeleNumRefTask * @param Task $object Object task * @return string Next not used reference */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function project_get_num($objsoc=0,$object='') { - return $this->getNextValue($objsoc,$object); + // phpcs:enable + return $this->getNextValue($objsoc, $object); } } From cbf4a20a1322393fc4cac8767919fbe3cfbe8893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 Sep 2018 19:03:09 +0200 Subject: [PATCH 30/49] move phpcs:ignore --- .../bank/doc/pdf_sepamandate.modules.php | 13 ++++---- .../modules/commande/modules_commande.php | 9 +++--- .../livraison/doc/pdf_typhon.modules.php | 10 +++--- .../modules/printing/printgcp.modules.php | 31 ++++++++++--------- .../modules/societe/mod_codeclient_monkey.php | 6 ++-- .../societe/mod_codecompta_aquarium.php | 3 +- .../modules_facturefournisseur.php | 11 ++++--- .../doc/pdf_standard.modules.php | 8 +++-- .../doc/doc_generic_usergroup_odt.modules.php | 3 +- 9 files changed, 54 insertions(+), 40 deletions(-) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 44a3ed233db..f7d0ce19f61 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -83,8 +83,9 @@ class pdf_sepamandate extends ModeleBankAccountDoc } - /** - * Fonction generant le projet sur le disque + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Fonction generant le projet sur le disque * * @param Project $object Object project a generer * @param Translate $outputlangs Lang output object @@ -95,7 +96,6 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param null|array $moreparams More parameters * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { global $conf, $hookmanager, $langs, $user, $mysoc; @@ -427,6 +427,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -436,10 +437,10 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Langs object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { - global $conf, $mysoc; + // phpcs:enable + global $conf, $mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); @@ -472,7 +473,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _signature_area(&$pdf, $object, $posy, $outputlangs) { $default_font_size = pdf_getPDFFontSize($outputlangs); diff --git a/htdocs/core/modules/commande/modules_commande.php b/htdocs/core/modules/commande/modules_commande.php index e3a755fa523..1a4b732246d 100644 --- a/htdocs/core/modules/commande/modules_commande.php +++ b/htdocs/core/modules/commande/modules_commande.php @@ -44,16 +44,17 @@ abstract class ModelePDFCommandes extends CommonDocGenerator */ public $error=''; - /** - * Return list of active generation modules - * + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return list of active generation modules + * * @param DoliDB $db Database handler * @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 = 'order'; diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 8705d985661..ae0dcb6a74f 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -174,7 +174,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Function to build pdf onto disk * * @param Object $object Object to generate @@ -184,10 +185,10 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param int $hidedesc Do not show desc * @param int $hideref Do not show ref * @return int 1=OK, 0=KO - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + */ function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -630,6 +631,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show miscellaneous information (payment mode, payment term, ...) * @@ -639,9 +641,9 @@ class pdf_typhon extends ModelePDFDeliveryOrder * @param Translate $outputlangs Langs object * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_info(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index d0a1497c0a0..5b78a8d61c7 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2018 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,24 +35,24 @@ use OAuth\OAuth2\Service\Google; */ class printing_printgcp extends PrintingDriver { - var $name = 'printgcp'; - var $desc = 'PrintGCPDesc'; - var $picto = 'printer'; - var $active = 'PRINTING_PRINTGCP'; - var $conf = array(); - var $google_id = ''; - var $google_secret = ''; - + public $name = 'printgcp'; + public $desc = 'PrintGCPDesc'; + public $picto = 'printer'; + public $active = 'PRINTING_PRINTGCP'; + public $conf = array(); + public $google_id = ''; + public $google_secret = ''; + /** * @var string Error code (or message) */ public $error=''; - + /** * @var string[] Error codes (or messages) */ public $errors = array(); - + /** * @var DoliDB Database handler. */ @@ -227,14 +227,15 @@ class printing_printgcp extends PrintingDriver } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of available printers * * @return array list of printers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function getlist_available_printers() { + // phpcs:enable // Token storage $storage = new DoliStorage($this->db, $this->conf); // Setup the credentials for the requests @@ -292,6 +293,7 @@ class printing_printgcp extends PrintingDriver return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Print selected file * @@ -300,9 +302,9 @@ class printing_printgcp extends PrintingDriver * @param string $subdir subdir for file * @return int 0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_file($file, $module, $subdir='') { + // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; global $conf, $user; @@ -412,14 +414,15 @@ class printing_printgcp extends PrintingDriver } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List jobs print * * @return int 0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_jobs() { + // phpcs:enable global $conf, $db, $langs, $bc; $error = 0; diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index d9f65560705..eb7fb0184f4 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -210,6 +210,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un code est pris ou non (par autre tiers) * @@ -219,9 +220,9 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode * @param int $type 0 = customer/prospect , 1 = supplier * @return int 0 if available, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_dispo($db, $code, $soc, $type=0) { + // phpcs:enable global $conf, $mc; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; @@ -250,15 +251,16 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi si un code respecte la syntaxe * * @param string $code Code a verifier * @return int 0 si OK, <0 si KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_syntax($code) { + // phpcs:enable $res = 0; if (dol_strlen($code) < 11) diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index baf1978ceae..f6a2a08bee7 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -107,6 +107,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set accountancy account code for a third party into this->code * @@ -115,9 +116,9 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode * @param string $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { + // phpcs:enable global $conf; $i = 0; diff --git a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php index 3423c4b2547..064be2e1f41 100644 --- a/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php +++ b/htdocs/core/modules/supplier_invoice/modules_facturefournisseur.php @@ -1,8 +1,8 @@ - * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2016 Philippe Grand - * Copyright (C) 2014 Marcos García +/* Copyright (C) 2010 Juanjo Menent + * Copyright (C) 2012 Regis Houssin + * Copyright (C) 2013-2016 Philippe Grand + * Copyright (C) 2014 Marcos García * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation models * @@ -47,9 +48,9 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db, $maxfilenamelength=0) { + // phpcs:enable global $conf; $type = 'invoice_supplier'; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index fe225447e3b..5c409559491 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -176,7 +176,8 @@ class pdf_standard extends ModelePDFSuppliersPayments } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Function to build pdf onto disk * * @param PaiementFourn $object Id of object to generate @@ -187,9 +188,9 @@ class pdf_standard extends ModelePDFSuppliersPayments * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object, $outputlangs='', $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -513,6 +514,7 @@ class pdf_standard extends ModelePDFSuppliersPayments } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show total to pay * @@ -522,9 +524,9 @@ class pdf_standard extends ModelePDFSuppliersPayments * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _tableau_cheque(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable global $conf,$mysoc; $default_font_size = pdf_getPDFFontSize($outputlangs); diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 100fa286763..887a4cda084 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -192,6 +192,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -203,9 +204,9 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) From 70ba223788856f9104d0dfde65bb822bd177ec0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 6 Sep 2018 21:27:18 +0200 Subject: [PATCH 31/49] move phpcs:ignore --- htdocs/core/class/html.formcompany.class.php | 44 +++++---- htdocs/core/class/smtps.class.php | 21 +++-- htdocs/core/db/pgsql.class.php | 93 ++++++++++++------- .../bank/doc/pdf_sepamandate.modules.php | 4 +- .../modules/commande/mod_commande_marbre.php | 5 +- .../modules/contract/mod_contract_magre.php | 5 +- .../modules/export/export_tsv.modules.php | 31 ++++--- .../fichinter/doc/pdf_soleil.modules.php | 3 +- htdocs/core/modules/import/modules_import.php | 9 +- .../modules/mailings/contacts1.modules.php | 5 +- .../core/modules/mailings/example.modules.php | 11 ++- .../core/modules/mailings/pomme.modules.php | 5 +- .../modules/printing/modules_printing.php | 4 +- .../modules/printing/printipp.modules.php | 46 ++++----- .../modules/printsheet/modules_labels.php | 10 +- .../modules/project/mod_project_simple.php | 5 +- .../modules/project/task/mod_task_simple.php | 10 +- .../societe/doc/doc_generic_odt.modules.php | 3 +- .../modules/societe/modules_societe.class.php | 33 ++++--- .../modules_supplier_proposal.php | 9 +- 20 files changed, 213 insertions(+), 143 deletions(-) diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 78b06048ee4..5c39bc0cef4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -35,7 +35,7 @@ class FormCompany * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ @@ -54,6 +54,7 @@ class FormCompany } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of labels (translated) of third parties type * @@ -61,9 +62,9 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function typent_array($mode=0, $filter='') { + // phpcs:enable global $langs,$mysoc; $effs = array(); @@ -96,6 +97,7 @@ class FormCompany return $effs; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des types d'effectifs possibles (pas de traduction car nombre) * @@ -103,9 +105,9 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types d'effectifs */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function effectif_array($mode=0, $filter='') { + // phpcs:enable $effs = array(); $sql = "SELECT id, code, libelle"; @@ -135,6 +137,7 @@ class FormCompany } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Affiche formulaire de selection des modes de reglement * @@ -144,9 +147,9 @@ class FormCompany * @param int $empty Add empty value in list * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0) { + // phpcs:enable global $user, $langs; print '
    '; @@ -185,6 +188,7 @@ class FormCompany print '
    '; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne. * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays. @@ -197,12 +201,13 @@ class FormCompany * @param string $htmlname Id of department * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_departement($selected='',$country_codeid=0, $htmlname='state_id') { + // phpcs:enable print $this->select_state($selected,$country_codeid, $htmlname); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des departements/province/cantons tout pays confondu ou pour un pays donne. * Dans le cas d'une liste tout pays confondus, l'affichage fait une rupture sur le pays. @@ -216,9 +221,9 @@ class FormCompany * @return string String with HTML select * @see select_country */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_state($selected='',$country_codeid=0, $htmlname='state_id') { + // phpcs:enable global $conf,$langs,$user; dol_syslog(get_class($this)."::select_departement selected=".$selected.", country_codeid=".$country_codeid,LOG_DEBUG); @@ -318,6 +323,7 @@ class FormCompany } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des regions actives dont le pays est actif * La cle de la liste est le code (il peut y avoir plusieurs entree pour @@ -328,9 +334,9 @@ class FormCompany * @param string $htmlname Name of HTML select field * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_region($selected='',$htmlname='region_id') { + // phpcs:enable global $conf,$langs; $langs->load("dict"); @@ -385,6 +391,7 @@ class FormCompany } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return combo list with people title * @@ -393,9 +400,9 @@ class FormCompany * @param string $morecss Add more css on SELECT element * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_civility($selected='',$htmlname='civility_id',$morecss='maxwidth100') { + // phpcs:enable global $conf,$langs,$user; $langs->load("dict"); @@ -442,6 +449,7 @@ class FormCompany return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne. * Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays. @@ -453,12 +461,13 @@ class FormCompany * @deprecated Use print xxx->select_juridicalstatus instead * @see select_juridicalstatus() */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_forme_juridique($selected='', $country_codeid=0, $filter='') { + // phpcs:enable print $this->select_juridicalstatus($selected, $country_codeid, $filter); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Retourne la liste deroulante des formes juridiques tous pays confondus ou pour un pays donne. * Dans le cas d'une liste tous pays confondu, on affiche une rupture sur le pays @@ -469,9 +478,9 @@ class FormCompany * @param string $htmlname HTML name of select * @return string String with HTML select */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code') { + // phpcs:enable global $conf,$langs,$user; $langs->load("dict"); @@ -754,6 +763,7 @@ class FormCompany } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a select list with zip codes and their town * @@ -766,9 +776,9 @@ class FormCompany * @param string $morecss More css * @return string */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='',$morecss='') { + // phpcs:enable global $conf; $out=''; @@ -786,6 +796,7 @@ class FormCompany return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return HTML string to use as input of professional id into a HTML page (siren, siret, etc...) * @@ -796,9 +807,9 @@ class FormCompany * @param string $morecss More css * @return string HTML string with prof id */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_input_id_prof($idprof,$htmlname,$preselected,$country_code,$morecss='maxwidth100onsmartphone quatrevingtpercent') { + // phpcs:enable global $conf,$langs; $formlength=0; @@ -837,6 +848,7 @@ class FormCompany return $out; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a HTML select with localtax values for thirdparties * @@ -845,13 +857,13 @@ class FormCompany * @param string $htmlname HTML select name * @return void */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_localtax($local, $selected, $htmlname) { - $tax=get_localtax_by_third($local); + // phpcs:enable + $tax=get_localtax_by_third($local); - $num = $this->db->num_rows($tax); - $i = 0; + $num = $this->db->num_rows($tax); + $i = 0; if ($num) { $valors=explode(":", $tax); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 2481e9b457b..113f5a6f278 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -344,14 +344,15 @@ class SMTPs $_aryToList = $this->getTO(); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attempt a connection to mail server * * @return mixed $_retVal Boolean indicating success or failure on connection */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _server_connect() { + // phpcs:enable // Default return value $_retVal = true; @@ -407,14 +408,15 @@ class SMTPs return $_retVal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Attempt mail server authentication for a secure connection * * @return boolean|null $_retVal Boolean indicating success or failure of authentication */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _server_authenticate() { + // phpcs:enable global $conf; // Send the RFC2554 specified EHLO. @@ -1038,6 +1040,7 @@ class SMTPs $this->_msgRecipients = $aryHost; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array of the various parts of an email address * This assumes a well formed address: @@ -1054,9 +1057,9 @@ class SMTPs * @param string $_strAddr Email address * @return array An array of the various parts of an email address */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _strip_email($_strAddr) { + // phpcs:enable // Keep the orginal $_aryEmail['org'] = $_strAddr; @@ -1090,6 +1093,7 @@ class SMTPs return $_aryEmail; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array of bares addresses for use with 'RCPT TO:' * This is a "build as you go" method. Each time this method is called @@ -1097,9 +1101,9 @@ class SMTPs * * @return array Returns an array of bares addresses */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_RCPT_list() { + // phpcs:enable /** * An array of bares addresses for use with 'RCPT TO:' */ @@ -1121,15 +1125,16 @@ class SMTPs return $_RCPT_list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Returns an array of addresses for a specific type; TO, CC or BCC * * @param string $_which Which collection of addresses to return ('to', 'cc', 'bcc') * @return string|false Array of emaill address */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_email_list($_which = null) { + // phpcs:enable // We need to know which address segment to pull if ( $_which ) { @@ -1750,6 +1755,7 @@ class SMTPs else if ($type == 'alternative') return $this->_smtpsAlternativeBoundary; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This function has been modified as provided by SirSir to allow multiline responses when * using SMTP Extensions @@ -1758,9 +1764,9 @@ class SMTPs * @param string $response Response. Example: "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3" * @return boolean True or false */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function server_parse($socket, $response) { + // phpcs:enable /** * Returns constructed SELECT Object string or boolean upon failure * Default value is set at true @@ -1792,6 +1798,7 @@ class SMTPs return $_retVal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Send str * @@ -1800,9 +1807,9 @@ class SMTPs * @param string $CRLF CRLF * @return boolean|null True or false */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function socket_send_str( $_strSend, $_returnCode = null, $CRLF = "\r\n" ) { + // phpcs:enable if ($this->_debug) $this->log.=$_strSend; // @CHANGE LDR for log fputs($this->socket, $_strSend . $CRLF); if ($this->_debug) $this->log.=' ('.$_returnCode.')' . $CRLF; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index be6bb0888d2..78a3b91279e 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -359,20 +359,24 @@ class DoliDBPgsql extends DoliDB return $line; } - /** - * Select a database + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Select a database * Ici postgresql n'a aucune fonction equivalente de mysql_select_db * On compare juste manuellement si la database choisie est bien celle activee par la connexion * * @param string $database Name of database * @return bool true if OK, false if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function select_db($database) { - if ($database == $this->database_name) return true; - else return false; - } + // phpcs:enable + if ($database == $this->database_name) { + return true; + } else { + return false; + } + } /** * Connexion to server @@ -541,63 +545,68 @@ class DoliDBPgsql extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la ligne courante (comme un objet) pour le curseur resultset * * @param resource $resultset Curseur de la requete voulue * @return false|object Object result line or false if KO or end of cursor */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_object($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return pg_fetch_object($resultset); } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return datas as an array * * @param resource $resultset Resultset of request * @return false|array Array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_array($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return pg_fetch_array($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return datas as an array * * @param resource $resultset Resultset of request * @return false|array Array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function fetch_row($resultset) { + // phpcs:enable // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return pg_fetch_row($resultset); } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Return number of lines for result of a SELECT * * @param resourse $resultset Resulset of requests * @return int Nb of lines, -1 on error * @see affected_rows - */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + */ function num_rows($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } return pg_num_rows($resultset); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE * @@ -605,9 +614,9 @@ class DoliDBPgsql extends DoliDB * @return int Nb of lines * @see num_rows */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function affected_rows($resultset) { + // phpcs:enable // If resultset not provided, we take the last used by connexion if (! is_resource($resultset)) { $resultset=$this->_results; } // pgsql necessite un resultset pour cette fonction contrairement @@ -760,6 +769,7 @@ class DoliDBPgsql extends DoliDB return pg_last_error($this->db); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get last ID after an insert INSERT * @@ -767,9 +777,9 @@ class DoliDBPgsql extends DoliDB * @param string $fieldid Field name * @return string Id of row */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function last_insert_id($tab,$fieldid='rowid') { + // phpcs:enable //$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab); $result = pg_query($this->db,"SELECT currval('".$tab."_".$fieldid."_seq')"); if (! $result) @@ -826,19 +836,21 @@ class DoliDBPgsql extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return connexion ID * * @return string Id connexion */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLGetConnectId() { + // phpcs:enable return '?'; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new database * Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated @@ -850,9 +862,9 @@ class DoliDBPgsql extends DoliDB * @param string $owner Username of database owner * @return false|resource resource defined if OK, null if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateDb($database,$charset='',$collation='',$owner='') { + // phpcs:enable if (empty($charset)) $charset=$this->forcecharset; if (empty($collation)) $collation=$this->forcecollate; @@ -865,6 +877,7 @@ class DoliDBPgsql extends DoliDB return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List tables into a database * @@ -872,9 +885,9 @@ class DoliDBPgsql extends DoliDB * @param string $table Name of table filter ('xxx%') * @return array List of tables in an array */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLListTables($database, $table='') - { + { + // phpcs:enable $listtables=array(); $like = ''; @@ -890,6 +903,7 @@ class DoliDBPgsql extends DoliDB return $listtables; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List information of columns into a table. * @@ -897,9 +911,9 @@ class DoliDBPgsql extends DoliDB * @return array Tableau des informations des champs de la table * */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLInfoTable($table) { + // phpcs:enable $infotables=array(); $sql="SELECT "; @@ -931,6 +945,7 @@ class DoliDBPgsql extends DoliDB } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a table into database * @@ -943,9 +958,9 @@ class DoliDBPgsql extends DoliDB * @param array $keys Tableau des champs cles noms => valeur * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys=null,$fulltext_keys=null,$keys=null) { + // phpcs:enable // FIXME: $fulltext_keys parameter is unused // cles recherchees dans le tableau des descriptions (fields) : type,value,attribute,null,default,extra @@ -1011,15 +1026,16 @@ class DoliDBPgsql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a table into database * * @param string $table Name of table * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropTable($table) { + // phpcs:enable $sql = "DROP TABLE ".$table; if (! $this->query($sql)) @@ -1028,6 +1044,7 @@ class DoliDBPgsql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a user to connect to database * @@ -1037,9 +1054,9 @@ class DoliDBPgsql extends DoliDB * @param string $dolibarr_main_db_name Database name where user must be granted * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name) { + // phpcs:enable // Note: using ' on user does not works with pgsql $sql = "CREATE USER ".$this->escape($dolibarr_main_db_user)." with password '".$this->escape($dolibarr_main_db_pass)."'"; @@ -1053,6 +1070,7 @@ class DoliDBPgsql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return a pointer of line with description of a table or field * @@ -1060,9 +1078,9 @@ class DoliDBPgsql extends DoliDB * @param string $field Optionnel : Name of field if we want description of field * @return false|resource Resultset x (x->attname) */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDescTable($table,$field="") { + // phpcs:enable $sql ="SELECT attname FROM pg_attribute, pg_type WHERE typname = '".$table."' AND attrelid = typrelid"; $sql.=" AND attname NOT IN ('cmin', 'cmax', 'ctid', 'oid', 'tableoid', 'xmin', 'xmax')"; if ($field) $sql.= " AND attname = '".$field."'"; @@ -1072,6 +1090,7 @@ class DoliDBPgsql extends DoliDB return $this->_results; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a new field into table * @@ -1081,37 +1100,38 @@ class DoliDBPgsql extends DoliDB * @param string $field_position Optionnel ex.: "after champtruc" * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLAddField($table,$field_name,$field_desc,$field_position="") { + // phpcs:enable // cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // ex. : $field_desc = array('type'=>'int','value'=>'11','null'=>'not null','extra'=> 'auto_increment'); $sql= "ALTER TABLE ".$table." ADD ".$field_name." "; $sql .= $field_desc['type']; - if(preg_match("/^[^\s]/i",$field_desc['value'])) + if (preg_match("/^[^\s]/i",$field_desc['value'])) if (! in_array($field_desc['type'],array('int','date','datetime'))) { $sql.= "(".$field_desc['value'].")"; } if (preg_match("/^[^\s]/i",$field_desc['attribute'])) - $sql .= " ".$field_desc['attribute']; + $sql .= " ".$field_desc['attribute']; if (preg_match("/^[^\s]/i",$field_desc['null'])) - $sql .= " ".$field_desc['null']; + $sql .= " ".$field_desc['null']; if (preg_match("/^[^\s]/i",$field_desc['default'])) - if (preg_match("/null/i",$field_desc['default'])) - $sql .= " default ".$field_desc['default']; - else - $sql .= " default '".$field_desc['default']."'"; + if (preg_match("/null/i",$field_desc['default'])) + $sql .= " default ".$field_desc['default']; + else + $sql .= " default '".$field_desc['default']."'"; if (preg_match("/^[^\s]/i",$field_desc['extra'])) - $sql .= " ".$field_desc['extra']; + $sql .= " ".$field_desc['extra']; $sql .= " ".$field_position; dol_syslog($sql,LOG_DEBUG); - if(! $this -> query($sql)) + if (! $this -> query($sql)) return -1; return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Update format of a field into a table * @@ -1120,9 +1140,9 @@ class DoliDBPgsql extends DoliDB * @param string $field_desc Array with description of field format * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLUpdateField($table,$field_name,$field_desc) { + // phpcs:enable $sql = "ALTER TABLE ".$table; $sql .= " MODIFY COLUMN ".$field_name." ".$field_desc['type']; if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int' || $field_desc['type'] == 'varchar') { @@ -1156,6 +1176,7 @@ class DoliDBPgsql extends DoliDB return 1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Drop a field from table * @@ -1163,9 +1184,9 @@ class DoliDBPgsql extends DoliDB * @param string $field_name Name of field to drop * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function DDLDropField($table,$field_name) { + // phpcs:enable $sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name; dol_syslog($sql,LOG_DEBUG); if (! $this->query($sql)) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index f7d0ce19f61..0e954cfc28e 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -98,6 +98,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc */ function write_file($object, $outputlangs, $srctemplatepath='', $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { + // phpcs:enable global $conf, $hookmanager, $langs, $user, $mysoc; if (! is_object($outputlangs)) $outputlangs=$langs; @@ -464,6 +465,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Show area for the customer to sign * @@ -473,9 +475,9 @@ class pdf_sepamandate extends ModeleBankAccountDoc * @param Translate $outputlangs Objet langs * @return int Position pour suite */ - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function _signature_area(&$pdf, $object, $posy, $outputlangs) { + // phpcs:enable $default_font_size = pdf_getPDFFontSize($outputlangs); $tab_top = $posy + 4; $tab_hl = 4; diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index a66c2c9f985..8ff489cc5fa 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -131,13 +131,14 @@ class mod_commande_marbre extends ModeleNumRefCommandes $yymm = strftime("%y%m",$date); if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is - else $num = sprintf("%04s",$max+1); + else $num = sprintf("%04s", $max+1); dol_syslog("mod_commande_marbre::getNextValue return ".$this->prefix.$yymm."-".$num); return $this->prefix.$yymm."-".$num; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return next free value * @@ -145,9 +146,9 @@ class mod_commande_marbre extends ModeleNumRefCommandes * @param string $objforref Object for number to search * @return string Next free value */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function commande_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/contract/mod_contract_magre.php b/htdocs/core/modules/contract/mod_contract_magre.php index ffa75f4f3ba..72c8c5bef23 100644 --- a/htdocs/core/modules/contract/mod_contract_magre.php +++ b/htdocs/core/modules/contract/mod_contract_magre.php @@ -117,16 +117,17 @@ class mod_contract_magre extends ModelNumRefContracts return $numFinal; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return next value + * Return next value * * @param Societe $objsoc third party object * @param Object $objforref contract object * @return string Value if OK, 0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function contract_get_num($objsoc,$objforref) { + // phpcs:enable return $this->getNextValue($objsoc,$objforref); } } diff --git a/htdocs/core/modules/export/export_tsv.modules.php b/htdocs/core/modules/export/export_tsv.modules.php index db96382a04a..4b57d5f7fcf 100644 --- a/htdocs/core/modules/export/export_tsv.modules.php +++ b/htdocs/core/modules/export/export_tsv.modules.php @@ -145,6 +145,7 @@ class ExportTsv extends ModeleExports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Open output file * @@ -152,14 +153,14 @@ class ExportTsv extends ModeleExports * @param Translate $outputlangs Output language object * @return int <0 if KO, >=0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function open_file($file,$outputlangs) + function open_file($file,$outputlangs) { + // phpcs:enable global $langs; dol_syslog("ExportTsv::open_file file=".$file); - $ret=1; + $ret=1; $outputlangs->load("exports"); $this->handle = fopen($file, "wt"); @@ -173,20 +174,22 @@ class ExportTsv extends ModeleExports return $ret; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output header into file * * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_header($outputlangs) { + // phpcs:enable return 0; } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** * Output title line into file * * @param array $array_export_fields_label Array with list of label of fields @@ -195,9 +198,9 @@ class ExportTsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_title($array_export_fields_label,$array_selected_sorted,$outputlangs,$array_types) { + // phpcs:enable foreach($array_selected_sorted as $code => $value) { $newvalue=$outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded @@ -210,6 +213,7 @@ class ExportTsv extends ModeleExports } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output record line into file * @@ -219,9 +223,9 @@ class ExportTsv extends ModeleExports * @param array $array_types Array with types of fields * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_record($array_selected_sorted,$objp,$outputlangs,$array_types) { + // phpcs:enable global $conf; $this->col=0; @@ -253,40 +257,43 @@ class ExportTsv extends ModeleExports return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Output footer into file * * @param Translate $outputlangs Output language object * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_footer($outputlangs) { + // phpcs:enable return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Close file handle * * @return int <0 if KO, >0 if OK */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function close_file() { + // phpcs:enable fclose($this->handle); return 0; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Clean a cell to respect rules of TSV file cells * * @param string $newvalue String to clean - * @param string $charset Input AND Output character set + * @param string $charset Input AND Output character set * @return string Value cleaned */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function tsv_clean($newvalue, $charset) { + // phpcs:enable // Rule Dolibarr: No HTML $newvalue=dol_string_nohtmltag($newvalue, 1, $charset); @@ -300,6 +307,6 @@ class ExportTsv extends ModeleExports $newvalue=str_replace("\t"," ",$newvalue); } - return $newvalue; + return $newvalue; } } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index aaec15d6672..c51e0452481 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -151,6 +151,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->posxdesc=$this->marge_gauche+1; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build pdf onto disk * @@ -162,9 +163,9 @@ class pdf_soleil extends ModelePDFFicheinter * @param int $hideref Do not show ref * @return int 1=OK, 0=KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$db,$hookmanager; if (! is_object($outputlangs)) $outputlangs=$langs; diff --git a/htdocs/core/modules/import/modules_import.php b/htdocs/core/modules/import/modules_import.php index 5bf74ba48d1..a5d73031b7a 100644 --- a/htdocs/core/modules/import/modules_import.php +++ b/htdocs/core/modules/import/modules_import.php @@ -143,16 +143,17 @@ class ModeleImports } - /** - * Charge en memoire et renvoie la liste des modeles actifs - * + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Charge en memoire et renvoie la liste des modeles actifs + * * @param DoliDB $db Database handler * @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 dol_syslog(get_class($this)."::liste_modeles"); $dir=DOL_DOCUMENT_ROOT."/core/modules/import/"; diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 45f404f276e..ace0c97401a 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -327,16 +327,17 @@ class mailing_contacts1 extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * - * @param int $mailing_id Id of emailing + * @param int $mailing_id Id of emailing * @param array $filtersarray Optional filter data (deprecated) * @return int <0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function add_to_target($mailing_id,$filtersarray=array()) { + // phpcs:enable global $conf, $langs; $filter = GETPOST('filter','alpha'); diff --git a/htdocs/core/modules/mailings/example.modules.php b/htdocs/core/modules/mailings/example.modules.php index af4073038cd..0af52dc5bd2 100644 --- a/htdocs/core/modules/mailings/example.modules.php +++ b/htdocs/core/modules/mailings/example.modules.php @@ -37,7 +37,7 @@ class mailing_example extends MailingTargets var $require_module=array(); var $picto=''; - + /** * @var DoliDB Database handler. */ @@ -56,6 +56,7 @@ class mailing_example extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * This is the main function that returns the array of emails * @@ -63,9 +64,9 @@ class mailing_example extends MailingTargets * @param array $filtersarray If you used the formFilter function. Empty otherwise. * @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(); // CHANGE THIS @@ -112,7 +113,7 @@ class mailing_example extends MailingTargets */ function getNbOfRecipients($sql='') { - // CHANGE THIS: Optionnal + // CHANGE THIS: Optionnal // Example: return parent::getNbOfRecipients("SELECT count(*) as nb from dolibarr_table"); // Example: return 500; @@ -127,7 +128,7 @@ class mailing_example extends MailingTargets */ function formFilter() { - // CHANGE THIS: Optionnal + // CHANGE THIS: Optionnal $s=''; return $s; @@ -143,7 +144,7 @@ class mailing_example extends MailingTargets */ function url($id) { - // CHANGE THIS: Optionnal + // CHANGE THIS: Optionnal return ''; } diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index 29e8de8bb98..11ff4812d67 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -146,6 +146,7 @@ class mailing_pomme extends MailingTargets } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Ajoute destinataires dans table des cibles * @@ -153,9 +154,9 @@ class mailing_pomme extends MailingTargets * @param array $filtersarray Requete sql de selection des destinataires * @return int < 0 si erreur, nb ajout si ok */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function add_to_target($mailing_id,$filtersarray=array()) + function add_to_target($mailing_id, $filtersarray=array()) { + // phpcs:enable // Deprecation warning if ($filtersarray) { dol_syslog(__METHOD__ . ": filtersarray parameter is deprecated", LOG_WARNING); diff --git a/htdocs/core/modules/printing/modules_printing.php b/htdocs/core/modules/printing/modules_printing.php index 97cd483e680..afd46919598 100644 --- a/htdocs/core/modules/printing/modules_printing.php +++ b/htdocs/core/modules/printing/modules_printing.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2018 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ class PrintingDriver * @var DoliDB Database handler. */ public $db; - + /** * @var string Error code (or message) */ diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 3363755139f..e70cfd76211 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -1,6 +1,6 @@ + * Copyright (C) 2014-2018 Frederic France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ /** * \file htdocs/core/modules/printing/printipp.modules.php - * \ingroup mailing + * \ingroup printing * \brief File to provide printing with PrintIPP */ @@ -40,17 +40,17 @@ class printing_printipp extends PrintingDriver var $userid; /* user login */ var $user; var $password; - + /** - * @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(); + /** * @var DoliDB Database handler. */ @@ -78,6 +78,7 @@ class printing_printipp extends PrintingDriver $this->conf[] = array('enabled'=>1, 'type'=>'submit'); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Print selected file * @@ -87,9 +88,9 @@ class printing_printipp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function print_file($file, $module, $subdir='') { + // phpcs:enable global $conf, $user; $error = 0; @@ -118,11 +119,11 @@ class printing_printipp extends PrintingDriver { if (! empty($conf->global->PRINTIPP_URI_DEFAULT)) { - dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT); + dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT); $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); } else - { + { $this->errors[] = 'NoDefaultPrinterDefined'; $error++; return $error; @@ -195,24 +196,25 @@ class printing_printipp extends PrintingDriver $html.= img_picto($langs->trans("Default"),'on'); } else - { - $html.= ''.img_picto($langs->trans("Disabled"),'off').''; - } - $html.= ''; + { + $html.= ''.img_picto($langs->trans("Disabled"),'off').''; + } + $html.= ''; $html.= ''."\n"; } $this->resprint = $html; return $error; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of available printers * * @return array list of printers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function getlist_available_printers() { + // phpcs:enable global $conf,$db; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; $ipp = new CupsPrintIPP(); @@ -225,15 +227,16 @@ class printing_printipp extends PrintingDriver return $ipp->available_printers; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Get printer detail * * @param string $uri URI * @return array List of attributes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_printer_detail($uri) { + // phpcs:enable global $conf,$db; include_once DOL_DOCUMENT_ROOT.'/includes/printipp/CupsPrintIPP.php'; @@ -248,6 +251,7 @@ class printing_printipp extends PrintingDriver return $ipp->printer_attributes; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * List jobs print * @@ -255,9 +259,9 @@ class printing_printipp extends PrintingDriver * * @return int 0 if OK, >0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function list_jobs($module) { + // phpcs:enable global $conf, $db, $bc; $error = 0; $html = ''; diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 8c86e4ec5d1..ddf061d95e9 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -30,7 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; /** - * Parent class of document generator for address sheet. + * Parent class of document generator for address sheet. */ class ModelePDFLabels { @@ -40,16 +40,17 @@ class ModelePDFLabels public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @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='members_labels'; @@ -63,6 +64,7 @@ class ModelePDFLabels } +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a document onto disk according to template module. * @@ -75,9 +77,9 @@ class ModelePDFLabels * @param string $filename Short file name of PDF output file * @return int <0 if KO, >0 if OK */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='', $template='standardlabel', $filename='tmp_address_sheet.pdf') { + // phpcs:enable global $conf,$langs; $langs->load("members"); diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index adb0c821390..33fce830397 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -143,16 +143,17 @@ class mod_project_simple extends ModeleNumRefProjects } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return next reference not yet used as a reference + * Return next reference not yet used as a reference * * @param Societe $objsoc Object third party * @param Project $project Object project * @return string Next not used reference */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function project_get_num($objsoc=0,$project='') { + // phpcs:enable return $this->getNextValue($objsoc,$project); } } diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 539683e8c18..76cade72785 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -143,14 +143,14 @@ class mod_task_simple extends ModeleNumRefTask } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Return next reference not yet used as a reference + * Return next reference not yet used as a reference * - * @param Societe $objsoc Object third party - * @param Task $object Object task - * @return string Next not used reference + * @param Societe $objsoc Object third party + * @param Task $object Object task + * @return string Next not used reference */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function task_get_num($objsoc=0,$object='') { return $this->getNextValue($objsoc,$object); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 285b7b2db82..ebefc97da43 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -164,6 +164,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc return $texte; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Function to build a document on disk using the generic odt module. * @@ -175,9 +176,9 @@ class doc_generic_odt extends ModeleThirdPartyDoc * @param int $hideref Do not show ref * @return int 1 if OK, <=0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0) { + // phpcs:enable global $user,$langs,$conf,$mysoc,$hookmanager; if (empty($srctemplatepath)) diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index c0ff3b0e5fc..692dcbf185c 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -38,23 +38,24 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator */ public $error=''; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Return list of active generation modules * - * @param DoliDB $db Database handler + * @param DoliDB $db Database handler * @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='company'; $liste=array(); include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $liste=getListOfModels($db,$type,$maxfilenamelength); + $liste = getListOfModels($db,$type,$maxfilenamelength); return $liste; } @@ -67,7 +68,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator abstract class ModeleThirdPartyCode { /** - * @var string Error code (or message) + * @var string Error code (or message) */ public $error=''; @@ -144,6 +145,7 @@ abstract class ModeleThirdPartyCode return $langs->trans("NotAvailable"); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoie la liste des modeles de numérotation * @@ -151,9 +153,9 @@ abstract class ModeleThirdPartyCode * @param integer $maxfilenamelength Max length of value to show * @return array List of numbers */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps static function liste_modeles($db,$maxfilenamelength=0) { + // phpcs:enable $liste=array(); $sql =""; @@ -177,12 +179,12 @@ abstract class ModeleThirdPartyCode } /** - * Return description of module parameters + * Return description of module parameters * - * @param Translate $langs Output language - * @param Societe $soc Third party object - * @param int $type -1=Nothing, 0=Customer, 1=Supplier - * @return string HTML translated description + * @param Translate $langs Output language + * @param Societe $soc Third party object + * @param int $type -1=Nothing, 0=Customer, 1=Supplier + * @return string HTML translated description */ function getToolTip($langs,$soc,$type) { @@ -243,14 +245,15 @@ abstract class ModeleThirdPartyCode return $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Check if mask/numbering use prefix * * @return int 0=no, 1=yes */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function verif_prefixIsUsed() { + // phpcs:enable return 0; } } @@ -355,6 +358,7 @@ abstract class ModeleAccountancyCode return $s; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Set accountancy account code for a third party into this->code * @@ -363,10 +367,10 @@ abstract class ModeleAccountancyCode * @param int $type 'customer' or 'supplier' * @return int >=0 if OK, <0 if KO */ - // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_code($db, $societe, $type='') { - global $langs; + // phpcs:enable + global $langs; return $langs->trans("NotAvailable"); } @@ -374,6 +378,7 @@ abstract class ModeleAccountancyCode +// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Create a document onto disk according to template module. * @@ -389,9 +394,9 @@ abstract class ModeleAccountancyCode * @deprecated Use the new function generateDocument of Facture class * @see Societe::generateDocument() */ -// phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function thirdparty_doc_create(DoliDB $db, Societe $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { + // phpcs:enable dol_syslog(__METHOD__ . " is deprecated", LOG_WARNING); return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref); diff --git a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php index da9b826cab3..df7c5ba7553 100644 --- a/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php +++ b/htdocs/core/modules/supplier_proposal/modules_supplier_proposal.php @@ -42,16 +42,17 @@ abstract class ModelePDFSupplierProposal extends CommonDocGenerator public $error=''; - /** - * Return list of active generation modules - * + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps + /** + * Return list of active generation modules + * * @param DoliDB $db Database handler * @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='supplier_proposal'; From b4691df8d95b96bf4448f4a7d30cbb9d47c1be4a Mon Sep 17 00:00:00 2001 From: ias-ceo Date: Mon, 10 Sep 2018 17:29:29 +0200 Subject: [PATCH 32/49] use correct resultset --- htdocs/core/modules/modAgenda.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 15a6b361079..684472d82c4 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -90,7 +90,7 @@ class modAgenda extends DolibarrModules $resql = $this->db->query($sqlreadactions); if ($resql) { - while ($obj = $this->db->fetch_object($sqlreadactions)) + while ($obj = $this->db->fetch_object($resql)) { //if (preg_match('/_CREATE$/',$obj->code) && (! in_array($obj->code, array('COMPANY_CREATE','PRODUCT_CREATE','TASK_CREATE')))) continue; // We don't track such events (*_CREATE) by default, we prefer validation (except thirdparty/product/task creation because there is no validation). if (preg_match('/^TASK_/',$obj->code)) continue; // We don't track such events by default. From 5f1b3fbc12aef681073a31f8653e37a033fdafbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 10 Sep 2018 20:18:16 +0200 Subject: [PATCH 33/49] add stripe user for actions --- htdocs/langs/en_US/stripe.lang | 5 ++-- htdocs/public/stripe/ipn.php | 42 +++++++++++++++++++++++++++------- htdocs/stripe/admin/stripe.php | 12 ++++++++-- 3 files changed, 47 insertions(+), 12 deletions(-) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index ecd176a0ae7..5eb1c803829 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -22,7 +22,7 @@ ToOfferALinkForOnlinePaymentOnContractLine=URL to offer a %s online payment user ToOfferALinkForOnlinePaymentOnFreeAmount=URL to offer a %s online payment user interface for a free amount ToOfferALinkForOnlinePaymentOnMemberSubscription=URL to offer a %s online payment user interface for a member subscription YouCanAddTagOnUrl=You can also add url parameter &tag=value to any of those URL (required only for free payment) to add your own payment comment tag. -SetupStripeToHavePaymentCreatedAutomatically=Setup your Stripe with url %s to have payment created automatically when validated by Stripe. +SetupStripeToHavePaymentCreatedAutomatically=Setup your Stripe with url %s to have payment created automatically when validated by Stripe. AccountParameter=Account parameters UsageParameter=Usage parameters InformationToFindParameters=Help to find your %s account information @@ -60,4 +60,5 @@ DeleteACard=Delete Card ConfirmDeleteCard=Are you sure you want to delete this Credit or Debit card? CreateCustomerOnStripe=Create customer on Stripe CreateCardOnStripe=Create card on Stripe -ShowInStripe=Show in Stripe \ No newline at end of file +ShowInStripe=Show in Stripe +StripeUserAccountForActions=User account for Stripe actions diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index faca27f78c7..fd4049143ad 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2018 Thibault FOUCART + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; +require_once DOL_DOCUMENT_ROOT .'/core/class/CMailFile.class.php'; // You can find your endpoint's secret in your webhook settings if (isset($_GET['connect'])){ @@ -88,7 +90,7 @@ catch(\UnexpectedValueException $e) { http_response_code(200); // PHP 5.4 or greater $langs->load("main"); $user = new User($db); -$user->fetch(5); +$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) { @@ -126,12 +128,36 @@ if ($event->type == 'payout.created') { if ($result > 0) { - // TODO Use CMail and translation - $body = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); - $subject = '[NOTIFICATION] Virement programmée'; - $headers = 'From: "'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; // TODO convert in dolibarr standard - mail(''.$conf->global->MAIN_INFO_SOCIETE_MAIL.'', $subject, $body, $headers); - return 1; + $subject = '[NOTIFICATION] Virement programmée'; + if (!empty($user->email)) { + $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; + } else { + $sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + $sendtocc = ''; + if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) { + $sendtocc = $conf->global->ONLINE_PAYMENT_SENDEMAIL.'" <'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'>'; + } + + $message = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); + + $mailfile = new CMailFile( + $subject, + $sendto, + $replyto, + $message, + array(), + array(), + array(), + $sendtocc, + '', + 0, + -1 + ); + + $ret = $mailfile->sendfile()) + + return 1; } else { diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 19d12a33005..8b5a92c0092 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -70,7 +70,11 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_PAYMENTS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_USER_ACCOUNT_FOR_ACTIONS", GETPOST('STRIPE_USER_ACCOUNT_FOR_ACTIONS', 'int'), 'chaine', 0, '', $conf->entity); + if (! $result > 0) { + $error ++; + } + $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); @@ -251,6 +255,11 @@ print 'name; print ''; +print ''; +print $langs->trans("StripeUserAccountForActions").''; +print $form->select_dolusers($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS, 'STRIPE_USER_ACCOUNT_FOR_ACTIONS', 0); +print ''; + print ''; print $langs->trans("BankAccount").''; print $form->select_comptes($conf->global->STRIPE_BANK_ACCOUNT_FOR_PAYMENTS, 'STRIPE_BANK_ACCOUNT_FOR_PAYMENTS', 0, '', 1); @@ -357,4 +366,3 @@ if (! empty($conf->use_javascript_ajax)) // End of page llxFooter(); $db->close(); - From afdf87603b8dcd06dcadec92512c21f4a1a4b04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 10 Sep 2018 20:50:10 +0200 Subject: [PATCH 34/49] add stripe user for actions --- htdocs/public/stripe/ipn.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index fd4049143ad..9c7941ff5e7 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -134,6 +134,7 @@ if ($event->type == 'payout.created') { } else { $sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; } + $replyto = $sendto; $sendtocc = ''; if (!empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) { $sendtocc = $conf->global->ONLINE_PAYMENT_SENDEMAIL.'" <'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'>'; From a8cfc6be3f486e91225cf5bd20ee75fbd7fb1cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 10 Sep 2018 20:55:20 +0200 Subject: [PATCH 35/49] add stripe user for actions --- htdocs/stripe/admin/stripe.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index 8b5a92c0092..6a4dd8713f7 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -3,6 +3,7 @@ * Copyright (C) 2017 Olivier Geffroy * Copyright (C) 2017 Saasprov * Copyright (C) 2018 ptibogxiv + * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -77,7 +78,7 @@ if ($action == 'setvalue' && $user->admin) $result = dolibarr_set_const($db, "STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS", GETPOST('STRIPE_BANK_ACCOUNT_FOR_BANKTRANSFERS', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; - $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "STRIPE_MINIMAL_3DSECURE", GETPOST('STRIPE_MINIMAL_3DSECURE', 'int'), 'chaine', 0, '', $conf->entity); if (! $result > 0) $error ++; $result = dolibarr_set_const($db, "ONLINE_PAYMENT_CSS_URL", GETPOST('ONLINE_PAYMENT_CSS_URL', 'alpha'), 'chaine', 0, '', $conf->entity); @@ -120,10 +121,8 @@ if ($action == 'setvalue' && $user->admin) if ($action=="setlive") { $liveenable = GETPOST('value','int'); - $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable,'yesno',0,'',$conf->entity); - if (! $res > 0) $error++; - if (! $error) - { + $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity); + if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } else From 312a606345a40b2164e024b485e88aa1416f0880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 10 Sep 2018 23:50:48 +0200 Subject: [PATCH 36/49] deprecate formbarcode:select_barcode_type --- htdocs/admin/barcode.php | 4 +- htdocs/barcode/printsheet.php | 28 ++--- htdocs/core/class/html.formbarcode.class.php | 108 ++++++++++--------- htdocs/product/card.php | 4 +- 4 files changed, 77 insertions(+), 67 deletions(-) diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 4e0c683a73f..519f2b42938 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -306,7 +306,7 @@ if (! empty($conf->product->enabled)) print ''; print ''.$langs->trans("SetDefaultBarcodeTypeProducts").''; print ''; - $formbarcode->select_barcode_type($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE,"PRODUIT_DEFAULT_BARCODE_TYPE",1); + print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1); print ''; } @@ -317,7 +317,7 @@ if (! empty($conf->societe->enabled)) print ''; print ''.$langs->trans("SetDefaultBarcodeTypeThirdParties").''; print ''; - print $formbarcode->select_barcode_type($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY,"GENBARCODE_BARCODETYPE_THIRDPARTY",1); + print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1); print ''; } diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 6dd578993ca..a1f3632fd2f 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -178,19 +178,19 @@ if ($action == 'builddoc') { // List of values to scan for a replacement $substitutionarray = array ( - '%LOGIN%'=>$user->login, - '%COMPANY%'=>$mysoc->name, - '%ADDRESS%'=>$mysoc->address, - '%ZIP%'=>$mysoc->zip, - '%TOWN%'=>$mysoc->town, - '%COUNTRY%'=>$mysoc->country, - '%COUNTRY_CODE%'=>$mysoc->country_code, - '%EMAIL%'=>$mysoc->email, - '%YEAR%'=>$year, - '%MONTH%'=>$month, - '%DAY%'=>$day, - '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, - '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/" + '%LOGIN%' => $user->login, + '%COMPANY%' => $mysoc->name, + '%ADDRESS%' => $mysoc->address, + '%ZIP%' => $mysoc->zip, + '%TOWN%' => $mysoc->town, + '%COUNTRY%' => $mysoc->country, + '%COUNTRY_CODE%' => $mysoc->country_code, + '%EMAIL%' => $mysoc->email, + '%YEAR%' => $year, + '%MONTH%' => $month, + '%DAY%' => $day, + '%DOL_MAIN_URL_ROOT%' => DOL_MAIN_URL_ROOT, + '%SERVER%' => "http://".$_SERVER["SERVER_NAME"]."/", ); complete_substitutions_array($substitutionarray, $langs); @@ -416,7 +416,7 @@ print $langs->trans("BarcodeType").'   '; print '
    '; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); -$formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); +print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print '
    '; // Barcode value diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 6780f01735a..7b0f7bd06fe 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -1,21 +1,22 @@ - * Copyright (C) 2008-2012 Laurent Destailleur -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -* -*/ +/* Copyright (C) 2007-2012 Regis Houssin + * Copyright (C) 2008-2012 Laurent Destailleur + * Copyright (C) 2018 Frédéric France + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ /** * \file htdocs/core/class/html.formbarcode.class.php @@ -32,11 +33,11 @@ class FormBarCode * @var DoliDB Database handler. */ public $db; - + /** - * @var string Error code (or message) - */ - public $error=''; + * @var string Error code (or message) + */ + public $error=''; /** @@ -104,17 +105,33 @@ class FormBarCode } /** - * Return form to select type of barcode + * Print form to select type of barcode * * @param int $selected Id code pre-selected * @param string $htmlname Name of HTML select field * @param int $useempty Affiche valeur vide dans liste * @return void + * @deprecated */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps - function select_barcode_type($selected='',$htmlname='barcodetype_id',$useempty=0) + function select_barcode_type($selected='', $htmlname='barcodetype_id', $useempty=0) { - global $langs,$conf; + print $this->selectBarcodeType($selected, $htmlname, $useempty); + } + + /** + * Return html form to select type of barcode + * + * @param int $selected Id code pre-selected + * @param string $htmlname Name of HTML select field + * @param int $useempty Display empty value in select + * @return string + */ + function selectBarcodeType($selected='', $htmlname='barcodetype_id', $useempty=0) + { + global $langs, $conf; + + $out = ''; $sql = "SELECT rowid, code, libelle"; $sql.= " FROM ".MAIN_DB_PREFIX."c_barcode_type"; @@ -123,44 +140,37 @@ class FormBarCode $sql.= " ORDER BY code"; $result = $this->db->query($sql); - if ($result) - { + if ($result) { $num = $this->db->num_rows($result); $i = 0; - if ($useempty && $num > 0) - { - print ''; + $out .= ''; + } else { $langs->load("errors"); - print ''; + $out .= ''; } - while ($i < $num) - { + while ($i < $num) { $obj = $this->db->fetch_object($result); - if ($selected == $obj->rowid) - { - print ''; + $out .= $obj->libelle; + $out .= ''; $i++; } - print ""; - print ajax_combobox("select_".$htmlname); + $out .= ""; + $out .= ajax_combobox("select_".$htmlname); } else { dol_print_error($this->db); } + return $out; } /** @@ -182,7 +192,7 @@ class FormBarCode print ''; print ''; print ''; print '
    '; - $this->select_barcode_type($selected, $htmlname, 1); + print $this->selectBarcodeType($selected, $htmlname, 1); print ''; print '
    '; diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 52815c1303d..a252a1ccafa 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -977,7 +977,7 @@ else } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); - print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); @@ -1343,7 +1343,7 @@ else } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; $formbarcode = new FormBarCode($db); - print $formbarcode->select_barcode_type($fk_barcode_type, 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType($fk_barcode_type, 'fk_barcode_type', 1); print ''.$langs->trans("BarcodeValue").''; $tmpcode=isset($_POST['barcode'])?GETPOST('barcode'):$object->barcode; if (empty($tmpcode) && ! empty($modBarCodeProduct->code_auto)) $tmpcode=$modBarCodeProduct->getNextValue($object,$type); From a36f41728f2ae61e67f05e993168d7fbfbb2f590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 10 Sep 2018 23:58:57 +0200 Subject: [PATCH 37/49] deprecate formbarcode:form_barcode_type --- htdocs/core/class/html.formbarcode.class.php | 39 ++++++++++++++------ htdocs/product/card.php | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 7b0f7bd06fe..78bcb35d863 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -180,22 +180,37 @@ class FormBarCode * @param int $selected Id condition preselected * @param string $htmlname Nom du formulaire select * @return void + * @deprecated */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function form_barcode_type($page, $selected='', $htmlname='barcodetype_id') { - global $langs,$conf; - if ($htmlname != "none") - { - print '
    '; - print ''; - print ''; - print ''; - print ''; - print '
    '; - print $this->selectBarcodeType($selected, $htmlname, 1); - print ''; - print '
    '; + print $this->formBarcodeType($page, $selected, $htmlname); + } + + /** + * Return html form to select type of barcode + * + * @param string $page Page + * @param int $selected Id condition preselected + * @param string $htmlname Nom du formulaire select + * @return string + */ + function formBarcodeType($page, $selected='', $htmlname='barcodetype_id') + { + global $langs, $conf; + $out = ''; + if ($htmlname != "none") { + $out .= '
    '; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= '
    '; + $out .= $this->selectBarcodeType($selected, $htmlname, 1); + $out .= ''; + $out .= '
    '; } + return $out; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index a252a1ccafa..d51a4fa494c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1639,7 +1639,7 @@ else } if ($action == 'editbarcodetype') { - $formbarcode->form_barcode_type($_SERVER['PHP_SELF'].'?id='.$object->id,$object->barcode_type,'fk_barcode_type'); + print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); } else { From cdc5a174aafdbac9fed20d7f1d87f0cb02855b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 Sep 2018 00:29:01 +0200 Subject: [PATCH 38/49] Update account.class.php --- htdocs/compta/bank/class/account.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index e66d6f73731..89e95203757 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -344,7 +344,7 @@ class Account extends CommonObject * @param int $fk_bank To search using bank transaction id * @param int $url_id To search using link to * @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 + * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ // phpcs:ignore PEAR.NamingConventions.ValidFunctionName.NotCamelCaps function get_url($fk_bank='', $url_id='', $type='') From 26a8b5ba4d25e8f7c4504a4535db4f85de8dd308 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Sep 2018 12:30:24 +0200 Subject: [PATCH 39/49] Update status display in charge list --- htdocs/stripe/charge.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 1464c9c2e6b..a97f989a37d 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -190,14 +190,16 @@ if (!$rowid) // Status print ''; if ($charge->refunded=='1'){ - print $langs->trans("refunded"); + print img_picto($langs->trans("refunded"),'statut6'); } elseif ($charge->paid=='1'){ - print $langs->trans("".$charge->status.""); + + print img_picto($langs->trans("".$charge->status.""),'statut4'); + } else { $label="Message: ".$charge->failure_message."
    "; $label.="Réseau: ".$charge->outcome->network_status."
    "; $label.="Statut: ".$langs->trans("".$charge->outcome->seller_message.""); - print $form->textwithpicto($langs->trans("".$charge->status.""),$label,1); + print $form->textwithpicto(img_picto($langs->trans("".$charge->status.""),'statut8'),$label,1); } print "\n"; From 30c393d2da3b6147963d9b3b2a9a1be4423e7a1b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 12 Sep 2018 11:28:43 +0200 Subject: [PATCH 40/49] better display/link of informations --- htdocs/stripe/charge.php | 42 ++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index a97f989a37d..b82d8d65a78 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -96,7 +96,7 @@ if (!$rowid) print ''; print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); - print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); + //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Origin",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"","","",'align="center"',$sortfield,$sortorder); @@ -120,20 +120,20 @@ if (!$rowid) foreach ($list->data as $charge) { // The metadata FULLTAG is defined by the online payment page - $FULLTAG=$charge->metadata->FULLTAG; + $FULLTAG=$charge->description; // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata - if (! empty($tmparray['CUS'])) + if (! empty($tmparray['CUS']) && $charge->metadata->dol_thirdparty_id) { - $societestatic->fetch($tmparray['CUS']); + $societestatic->fetch($charge->metadata->dol_thirdparty_id); } else { $societestatic->id = 0; } - if (! empty($tmparray['MEM'])) + if (! empty($tmparray['MEM']) && $charge->metadata->dol_thirdparty_id) { $memberstatic->fetch($tmparray['MEM']); } @@ -144,32 +144,40 @@ if (!$rowid) print ''; // Ref - print "".$charge->id."\n"; + $url='https://dashboard.stripe.com/test/payments/'.$charge->id; + if ($servicestatus) + { + $url='https://dashboard.stripe.com/payments/'.$charge->id; + } + print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."\n"; // Stripe customer - print "".$charge->customer."\n"; + //print "".$charge->customer."\n"; // Link print ""; if ($societestatic->id > 0) { print $societestatic->getNomUrl(1); } - if ($memberstatic->id > 0) + elseif ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); - } + } else print $charge->customer; print "\n"; // Origine print ""; - print $FULLTAG; - if ($charge->metadata->source=="order"){ + if ($charge->metadata->dol_type=="order"){ $object = new Commande($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_order')." ".$object->ref.""; - } elseif ($charge->metadata->source=="invoice"){ + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_order')." ".$object->ref.""; + } else print $FULLTAG; + } elseif ($charge->metadata->dol_type=="invoice"){ $object = new Facture($db); - $object->fetch($charge->metadata->idsource); - print "".img_picto('', 'object_invoice')." ".$object->ref.""; - } + $object->fetch($charge->metadata->dol_id); + if ($object->id > 0) { + print "".img_picto('', 'object_invoice')." ".$object->ref.""; + } else print $FULLTAG; + } else print $FULLTAG; print "\n"; // Date payment print ''.dol_print_date($charge->created,'%d/%m/%Y %H:%M')."\n"; From e89ff94d74e42a2fe07273bcf446d3beecf9b224 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 18:35:47 +0200 Subject: [PATCH 41/49] Update stripe.lang --- htdocs/langs/en_US/stripe.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 5eb1c803829..ed3d24f4370 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -61,4 +61,4 @@ ConfirmDeleteCard=Are you sure you want to delete this Credit or Debit card? CreateCustomerOnStripe=Create customer on Stripe CreateCardOnStripe=Create card on Stripe ShowInStripe=Show in Stripe -StripeUserAccountForActions=User account for Stripe actions +StripeUserAccountForActions=User account to use for some emails notification of Stripe events (Stripe payouts) From fb71edd35a262490f951ed1143aa265582213142 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 18:37:24 +0200 Subject: [PATCH 42/49] Update ipn.php --- htdocs/public/stripe/ipn.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 9c7941ff5e7..12420c81add 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -88,7 +88,10 @@ catch(\UnexpectedValueException $e) { // Do something with $event http_response_code(200); // PHP 5.4 or greater + $langs->load("main"); + +// TODO Do we really need a user in setup just to have an name to fill an email topic when it is a technical system notification email $user = new User($db); $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); From 9efa3816c3171518e1907a6db791cb6319630440 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 18:47:00 +0200 Subject: [PATCH 43/49] Update charge.php --- htdocs/stripe/charge.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index b82d8d65a78..d50259c0d9f 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -120,12 +120,16 @@ if (!$rowid) foreach ($list->data as $charge) { // The metadata FULLTAG is defined by the online payment page - $FULLTAG=$charge->description; + $FULLTAG=$charge->metadata->FULLTAG; // Save into $tmparray all metadata $tmparray = dolExplodeIntoArray($FULLTAG,'.','='); // Load origin object according to metadata - if (! empty($tmparray['CUS']) && $charge->metadata->dol_thirdparty_id) + if (! empty($tmparray['CUS']) && $tmparray['CUS'] > 0) + { + $societestatic->fetch($tmparray['CUS']); + } + elseif (! empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) { $societestatic->fetch($charge->metadata->dol_thirdparty_id); } @@ -133,7 +137,7 @@ if (!$rowid) { $societestatic->id = 0; } - if (! empty($tmparray['MEM']) && $charge->metadata->dol_thirdparty_id) + if (! empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { $memberstatic->fetch($tmparray['MEM']); } @@ -142,9 +146,9 @@ if (!$rowid) $memberstatic->id = 0; } - print ''; - // Ref - $url='https://dashboard.stripe.com/test/payments/'.$charge->id; + print ''; + // Ref + $url='https://dashboard.stripe.com/test/payments/'.$charge->id; if ($servicestatus) { $url='https://dashboard.stripe.com/payments/'.$charge->id; From 71e4378bd2788da0ec635fd5283f42e4bdeee76c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 18:51:03 +0200 Subject: [PATCH 44/49] Update charge.php Charges can be done on different stripe account, even if doli thirdparty is same (if thirdparty has changed it stripe account). So keeping it in list seems usefull. --- htdocs/stripe/charge.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index d50259c0d9f..2bcb31f225f 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -96,7 +96,7 @@ if (!$rowid) print ''; print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); - //print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); + print_liste_field_titre("StripeCustomerId",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Customer",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("Origin",$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder); print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"","","",'align="center"',$sortfield,$sortorder); @@ -155,7 +155,7 @@ if (!$rowid) } print "".img_picto($langs->trans('ShowInStripe'), 'object_globe')." ".$charge->id."\n"; // Stripe customer - //print "".$charge->customer."\n"; + print "".$charge->customer."\n"; // Link print ""; if ($societestatic->id > 0) @@ -165,7 +165,7 @@ if (!$rowid) elseif ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); - } else print $charge->customer; + } print "\n"; // Origine print ""; From 04017367f98a10e1f4e9ea52d5125d29e01bcfbd Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 12 Sep 2018 19:24:45 +0200 Subject: [PATCH 45/49] Standardize and update code --- .../product/doc/doc_generic_product_odt.modules.php | 8 ++++---- .../project/doc/doc_generic_project_odt.modules.php | 4 ++-- .../project/task/doc/doc_generic_task_odt.modules.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index c93e4b50fe3..eaa6f940e50 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -51,8 +51,8 @@ class doc_generic_product_odt extends ModelePDFProduct { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; @@ -96,8 +96,8 @@ class doc_generic_product_odt extends ModelePDFProduct { global $conf,$langs; - $langs->load("companies"); - $langs->load("errors"); + // Load translation files required by the page + $langs->loadLangs(array("errors","companies")); $form = new Form($this->db); diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index c86f0186811..2995d222294 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -361,8 +361,8 @@ class doc_generic_project_odt extends ModelePDFProjects { global $conf,$langs; - $langs->load("companies"); - $langs->load("errors"); + // Load translation files required by the page + $langs->loadLangs(array("companies","errors")); $form = new Form($this->db); diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index b0d0d7d5069..5672ba4f38f 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -69,8 +69,8 @@ class doc_generic_task_odt extends ModelePDFTask { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; @@ -321,8 +321,8 @@ class doc_generic_task_odt extends ModelePDFTask { global $conf,$langs; - $langs->load("companies"); - $langs->load("errors"); + // Load translation files required by the page + $langs->loadLangs(array("errors","companies")); $form = new Form($this->db); From 06cde1c35f56abb3bc0184bfcf527c4b1151dbbe Mon Sep 17 00:00:00 2001 From: Philippe GRAND Date: Wed, 12 Sep 2018 19:32:30 +0200 Subject: [PATCH 46/49] Standardize and update code --- htdocs/core/modules/project/mod_project_universal.php | 4 ++-- htdocs/core/modules/project/task/mod_task_universal.php | 4 ++-- .../propale/doc/doc_generic_proposal_odt.modules.php | 8 ++++---- htdocs/core/modules/rapport/pdf_paiement.class.php | 6 +++--- .../core/modules/societe/doc/doc_generic_odt.modules.php | 4 ++-- .../modules/stock/doc/doc_generic_stock_odt.modules.php | 4 ++-- .../supplier_invoice/mod_facture_fournisseur_tulip.php | 6 +++--- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 6be53915136..934526f21d0 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -45,8 +45,8 @@ class mod_project_universal extends ModeleNumRefProjects { global $conf,$langs; - $langs->load("projects"); - $langs->load("admin"); + // Load translation files required by the page + $langs->loadLangs(array("projects","admin")); $form = new Form($this->db); diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index cc3175be159..ef3aeee1bcd 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -45,8 +45,8 @@ class mod_task_universal extends ModeleNumRefTask { global $conf,$langs; - $langs->load("projects"); - $langs->load("admin"); + // Load translation files required by the page + $langs->loadLangs(array("projects","admin")); $form = new Form($this->db); diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 1e0d084fbba..4a2a3055119 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -52,8 +52,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; @@ -97,8 +97,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales { global $conf,$langs; - $langs->load("companies"); - $langs->load("errors"); + // Load translation files required by the page + $langs->loadLangs(array("errors","companies")); $form = new Form($this->db); diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 801b3820bc5..4d9f9fc3ff7 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -40,9 +40,9 @@ class pdf_paiement function __construct($db) { global $langs,$conf; - $langs->load("bills"); - $langs->load("compta"); - $langs->load("main"); + + // Load translation files required by the page + $langs->loadLangs(array("bills","compta","main")); $this->db = $db; $this->description = $langs->transnoentities("ListOfCustomerPayments"); diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 285b7b2db82..a0be3ce8e81 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -48,8 +48,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 20957f26415..e99bc45bcac 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -51,8 +51,8 @@ class doc_generic_stock_odt extends ModelePDFStock { global $conf,$langs,$mysoc; - $langs->load("main"); - $langs->load("companies"); + // Load translation files required by the page + $langs->loadLangs(array("main","companies")); $this->db = $db; $this->name = "ODT templates"; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 2e155c04df8..9f4a5b6bbe7 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003-2007 Rodolphe Quiedeville * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2013 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2016 Alexandre Spangaro * @@ -50,8 +50,8 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices { global $conf,$langs; - $langs->load("bills"); - $langs->load("admin"); + // Load translation files required by the page + $langs->loadLangs(array("bills","admin")); $form = new Form($this->db); From ef4659c518dfd03b22b5bdd4bd685bdddb64a812 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 11 Sep 2018 10:59:25 +0200 Subject: [PATCH 47/49] add capture option in payment function Conflicts: htdocs/stripe/class/stripe.class.php --- htdocs/stripe/class/stripe.class.php | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 895ade49d09..901997cef3b 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -335,18 +335,19 @@ class Stripe extends CommonObject /** * Create charge with public/payment/newpayment.php, stripe/card.php, cronjobs or REST API * - * @param int $amount Amount to pay - * @param string $currency EUR, GPB... - * @param string $origin Object type to pay (order, invoice, contract...) - * @param int $item Object id to pay - * @param string $source src_xxxxx or card_xxxxx - * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() - * @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount() + * @param int $amount Amount to pay + * @param string $currency EUR, GPB... + * @param string $origin Object type to pay (order, invoice, contract...) + * @param int $item Object id to pay + * @param string $source src_xxxxx or card_xxxxx + * @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe() + * @param string $account Stripe account ref 'acc_xxxxxxxxxxxxx' via getStripeAccount() * @param int $status Status (0=test, 1=live) * @param int $usethirdpartyemailforreceiptemail Use thirdparty email as receipt email + * @param boolean $capture Set capture flag to true (take payment) or false (wait) * @return Stripe */ - public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0) + public function createPaymentStripe($amount, $currency, $origin, $item, $source, $customer, $account, $status=0, $usethirdpartyemailforreceiptemail=0, $capture=true) { global $conf; @@ -417,9 +418,9 @@ class Stripe extends CommonObject $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source" )); @@ -427,9 +428,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, - "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" @@ -452,9 +453,9 @@ class Stripe extends CommonObject $paymentarray = array( "amount" => "$stripeamount", "currency" => "$currency", - "capture" => true, "statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt - "description" => "Stripe payment: ".$description, + "description" => "Stripe payment: ".$description, + "capture" => $capture, "metadata" => $metadata, "source" => "$source", "customer" => "$customer" From 056ef802e4d4c9bd6ab06f1b0e60e43ddff68af7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 19:49:57 +0200 Subject: [PATCH 48/49] Fix syntax error --- htdocs/public/stripe/ipn.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 12420c81add..ffd1bf4f559 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -131,7 +131,7 @@ if ($event->type == 'payout.created') { if ($result > 0) { - $subject = '[NOTIFICATION] Virement programmée'; + $subject = '[NOTIFICATION] Payment out scheduled'; if (!empty($user->email)) { $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; } else { @@ -143,7 +143,7 @@ if ($event->type == 'payout.created') { $sendtocc = $conf->global->ONLINE_PAYMENT_SENDEMAIL.'" <'.$conf->global->ONLINE_PAYMENT_SENDEMAIL.'>'; } - $message = "Un virement de ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." est attendu sur votre compte le ".date('d-m-Y H:i:s',$event->data->object->arrival_date); + $message = "A bank transfer of ".price2num($event->data->object->amount/100)." ".$event->data->object->currency." should arrive in your account the ".dol_print_date($event->data->object->arrival_date, 'dayhour'); $mailfile = new CMailFile( $subject, @@ -159,7 +159,7 @@ if ($event->type == 'payout.created') { -1 ); - $ret = $mailfile->sendfile()) + $ret = $mailfile->sendfile(); return 1; } From b3dec042b5ce53337aa2a02a911eb0eca2a8efa6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 12 Sep 2018 21:12:15 +0200 Subject: [PATCH 49/49] Fix translation --- htdocs/public/stripe/ipn.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index ffd1bf4f559..e1b160541b2 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -131,7 +131,7 @@ if ($event->type == 'payout.created') { if ($result > 0) { - $subject = '[NOTIFICATION] Payment out scheduled'; + $subject = '[NOTIFICATION] Stripe payout scheduled'; if (!empty($user->email)) { $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; } else {