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';