diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml
index 1a18710b0d1..427b86053c8 100644
--- a/dev/setup/codesniffer/ruleset.xml
+++ b/dev/setup/codesniffer/ruleset.xml
@@ -201,7 +201,7 @@
0
-
+
diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php
index 6008c53b617..b4fb06412f0 100644
--- a/htdocs/compta/facture/class/facture-rec.class.php
+++ b/htdocs/compta/facture/class/facture-rec.class.php
@@ -103,7 +103,7 @@ class FactureRec extends CommonInvoice
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
$this->db = $db;
}
@@ -1482,31 +1482,27 @@ class FactureRec extends CommonInvoice
*/
public function setFrequencyAndUnit($frequency, $unit)
{
- if (! $this->table_element)
- {
+ if (! $this->table_element) {
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR);
return -1;
}
- if (!empty($frequency) && empty($unit))
- {
+ if (!empty($frequency) && empty($unit)) {
dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR);
return -2;
}
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
- if (!empty($unit))
- {
+ if (!empty($unit)) {
$sql.= ', unit_frequency = \''.$this->db->escape($unit).'\'';
}
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
- if ($this->db->query($sql))
- {
+ if ($this->db->query($sql)) {
$this->frequency = $frequency;
- if (!empty($unit)) $this->unit_frequency = $unit;
+ if (!empty($unit)) $this->unit_frequency = $unit;
return 1;
}
else
@@ -1848,8 +1844,7 @@ class FactureLigneRec extends CommonInvoiceLine
$sql.= ", info_bits='".price2num($this->info_bits)."'";
$sql.= ", date_start_fill=".(int) $this->date_start_fill;
$sql.= ", date_end_fill=".(int) $this->date_end_fill;
- if (empty($this->skip_update_total))
- {
+ if (empty($this->skip_update_total)) {
$sql.= ", total_ht=".price2num($this->total_ht);
$sql.= ", total_tva=".price2num($this->total_tva);
$sql.= ", total_localtax1=".price2num($this->total_localtax1);
@@ -1864,8 +1859,8 @@ class FactureLigneRec extends CommonInvoiceLine
dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$resql=$this->db->query($sql);
- if ($resql)
- {
+ if ($resql)
+ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{
$result=$this->insertExtraFields();
@@ -1886,8 +1881,8 @@ class FactureLigneRec extends CommonInvoiceLine
}
// End call triggers
}
- $this->db->commit();
- return 1;
+ $this->db->commit();
+ return 1;
}
else
{
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index ee9863a8a5a..b1f99275c93 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -378,7 +378,7 @@ class Tva extends CommonObject
return $solde;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Total of the VAT from invoices emitted by the thirdparty.
*
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index ea7879db05e..8c83c342ab4 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -1832,7 +1832,7 @@ class Contrat extends CommonObject
return $this->LibStatut($this->statut, $mode);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoi label of a given contrat status
*
@@ -2014,7 +2014,7 @@ class Contrat extends CommonObject
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of line rowid
*
diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php
index a49ef7f6294..4c95098813d 100644
--- a/htdocs/core/db/mssql.class.php
+++ b/htdocs/core/db/mssql.class.php
@@ -36,9 +36,9 @@ class DoliDBMssql extends DoliDB
//! Database label
const LABEL='MSSQL';
//! Charset used to force charset when creating database
- var $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value
+ public $forcecharset='latin1'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
- var $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
+ public $forcecollate='latin1_swedish_ci'; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='2000';
/** @var resource Resultset of last query */
@@ -55,7 +55,7 @@ class DoliDBMssql extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $langs;
@@ -134,19 +134,19 @@ class DoliDBMssql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl')
+ public static function convertSQLFromMysql($line, $type = 'ddl')
{
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
return @mssql_select_db($database, $this->db);
@@ -163,7 +163,7 @@ class DoliDBMssql extends DoliDB
* @return false|resource|true Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name");
$newhost=$host;
@@ -191,7 +191,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$resql=$this->query("SELECT @@VERSION");
if ($resql)
@@ -207,7 +207,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'php mssql driver';
}
@@ -218,7 +218,7 @@ class DoliDBMssql extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -235,7 +235,7 @@ class DoliDBMssql extends DoliDB
*
* @return bool true if transaction successfuly opened or already opened, false if error
*/
- function begin()
+ public function begin()
{
$res=mssql_query('select @@TRANCOUNT');
@@ -263,7 +263,7 @@ class DoliDBMssql extends DoliDB
* @param string $log Add more log to default log line
* @return bool true if validation is OK or transaction level no started, false if ERROR
*/
- function commit($log = '')
+ public function commit($log = '')
{
$res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0);
@@ -296,7 +296,7 @@ class DoliDBMssql extends DoliDB
* @param string $log Add more log to default log line
* @return bool true si annulation ok ou transaction non ouverte, false en cas d'erreur
*/
- function rollback($log = '')
+ public function rollback($log = '')
{
$res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0);
@@ -324,7 +324,7 @@ class DoliDBMssql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return false|resource|true Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
$query = trim($query);
@@ -368,11 +368,11 @@ class DoliDBMssql extends DoliDB
}
else
{
- if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches))
- {
+ if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches))
+ {
$original_query=$query;
$query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")";
- }
+ }
}
}
@@ -459,14 +459,14 @@ class DoliDBMssql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -474,14 +474,14 @@ class DoliDBMssql extends DoliDB
return mssql_fetch_object($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -490,14 +490,14 @@ class DoliDBMssql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -505,7 +505,7 @@ class DoliDBMssql extends DoliDB
return @mssql_fetch_row($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -513,7 +513,7 @@ class DoliDBMssql extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -521,7 +521,7 @@ class DoliDBMssql extends DoliDB
return mssql_num_rows($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -529,7 +529,7 @@ class DoliDBMssql extends DoliDB
* @return int Nombre de lignes
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -548,7 +548,7 @@ class DoliDBMssql extends DoliDB
* @param resource $resultset Curseur de la requete voulue
* @return bool
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@@ -562,7 +562,7 @@ class DoliDBMssql extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return addslashes($stringtoencode);
}
@@ -575,7 +575,7 @@ class DoliDBMssql extends DoliDB
* @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
- function idate($param)
+ public function idate($param)
{
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
}
@@ -585,7 +585,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected)
{
@@ -638,7 +638,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mssql_get_last_message.
@@ -649,7 +649,7 @@ class DoliDBMssql extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -657,7 +657,7 @@ class DoliDBMssql extends DoliDB
* @param string $fieldid Field name
* @return int Id of row or -1 on error
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
$res = $this->query("SELECT @@IDENTITY as id");
@@ -679,7 +679,7 @@ class DoliDBMssql extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -699,7 +699,7 @@ class DoliDBMssql extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -714,13 +714,13 @@ class DoliDBMssql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()');
@@ -732,7 +732,7 @@ class DoliDBMssql extends DoliDB
else return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -744,7 +744,7 @@ class DoliDBMssql extends DoliDB
* @param string $owner Username of database owner
* @return false|resource|true resource defined if OK, false if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
/*if (empty($charset)) $charset=$this->forcecharset;
@@ -770,7 +770,7 @@ class DoliDBMssql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -778,21 +778,21 @@ class DoliDBMssql extends DoliDB
* @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$this->_results = mssql_list_tables($database, $this->db);
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
@@ -804,7 +804,7 @@ class DoliDBMssql extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -817,7 +817,7 @@ class DoliDBMssql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -885,14 +885,14 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -903,7 +903,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -911,7 +911,7 @@ class DoliDBMssql extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return false|resource|true Resource
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -921,7 +921,7 @@ class DoliDBMssql extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -931,7 +931,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public 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
@@ -959,7 +959,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -968,7 +968,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -984,7 +984,7 @@ class DoliDBMssql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -992,7 +992,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -1005,7 +1005,7 @@ class DoliDBMssql extends DoliDB
else return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -1015,7 +1015,7 @@ 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
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
$sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'";
@@ -1059,7 +1059,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1072,7 +1072,7 @@ class DoliDBMssql extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1085,7 +1085,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query("SELECT SERVERPROPERTY('collation')");
if (!$resql)
@@ -1101,7 +1101,7 @@ class DoliDBMssql extends DoliDB
*
* @return array Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1114,7 +1114,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1127,7 +1127,7 @@ class DoliDBMssql extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
// FIXME: Dummy method
// TODO: Implement
@@ -1141,7 +1141,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
// FIXME: Dummy method
// TODO: Implement
@@ -1157,7 +1157,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
// FIXME: Dummy method
// TODO: Implement
@@ -1166,21 +1166,21 @@ class DoliDBMssql extends DoliDB
return array();
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Escape a field name according to escape's syntax
*
* @param string $fieldname Field's name to escape
* @return string field's name escaped
*/
- function EscapeFieldName($fieldname)
+ public function EscapeFieldName($fieldname)
{
// phpcs:enable
return "[".$fieldname."]";
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get information on field
*
@@ -1188,7 +1188,7 @@ class DoliDBMssql extends DoliDB
* @param mixed $fields String for one field or array of string for multiple field
* @return false|object
*/
- function GetFieldInformation($table, $fields)
+ public function GetFieldInformation($table, $fields)
{
// phpcs:enable
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";
diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php
index 48a768bd365..d53fc37c7c9 100644
--- a/htdocs/core/db/mysqli.class.php
+++ b/htdocs/core/db/mysqli.class.php
@@ -54,7 +54,7 @@ class DoliDBMysqli extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf,$langs;
@@ -167,14 +167,14 @@ class DoliDBMysqli extends DoliDB
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@@ -193,7 +193,7 @@ class DoliDBMysqli extends DoliDB
* @return mysqli Database access object
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
dol_syslog(get_class($this) . "::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name", LOG_DEBUG);
@@ -208,7 +208,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
return $this->db->server_info;
}
@@ -218,7 +218,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return $this->db->client_info;
}
@@ -230,7 +230,7 @@ class DoliDBMysqli extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -250,7 +250,7 @@ class DoliDBMysqli extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return bool|mysqli_result Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
global $conf;
@@ -287,14 +287,14 @@ class DoliDBMysqli extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -303,14 +303,14 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param mysqli_result $resultset Resultset of request
* @return array|null Array or null if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -318,14 +318,14 @@ class DoliDBMysqli extends DoliDB
return $resultset->fetch_array();
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -341,7 +341,7 @@ class DoliDBMysqli extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -349,7 +349,7 @@ class DoliDBMysqli extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -357,7 +357,7 @@ class DoliDBMysqli extends DoliDB
return $resultset->num_rows;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -365,7 +365,7 @@ class DoliDBMysqli extends DoliDB
* @return int Nombre de lignes
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -382,7 +382,7 @@ class DoliDBMysqli extends DoliDB
* @param mysqli_result $resultset Curseur de la requete voulue
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@@ -396,7 +396,7 @@ class DoliDBMysqli extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return $this->db->real_escape_string($stringtoencode);
}
@@ -406,7 +406,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -457,7 +457,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mysqli_error.
@@ -468,7 +468,7 @@ class DoliDBMysqli extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -476,7 +476,7 @@ class DoliDBMysqli extends DoliDB
* @param string $fieldid Field name
* @return int|string Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
return $this->db->insert_id;
@@ -491,7 +491,7 @@ class DoliDBMysqli extends DoliDB
* @return string XXX(field) or XXX('value') or field or 'value'
*
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -524,7 +524,7 @@ class DoliDBMysqli extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -552,13 +552,13 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()');
@@ -570,7 +570,7 @@ class DoliDBMysqli extends DoliDB
else return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -582,7 +582,7 @@ class DoliDBMysqli extends DoliDB
* @param string $owner Username of database owner
* @return bool|mysqli_result resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -604,7 +604,7 @@ class DoliDBMysqli extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -612,7 +612,7 @@ class DoliDBMysqli extends DoliDB
* @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -632,14 +632,14 @@ class DoliDBMysqli extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
* @param string $table Name of table
* @return array Tableau des informations des champs de la table
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -658,7 +658,7 @@ class DoliDBMysqli extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -671,7 +671,7 @@ class DoliDBMysqli extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -742,14 +742,14 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -760,7 +760,7 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -768,7 +768,7 @@ 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, ...)
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -778,7 +778,7 @@ class DoliDBMysqli extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -788,7 +788,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public 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
@@ -830,7 +830,7 @@ class DoliDBMysqli extends DoliDB
return -1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -839,7 +839,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -877,7 +877,7 @@ class DoliDBMysqli extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -885,7 +885,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -898,7 +898,7 @@ class DoliDBMysqli extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -908,7 +908,7 @@ 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
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public 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)."'";
@@ -953,7 +953,7 @@ class DoliDBMysqli extends DoliDB
* @return string Charset
* @see getDefaultCollationDatabase
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
$resql=$this->query('SHOW VARIABLES LIKE \'character_set_database\'');
if (!$resql)
@@ -972,7 +972,7 @@ class DoliDBMysqli extends DoliDB
*
* @return array|null List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$resql=$this->query('SHOW CHARSET');
$liste = array();
@@ -999,7 +999,7 @@ class DoliDBMysqli extends DoliDB
* @return string Collation value
* @see getDefaultCharacterSetDatabase
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query('SHOW VARIABLES LIKE \'collation_database\'');
if (!$resql)
@@ -1018,7 +1018,7 @@ class DoliDBMysqli extends DoliDB
*
* @return array|null Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$resql=$this->query('SHOW COLLATION');
$liste = array();
@@ -1043,7 +1043,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
$fullpathofdump='/pathtomysqldump/mysqldump';
@@ -1062,7 +1062,7 @@ class DoliDBMysqli extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
$fullpathofimport='/pathtomysql/mysql';
@@ -1082,7 +1082,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
@@ -1103,7 +1103,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
$result=array();
diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index 1145be1849b..9247068a27e 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -40,9 +40,9 @@ class DoliDBPgsql extends DoliDB
//! Database label
const LABEL='PostgreSQL'; // Label of manager
//! Charset
- var $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
+ public $forcecharset='UTF8'; // Can't be static as it may be forced with a dynamic value
//! Collate used to force collate when creating database
- var $forcecollate=''; // Can't be static as it may be forced with a dynamic value
+ public $forcecollate=''; // Can't be static as it may be forced with a dynamic value
//! Version min database
const VERSIONMIN='9.0.0'; // Version min database
/** @var resource Resultset of last query */
@@ -62,7 +62,7 @@ class DoliDBPgsql extends DoliDB
* @param string $name Nom de la database
* @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf,$langs;
@@ -368,7 +368,7 @@ class DoliDBPgsql extends DoliDB
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
* Ici postgresql n'a aucune fonction equivalente de mysql_select_db
@@ -377,7 +377,7 @@ class DoliDBPgsql extends DoliDB
* @param string $database Name of database
* @return bool true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
if ($database == $this->database_name) {
@@ -398,7 +398,7 @@ class DoliDBPgsql extends DoliDB
* @return false|resource Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
// use pg_pconnect() instead of pg_connect() if you want to use persistent connection costing 1ms, instead of 30ms for non persistent
@@ -446,7 +446,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$resql=$this->query('SHOW server_version');
if ($resql)
@@ -462,7 +462,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'pgsql php driver';
}
@@ -473,7 +473,7 @@ class DoliDBPgsql extends DoliDB
* @return boolean True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -492,7 +492,7 @@ class DoliDBPgsql extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return false|resource Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
global $conf;
@@ -554,14 +554,14 @@ class DoliDBPgsql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -569,14 +569,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_object($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return false|array Array
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -584,14 +584,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_array($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param resource $resultset Resultset of request
* @return false|array Array
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -599,7 +599,7 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_row($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -607,7 +607,7 @@ class DoliDBPgsql extends DoliDB
* @return int Nb of lines, -1 on error
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -615,7 +615,7 @@ class DoliDBPgsql extends DoliDB
return pg_num_rows($resultset);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Renvoie le nombre de lignes dans le resultat d'une requete INSERT, DELETE ou UPDATE
*
@@ -623,7 +623,7 @@ class DoliDBPgsql extends DoliDB
* @return int Nb of lines
* @see num_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -640,7 +640,7 @@ class DoliDBPgsql extends DoliDB
* @param resource $resultset Result set of request
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_resource($resultset)) { $resultset=$this->_results; }
@@ -656,7 +656,7 @@ class DoliDBPgsql extends DoliDB
* @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset
*/
- function plimit($limit = 0, $offset = 0)
+ public function plimit($limit = 0, $offset = 0)
{
global $conf;
if (empty($limit)) return "";
@@ -672,7 +672,7 @@ class DoliDBPgsql extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return pg_escape_string($stringtoencode);
}
@@ -684,7 +684,7 @@ class DoliDBPgsql extends DoliDB
* @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS
*/
- function idate($param)
+ public function idate($param)
{
return dol_print_date($param, "%Y-%m-%d %H:%M:%S");
}
@@ -697,7 +697,7 @@ class DoliDBPgsql extends DoliDB
* @param string $resko resultat si test non egal
* @return string chaine formate SQL
*/
- function ifsql($test, $resok, $resko)
+ public function ifsql($test, $resok, $resko)
{
return '(CASE WHEN '.$test.' THEN '.$resok.' ELSE '.$resko.' END)';
}
@@ -707,7 +707,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -773,12 +773,12 @@ class DoliDBPgsql extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
return pg_last_error($this->db);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -786,7 +786,7 @@ class DoliDBPgsql extends DoliDB
* @param string $fieldid Field name
* @return string Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
//$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab);
@@ -809,7 +809,7 @@ class DoliDBPgsql extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -830,7 +830,7 @@ class DoliDBPgsql extends DoliDB
* @param int $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -845,13 +845,13 @@ class DoliDBPgsql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
return '?';
@@ -859,7 +859,7 @@ class DoliDBPgsql extends DoliDB
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -871,7 +871,7 @@ class DoliDBPgsql extends DoliDB
* @param string $owner Username of database owner
* @return false|resource resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -886,7 +886,7 @@ class DoliDBPgsql extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -894,7 +894,7 @@ class DoliDBPgsql extends DoliDB
* @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -912,7 +912,7 @@ class DoliDBPgsql extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
@@ -920,7 +920,7 @@ class DoliDBPgsql extends DoliDB
* @return array Tableau des informations des champs de la table
*
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -954,7 +954,7 @@ class DoliDBPgsql extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -967,7 +967,7 @@ class DoliDBPgsql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -1035,14 +1035,14 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -1053,7 +1053,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user to connect to database
*
@@ -1063,7 +1063,7 @@ 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
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public 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
@@ -1079,7 +1079,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -1087,7 +1087,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return false|resource Resultset x (x->attname)
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql ="SELECT attname FROM pg_attribute, pg_type WHERE typname = '".$table."' AND attrelid = typrelid";
@@ -1099,7 +1099,7 @@ class DoliDBPgsql extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -1109,7 +1109,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public 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
@@ -1140,7 +1140,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -1149,7 +1149,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -1185,7 +1185,7 @@ class DoliDBPgsql extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -1193,7 +1193,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
@@ -1211,7 +1211,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
$resql=$this->query('SHOW SERVER_ENCODING');
if ($resql)
@@ -1227,7 +1227,7 @@ class DoliDBPgsql extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$resql=$this->query('SHOW SERVER_ENCODING');
$liste = array();
@@ -1252,7 +1252,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
$resql=$this->query('SHOW LC_COLLATE');
if ($resql)
@@ -1268,7 +1268,7 @@ class DoliDBPgsql extends DoliDB
*
* @return array Liste of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$resql=$this->query('SHOW LC_COLLATE');
$liste = array();
@@ -1292,7 +1292,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
$fullpathofdump='/pathtopgdump/pg_dump';
@@ -1320,7 +1320,7 @@ class DoliDBPgsql extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
//$tool='pg_restore';
$tool='psql';
@@ -1352,7 +1352,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
@@ -1373,7 +1373,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
/* This is to return current running requests.
$sql='SELECT datname,procpid,current_query FROM pg_stat_activity ORDER BY procpid';
diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php
index 1ff024d6c6f..819da9bd96f 100644
--- a/htdocs/core/db/sqlite3.class.php
+++ b/htdocs/core/db/sqlite3.class.php
@@ -38,8 +38,8 @@ class DoliDBSqlite3 extends DoliDB
const LABEL='Sqlite3';
//! Version min database
const VERSIONMIN='3.0.0';
- /** @var SQLite3Result Resultset of last query */
- private $_results;
+ /** @var SQLite3Result Resultset of last query */
+ private $_results;
const WEEK_MONDAY_FIRST=1;
const WEEK_YEAR = 2;
@@ -47,17 +47,17 @@ class DoliDBSqlite3 extends DoliDB
/**
- * Constructor.
- * This create an opened connexion to a database server and eventually to a database
+ * Constructor.
+ * This create an opened connexion to a database server and eventually to a database
*
- * @param string $type Type of database (mysql, pgsql...)
- * @param string $host Address of database server
- * @param string $user Nom de l'utilisateur autorise
- * @param string $pass Mot de passe
- * @param string $name Nom de la database
- * @param int $port Port of database server
+ * @param string $type Type of database (mysql, pgsql...)
+ * @param string $host Address of database server
+ * @param string $user Nom de l'utilisateur autorise
+ * @param string $pass Mot de passe
+ * @param string $name Nom de la database
+ * @param int $port Port of database server
*/
- function __construct($type, $host, $user, $pass, $name = '', $port = 0)
+ public function __construct($type, $host, $user, $pass, $name = '', $port = 0)
{
global $conf;
@@ -134,7 +134,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted
*/
- static function convertSQLFromMysql($line, $type = 'ddl')
+ public static function convertSQLFromMysql($line, $type = 'ddl')
{
// Removed empty line if this is a comment line for SVN tagging
if (preg_match('/^--\s\$Id/i', $line)) {
@@ -295,14 +295,14 @@ class DoliDBSqlite3 extends DoliDB
return $line;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Select a database
*
* @param string $database Name of database
* @return boolean true if OK, false if KO
*/
- function select_db($database)
+ public function select_db($database)
{
// phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@@ -323,7 +323,7 @@ class DoliDBSqlite3 extends DoliDB
* @return SQLite3 Database access handler
* @see close
*/
- function connect($host, $login, $passwd, $name, $port = 0)
+ public function connect($host, $login, $passwd, $name, $port = 0)
{
global $main_data_dir;
@@ -356,7 +356,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Version string
*/
- function getVersion()
+ public function getVersion()
{
$tmp=$this->db->version();
return $tmp['versionString'];
@@ -367,7 +367,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Version string
*/
- function getDriverInfo()
+ public function getDriverInfo()
{
return 'sqlite3 php driver';
}
@@ -379,7 +379,7 @@ class DoliDBSqlite3 extends DoliDB
* @return bool True if disconnect successfull, false otherwise
* @see connect
*/
- function close()
+ public function close()
{
if ($this->db)
{
@@ -401,7 +401,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return SQLite3Result Resultset of answer
*/
- function query($query, $usesavepoint = 0, $type = 'auto')
+ public function query($query, $usesavepoint = 0, $type = 'auto')
{
$ret=null;
$query = trim($query);
@@ -490,14 +490,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* 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
*/
- function fetch_object($resultset)
+ public function fetch_object($resultset)
{
// phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
@@ -511,14 +511,14 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
- function fetch_array($resultset)
+ public function fetch_array($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -528,14 +528,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return datas as an array
*
* @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor
*/
- function fetch_row($resultset)
+ public function fetch_row($resultset)
{
// phpcs:enable
// If resultset not provided, we take the last used by connexion
@@ -551,7 +551,7 @@ class DoliDBSqlite3 extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -559,7 +559,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function num_rows($resultset)
+ public function num_rows($resultset)
{
// phpcs:enable
// FIXME: SQLite3Result does not have a queryString member
@@ -572,7 +572,7 @@ class DoliDBSqlite3 extends DoliDB
return 0;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return number of lines for result of a SELECT
*
@@ -580,7 +580,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines
* @see affected_rows
*/
- function affected_rows($resultset)
+ public function affected_rows($resultset)
{
// phpcs:enable
// FIXME: SQLite3Result does not have a queryString member
@@ -602,7 +602,7 @@ class DoliDBSqlite3 extends DoliDB
* @param SQLite3Result $resultset Curseur de la requete voulue
* @return void
*/
- function free($resultset = null)
+ public function free($resultset = null)
{
// If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; }
@@ -616,7 +616,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $stringtoencode String to escape
* @return string String escaped
*/
- function escape($stringtoencode)
+ public function escape($stringtoencode)
{
return Sqlite3::escapeString($stringtoencode);
}
@@ -626,7 +626,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/
- function errno()
+ public function errno()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide.
@@ -691,7 +691,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Error text
*/
- function error()
+ public function error()
{
if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour sqlite_error.
@@ -702,7 +702,7 @@ class DoliDBSqlite3 extends DoliDB
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Get last ID after an insert INSERT
*
@@ -710,7 +710,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $fieldid Field name
* @return int Id of row
*/
- function last_insert_id($tab, $fieldid = 'rowid')
+ public function last_insert_id($tab, $fieldid = 'rowid')
{
// phpcs:enable
return $this->db->lastInsertRowId();
@@ -724,7 +724,7 @@ class DoliDBSqlite3 extends DoliDB
* @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value'
*/
- function encrypt($fieldorvalue, $withQuotes = 0)
+ public function encrypt($fieldorvalue, $withQuotes = 0)
{
global $conf;
@@ -757,7 +757,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $value Value to decrypt
* @return string Decrypted value if used
*/
- function decrypt($value)
+ public function decrypt($value)
{
global $conf;
@@ -785,20 +785,20 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return connexion ID
*
* @return string Id connexion
*/
- function DDLGetConnectId()
+ public function DDLGetConnectId()
{
// phpcs:enable
return '?';
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated
@@ -810,7 +810,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $owner Username of database owner
* @return SQLite3Result resource defined if OK, null if KO
*/
- function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
+ public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{
// phpcs:enable
if (empty($charset)) $charset=$this->forcecharset;
@@ -832,7 +832,7 @@ class DoliDBSqlite3 extends DoliDB
return $ret;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List tables into a database
*
@@ -840,7 +840,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array
*/
- function DDLListTables($database, $table = '')
+ public function DDLListTables($database, $table = '')
{
// phpcs:enable
$listtables=array();
@@ -860,7 +860,7 @@ class DoliDBSqlite3 extends DoliDB
return $listtables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* List information of columns into a table.
*
@@ -868,7 +868,7 @@ class DoliDBSqlite3 extends DoliDB
* @return array Tableau des informations des champs de la table
* TODO modify for sqlite
*/
- function DDLInfoTable($table)
+ public function DDLInfoTable($table)
{
// phpcs:enable
$infotables=array();
@@ -887,7 +887,7 @@ class DoliDBSqlite3 extends DoliDB
return $infotables;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a table into database
*
@@ -900,7 +900,7 @@ class DoliDBSqlite3 extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK
*/
- function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
+ public function DDLCreateTable($table, $fields, $primary_key, $type, $unique_keys = null, $fulltext_keys = null, $keys = null)
{
// phpcs:enable
// FIXME: $fulltext_keys parameter is unused
@@ -967,14 +967,14 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a table into database
*
* @param string $table Name of table
* @return int <0 if KO, >=0 if OK
*/
- function DDLDropTable($table)
+ public function DDLDropTable($table)
{
// phpcs:enable
$sql = "DROP TABLE ".$table;
@@ -985,7 +985,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a pointer of line with description of a table or field
*
@@ -993,7 +993,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field Optionnel : Name of field if we want description of field
* @return SQLite3Result Resource
*/
- function DDLDescTable($table, $field = "")
+ public function DDLDescTable($table, $field = "")
{
// phpcs:enable
$sql="DESC ".$table." ".$field;
@@ -1003,7 +1003,7 @@ class DoliDBSqlite3 extends DoliDB
return $this->_results;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a new field into table
*
@@ -1013,7 +1013,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK
*/
- function DDLAddField($table, $field_name, $field_desc, $field_position = "")
+ public 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
@@ -1048,7 +1048,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Update format of a field into a table
*
@@ -1057,7 +1057,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK
*/
- function DDLUpdateField($table, $field_name, $field_desc)
+ public function DDLUpdateField($table, $field_name, $field_desc)
{
// phpcs:enable
$sql = "ALTER TABLE ".$table;
@@ -1072,7 +1072,7 @@ class DoliDBSqlite3 extends DoliDB
return 1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Drop a field from table
*
@@ -1080,7 +1080,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK
*/
- function DDLDropField($table, $field_name)
+ public function DDLDropField($table, $field_name)
{
// phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@@ -1094,7 +1094,7 @@ class DoliDBSqlite3 extends DoliDB
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Create a user and privileges to connect to database (even if database does not exists yet)
*
@@ -1104,7 +1104,7 @@ 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
*/
- function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
+ public function DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name)
{
// phpcs:enable
$sql = "INSERT INTO user ";
@@ -1147,7 +1147,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Charset
*/
- function getDefaultCharacterSetDatabase()
+ public function getDefaultCharacterSetDatabase()
{
return 'UTF-8';
}
@@ -1157,7 +1157,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return array List of Charset
*/
- function getListOfCharacterSet()
+ public function getListOfCharacterSet()
{
$liste = array();
$i=0;
@@ -1171,7 +1171,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Collation value
*/
- function getDefaultCollationDatabase()
+ public function getDefaultCollationDatabase()
{
return 'UTF-8';
}
@@ -1181,7 +1181,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return array List of Collation
*/
- function getListOfCollation()
+ public function getListOfCollation()
{
$liste = array();
$i=0;
@@ -1195,7 +1195,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Full path of dump program
*/
- function getPathOfDump()
+ public function getPathOfDump()
{
// FIXME: not for SQLite
$fullpathofdump='/pathtomysqldump/mysqldump';
@@ -1215,7 +1215,7 @@ class DoliDBSqlite3 extends DoliDB
*
* @return string Full path of restore program
*/
- function getPathOfRestore()
+ public function getPathOfRestore()
{
// FIXME: not for SQLite
$fullpathofimport='/pathtomysql/mysql';
@@ -1236,7 +1236,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerParametersValues($filter = '')
+ public function getServerParametersValues($filter = '')
{
$result=array();
static $pragmas;
@@ -1285,7 +1285,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value)
*/
- function getServerStatusValues($filter = '')
+ public function getServerStatusValues($filter = '')
{
$result=array();
/*
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 1f77537ceb5..8319bff919b 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
@@ -58,11 +58,11 @@ class doc_generic_contract_odt extends ModelePDFContract
/**
- * Constructor
+ * Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf, $langs, $mysoc;
@@ -107,7 +107,7 @@ class doc_generic_contract_odt extends ModelePDFContract
* @param Translate $langs Lang object to use for output
* @return string Description
*/
- function info($langs)
+ public function info($langs)
{
global $conf,$langs;
@@ -181,19 +181,19 @@ class doc_generic_contract_odt extends ModelePDFContract
return $texte;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
- * Function to build a document on disk using the generic odt module.
+ * Function to build a document on disk using the generic odt module.
*
- * @param Contract $object Object source to build document
- * @param Translate $outputlangs Lang output object
- * @param string $srctemplatepath Full path of source filename for generator using a template file
+ * @param Contract $object Object source to build document
+ * @param Translate $outputlangs Lang output object
+ * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
- * @return int 1 if OK, <=0 if KO
+ * @return int 1 if OK, <=0 if KO
*/
- function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ public function write_file($object, $outputlangs, $srctemplatepath, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
// phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager;
@@ -291,10 +291,9 @@ class doc_generic_contract_odt extends ModelePDFContract
// Recipient name
$contactobject=null;
- if (! empty($usecontact))
- {
- // On peut utiliser le nom de la societe du contact
- if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
+ if (! empty($usecontact)) {
+ // On peut utiliser le nom de la societe du contact
+ if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact;
} else {
$socobject = $object->thirdparty;
diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
index 84f363af74c..fd0f5cd38a0 100644
--- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php
+++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php
@@ -61,7 +61,7 @@ class pdf_strato extends ModelePDFContract
public $type;
/**
- * @var array() Minimum version of PHP required by module.
+ * @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.4 = array(5, 4)
*/
public $phpmin = array(5, 4);
@@ -124,7 +124,7 @@ class pdf_strato extends ModelePDFContract
*
* @param DoliDB $db Database handler
*/
- function __construct($db)
+ public function __construct($db)
{
global $conf,$langs,$mysoc;
@@ -160,7 +160,7 @@ class pdf_strato extends ModelePDFContract
$this->posxdesc=$this->marge_gauche+1;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
@@ -171,9 +171,9 @@ class pdf_strato extends ModelePDFContract
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
- */
- function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
- {
+ */
+ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
+ {
// phpcs:enable
global $user,$langs,$conf,$hookmanager,$mysoc;
@@ -513,7 +513,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidebottom Hide bottom bar of array
* @return void
*/
- function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
+ private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0)
{
global $conf;
@@ -522,7 +522,7 @@ class pdf_strato extends ModelePDFContract
if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs);
-/*
+ /*
$pdf->SetXY($this->marge_gauche, $tab_top);
$pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0);
$pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8);
@@ -546,7 +546,7 @@ class pdf_strato extends ModelePDFContract
$pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY);
$pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
-*/
+ */
// Output Rect
$this->printRect($pdf, $this->marge_gauche, $tab_top, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $tab_height+3); // Rect prend une longueur en 3eme param et 4eme param
@@ -560,7 +560,7 @@ class pdf_strato extends ModelePDFContract
* @param Translate $outputlangs Object language for output
* @return void
*/
- private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
+ private function tabSignature(&$pdf, $tab_top, $tab_height, $outputlangs)
{
$pdf->SetDrawColor(128, 128, 128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2);
@@ -577,19 +577,19 @@ class pdf_strato extends ModelePDFContract
$pdf->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
- }
+ }
- /**
- * Show top header of page.
- *
- * @param PDF $pdf Object PDF
- * @param CommonObject $object Object to show
- * @param int $showaddress 0=no, 1=yes
- * @param Translate $outputlangs Object lang for output
- * @return void
- */
- function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
- {
+ /**
+ * Show top header of page.
+ *
+ * @param PDF $pdf Object PDF
+ * @param CommonObject $object Object to show
+ * @param int $showaddress 0=no, 1=yes
+ * @param Translate $outputlangs Object lang for output
+ * @return void
+ */
+ private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
+ {
global $conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -767,7 +767,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidefreetext 1=Hide free text
* @return integer
*/
- function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
+ private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
diff --git a/htdocs/core/modules/export/export_excel2007.modules.php b/htdocs/core/modules/export/export_excel2007.modules.php
index aee5255911b..1b6b973632a 100644
--- a/htdocs/core/modules/export/export_excel2007.modules.php
+++ b/htdocs/core/modules/export/export_excel2007.modules.php
@@ -108,29 +108,29 @@ class ExportExcel2007 extends ExportExcel
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Close Excel file
*
* @return int <0 if KO, >0 if OK
*/
public function close_file()
- {
+ {
// phpcs:enable
- global $conf;
+ global $conf;
- if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
- {
- $this->workbook->close();
- }
- else
- {
+ if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
+ {
+ $this->workbook->close();
+ }
+ else
+ {
require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php';
- $objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
+ $objWriter = new PHPExcel_Writer_Excel2007($this->workbook);
$objWriter->save($this->file);
$this->workbook->disconnectWorksheets();
unset($this->workbook);
- }
- return 1;
- }
+ }
+ return 1;
+ }
}
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 06782a7b033..d6e3af6fef1 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
@@ -64,7 +64,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @param DoliDB $db Database handler
*/
public function __construct($db)
- {
+ {
global $conf, $langs, $mysoc;
// Load translation files required by the page
@@ -99,7 +99,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Recupere emetteur
$this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini
- }
+ }
/**
@@ -109,7 +109,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @return string Description
*/
public function info($langs)
- {
+ {
global $conf, $langs;
// Load translation files required by the page
@@ -188,9 +188,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte.= '';
return $texte;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build a document on disk using the generic odt module.
*
@@ -521,5 +521,5 @@ class doc_generic_invoice_odt extends ModelePDFFactures
}
return -1;
- }
+ }
}
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 5b321364aa4..3da45907498 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -218,7 +218,7 @@ class pdf_crabe extends ModelePDFFactures
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Function to build pdf onto disk
*
diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php
index 0c9219a9f7f..127c7a92352 100644
--- a/htdocs/core/modules/rapport/pdf_paiement.class.php
+++ b/htdocs/core/modules/rapport/pdf_paiement.class.php
@@ -83,7 +83,7 @@ class pdf_paiement
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Fonction generant la rapport sur le disque
*
@@ -125,7 +125,7 @@ class pdf_paiement
$year = sprintf("%04d", $year);
$file = $dir . "/payments-".$year."-".$month.".pdf";
- switch ($this->doc_type) {
+ switch ($this->doc_type) {
case "client":
$file = $dir . "/payments-".$year."-".$month.".pdf";
break;
@@ -159,9 +159,9 @@ class pdf_paiement
$num=0;
$lines=array();
- // count number of lines of payment
- $sql = "SELECT p.rowid as prowid";
- switch ($this->doc_type) {
+ // count number of lines of payment
+ $sql = "SELECT p.rowid as prowid";
+ switch ($this->doc_type) {
case "client":
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
break;
@@ -361,7 +361,7 @@ class pdf_paiement
$default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$conf->global->MAIN_INFO_SOCIETE_NOM;
- switch($this->doc_type) {
+ switch($this->doc_type) {
case "client":
$title.=' - '.$outputlangs->transnoentities("ListOfCustomerPayments");
break;
diff --git a/htdocs/core/modules/reception/mod_reception_moonstone.php b/htdocs/core/modules/reception/mod_reception_moonstone.php
index 15dd9874a0a..6f7d66f8ef3 100644
--- a/htdocs/core/modules/reception/mod_reception_moonstone.php
+++ b/htdocs/core/modules/reception/mod_reception_moonstone.php
@@ -33,12 +33,12 @@ class mod_reception_moonstone extends ModelNumRefReception
public $error = '';
public $nom = 'Moonstone';
- /**
- * Return default description of numbering model
- *
- * @return string text description
- */
- public function info()
+ /**
+ * Return default description of numbering model
+ *
+ * @return string text description
+ */
+ public function info()
{
global $conf,$langs;
@@ -119,9 +119,9 @@ class mod_reception_moonstone extends ModelNumRefReception
$numFinal=get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date);
return $numFinal;
- }
+ }
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return next free value
*
diff --git a/htdocs/core/modules/reception/modules_reception.php b/htdocs/core/modules/reception/modules_reception.php
index f539ed6135f..f258ce04d5c 100644
--- a/htdocs/core/modules/reception/modules_reception.php
+++ b/htdocs/core/modules/reception/modules_reception.php
@@ -32,7 +32,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php
index 272b67d264b..1472bd982c7 100644
--- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php
+++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php
@@ -122,7 +122,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Set accountancy account code for a third party into this->code
*
diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php
index f84af23ae03..d185b4cfcf7 100644
--- a/htdocs/core/modules/societe/modules_societe.class.php
+++ b/htdocs/core/modules/societe/modules_societe.class.php
@@ -38,7 +38,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
*/
public $error='';
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of active generation modules
*
@@ -246,7 +246,7 @@ abstract class ModeleThirdPartyCode
return $s;
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Check if mask/numbering use prefix
*
diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
index 46707dfaa14..8302db4ab31 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php
@@ -33,11 +33,11 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturef
*/
class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
{
- /**
+ /**
* Dolibarr version of the loaded document
* @public string
*/
- public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+ public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/**
* @var string Error code (or message)
@@ -64,24 +64,24 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
- * Return description of numbering model
+ * Return description of numbering model
*
* @return string Text with description
*/
- function info()
+ public function info()
{
- global $langs;
- $langs->load("bills");
- return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);
+ global $langs;
+ $langs->load("bills");
+ return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);
}
/**
- * Returns a numbering example
+ * Returns a numbering example
*
* @return string Example
*/
- function getExample()
+ public function getExample()
{
return $this->prefixinvoice."1301-0001";
}
@@ -92,7 +92,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
*
* @return boolean false if conflict, true if ok
*/
- function canBeActivated()
+ public function canBeActivated()
{
global $conf,$langs,$db;
@@ -164,13 +164,13 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
* Return next value
- *
- * @param Societe $objsoc Object third party
- * @param Object $object Object invoice
+ *
+ * @param Societe $objsoc Object third party
+ * @param Object $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value
- * @return string Value if OK, 0 if KO
+ * @return string Value if OK, 0 if KO
*/
- function getNextValue($objsoc, $object, $mode = 'next')
+ public function getNextValue($objsoc, $object, $mode = 'next')
{
global $db,$conf;
@@ -236,14 +236,14 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/**
- * Return next free value
- *
+ * Return next free value
+ *
* @param Societe $objsoc Object third party
* @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value
* @return string Next free value
*/
- function getNumRef($objsoc, $objforref, $mode = 'next')
+ public function getNumRef($objsoc, $objforref, $mode = 'next')
{
return $this->getNextValue($objsoc, $objforref, $mode);
}
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 4e2b84edcc8..7f85cbe5bb6 100644
--- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
+++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php
@@ -65,9 +65,9 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
*
* @return string Description Text
*/
- function info()
+ public function info()
{
- global $conf, $langs;
+ global $conf, $langs;
// Load translation files required by the page
$langs->loadLangs(array("bills","admin"));
@@ -98,7 +98,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$texte.= '
';
$texte.= '';
-
+
// Parametrage du prefix des avoirs
$texte.= '
';
+ } else {
+ $result4 = $mailfile->sendfile();
+ if (!$error) {
- $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . " ";
- $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
- $contact->update($contact->id);
- } else {
- dol_print_error($db);
- }
- }
- setEventMessage($resultmasssend);
+ $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . " ";
+ $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
+ $contact->update($contact->id);
+ } else {
+ dol_print_error($db);
+ }
+ }
+ setEventMessage($resultmasssend);
}
/**
@@ -217,7 +217,7 @@ Class DataPolicy
* @param Societe $societe Object societe
* @return void
*/
- function sendMailDataPolicyCompany($societe)
+ public function sendMailDataPolicyCompany($societe)
{
global $langs, $conf, $db, $user;
@@ -291,7 +291,7 @@ Class DataPolicy
* @param Adherent $adherent Member
* @return void
*/
- function sendMailDataPolicyAdherent($adherent)
+ public function sendMailDataPolicyAdherent($adherent)
{
global $langs, $conf, $db, $user;
diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php
index 6ceb56d1a84..d49f58ed52e 100644
--- a/htdocs/fichinter/class/api_interventions.class.php
+++ b/htdocs/fichinter/class/api_interventions.class.php
@@ -130,8 +130,7 @@ class Interventions extends DolibarrApi
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")";
if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter
- if ($search_sale > 0)
- {
+ if ($search_sale > 0) {
$sql .= " AND sc.fk_user = ".$search_sale;
}
// Add sql filters
diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php
index b914666011d..45146324e32 100644
--- a/htdocs/holiday/class/holiday.class.php
+++ b/htdocs/holiday/class/holiday.class.php
@@ -1022,11 +1022,11 @@ class Holiday extends CommonObject
* This function can be used to avoid to have 2 leave requests on same period for example.
* Warning: It consumes a lot of memory because it load in ->holiday all holiday of a dedicated user at each call.
*
- * @param int $fk_user Id user
- * @param date $dateStart Start date of period to check
- * @param date $dateEnd End date of period to check
- * @param int $halfday Tag to define how start and end the period to check:
- * 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
+ * @param int $fk_user Id user
+ * @param date $dateStart Start date of period to check
+ * @param date $dateEnd End date of period to check
+ * @param int $halfday Tag to define how start and end the period to check:
+ * 0:Full days, 2:Start afternoon end morning, -1:Start afternoon end afternoon, 1:Start morning end morning
* @return boolean False = New range overlap an existing holiday, True = no overlapping (is never on holiday during checked period).
* @see verifDateHolidayForTimestamp
*/
@@ -1216,7 +1216,7 @@ class Holiday extends CommonObject
return $this->LibStatut($this->statut, $mode, $this->date_debut);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns the label of a statut
*
@@ -1874,7 +1874,7 @@ class Holiday extends CommonObject
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of people with permission to validate leave requests.
* Search for permission "approve leave requests"
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index b19ec65e43f..0b451701600 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -45,9 +45,9 @@ class FormProduct
/**
- * Constructor
+ * Constructor
*
- * @param DoliDB $db Database handler
+ * @param DoliDB $db Database handler
*/
function __construct($db)
{
@@ -280,7 +280,7 @@ class FormProduct
}
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Output a combo box with list of units
* pour l'instant on ne definit pas les unites dans la base
@@ -297,16 +297,16 @@ class FormProduct
print $this->load_measuring_units($name, $measuring_style, $default, $adddefault);
}
- // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
+ // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return a combo box with list of units
* For the moment, units labels are defined in measuring_units_string
*
- * @param string $name Name of HTML field
+ * @param string $name Name of HTML field
* @param string $measuring_style Unit to show: weight, size, surface, volume
* @param string $default Force unit
- * @param int $adddefault Add empty unit called "Default"
- * @return string
+ * @param int $adddefault Add empty unit called "Default"
+ * @return string
*/
public function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
{
@@ -320,10 +320,16 @@ class FormProduct
require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php';
$measuringUnits = new CUnits($db);
- $result = $measuringUnits->fetchAll('', '', 0, 0, array(
- 't.unit_type' => $measuring_style,
- 't.active' => 1
- ));
+ $result = $measuringUnits->fetchAll(
+ '',
+ '',
+ 0,
+ 0,
+ array(
+ 't.unit_type' => $measuring_style,
+ 't.active' => 1,
+ )
+ );
if ($result < 0) {
dol_print_error($db);
return - 1;
@@ -332,8 +338,7 @@ class FormProduct
if ($adddefault)
$return .= '';
- foreach ($measuringUnits->records as $lines)
- {
+ foreach ($measuringUnits->records as $lines) {
$return .= '