add visibility

This commit is contained in:
Frédéric FRANCE 2019-03-01 18:28:51 +01:00
parent 796ea6f4ea
commit bd2e541fd6
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
30 changed files with 548 additions and 549 deletions

View File

@ -201,7 +201,7 @@
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint"> <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="Squiz.Scope.MethodScope.Missing" /> <!--<rule ref="Squiz.Scope.MethodScope.Missing" />-->
<!-- Rules from PEAR Standard --> <!-- Rules from PEAR Standard -->

View File

@ -103,7 +103,7 @@ class FactureRec extends CommonInvoice
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
} }
@ -1482,31 +1482,27 @@ class FactureRec extends CommonInvoice
*/ */
public function setFrequencyAndUnit($frequency, $unit) 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); dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with property table_element not defined", LOG_ERR);
return -1; 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); dol_syslog(get_class($this)."::setFrequencyAndUnit was called on objet with params frequency defined but unit not defined", LOG_ERR);
return -2; return -2;
} }
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null'); $sql.= ' SET frequency = '.($frequency?$this->db->escape($frequency):'null');
if (!empty($unit)) if (!empty($unit)) {
{
$sql.= ', unit_frequency = \''.$this->db->escape($unit).'\''; $sql.= ', unit_frequency = \''.$this->db->escape($unit).'\'';
} }
$sql.= ' WHERE rowid = '.$this->id; $sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG); dol_syslog(get_class($this)."::setFrequencyAndUnit", LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql)) {
{
$this->frequency = $frequency; $this->frequency = $frequency;
if (!empty($unit)) $this->unit_frequency = $unit; if (!empty($unit)) $this->unit_frequency = $unit;
return 1; return 1;
} }
else else
@ -1848,8 +1844,7 @@ class FactureLigneRec extends CommonInvoiceLine
$sql.= ", info_bits='".price2num($this->info_bits)."'"; $sql.= ", info_bits='".price2num($this->info_bits)."'";
$sql.= ", date_start_fill=".(int) $this->date_start_fill; $sql.= ", date_start_fill=".(int) $this->date_start_fill;
$sql.= ", date_end_fill=".(int) $this->date_end_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_ht=".price2num($this->total_ht);
$sql.= ", total_tva=".price2num($this->total_tva); $sql.= ", total_tva=".price2num($this->total_tva);
$sql.= ", total_localtax1=".price2num($this->total_localtax1); $sql.= ", total_localtax1=".price2num($this->total_localtax1);
@ -1864,8 +1859,8 @@ class FactureLigneRec extends CommonInvoiceLine
dol_syslog(get_class($this)."::updateline", LOG_DEBUG); dol_syslog(get_class($this)."::updateline", LOG_DEBUG);
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
{ {
$result=$this->insertExtraFields(); $result=$this->insertExtraFields();
@ -1886,8 +1881,8 @@ class FactureLigneRec extends CommonInvoiceLine
} }
// End call triggers // End call triggers
} }
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else else
{ {

View File

@ -378,7 +378,7 @@ class Tva extends CommonObject
return $solde; return $solde;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Total of the VAT from invoices emitted by the thirdparty. * Total of the VAT from invoices emitted by the thirdparty.
* *

View File

@ -1832,7 +1832,7 @@ class Contrat extends CommonObject
return $this->LibStatut($this->statut, $mode); 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 * 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 * Return list of line rowid
* *

View File

@ -36,9 +36,9 @@ class DoliDBMssql extends DoliDB
//! Database label //! Database label
const LABEL='MSSQL'; const LABEL='MSSQL';
//! Charset used to force charset when creating database //! 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 //! 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 //! Version min database
const VERSIONMIN='2000'; const VERSIONMIN='2000';
/** @var resource Resultset of last query */ /** @var resource Resultset of last query */
@ -55,7 +55,7 @@ class DoliDBMssql extends DoliDB
* @param string $name Nom de la database * @param string $name Nom de la database
* @param int $port Port of database server * @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; 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...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted * @return string SQL request line converted
*/ */
static function convertSQLFromMysql($line, $type = 'ddl') public static function convertSQLFromMysql($line, $type = 'ddl')
{ {
return $line; return $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Select a database * Select a database
* *
* @param string $database Name of database * @param string $database Name of database
* @return boolean true if OK, false if KO * @return boolean true if OK, false if KO
*/ */
function select_db($database) public function select_db($database)
{ {
// phpcs:enable // phpcs:enable
return @mssql_select_db($database, $this->db); return @mssql_select_db($database, $this->db);
@ -163,7 +163,7 @@ class DoliDBMssql extends DoliDB
* @return false|resource|true Database access handler * @return false|resource|true Database access handler
* @see close * @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"); dol_syslog(get_class($this)."::connect host=$host, port=$port, login=$login, passwd=--hidden--, name=$name");
$newhost=$host; $newhost=$host;
@ -191,7 +191,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getVersion() public function getVersion()
{ {
$resql=$this->query("SELECT @@VERSION"); $resql=$this->query("SELECT @@VERSION");
if ($resql) if ($resql)
@ -207,7 +207,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getDriverInfo() public function getDriverInfo()
{ {
return 'php mssql driver'; return 'php mssql driver';
} }
@ -218,7 +218,7 @@ class DoliDBMssql extends DoliDB
* @return bool True if disconnect successfull, false otherwise * @return bool True if disconnect successfull, false otherwise
* @see connect * @see connect
*/ */
function close() public function close()
{ {
if ($this->db) if ($this->db)
{ {
@ -235,7 +235,7 @@ class DoliDBMssql extends DoliDB
* *
* @return bool true if transaction successfuly opened or already opened, false if error * @return bool true if transaction successfuly opened or already opened, false if error
*/ */
function begin() public function begin()
{ {
$res=mssql_query('select @@TRANCOUNT'); $res=mssql_query('select @@TRANCOUNT');
@ -263,7 +263,7 @@ class DoliDBMssql extends DoliDB
* @param string $log Add more log to default log line * @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 * @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'); $res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0); $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 * @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 * @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'); $res=mssql_query('select @@TRANCOUNT');
$this->transaction_opened=mssql_result($res, 0, 0); $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...) * @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 * @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); $query = trim($query);
@ -368,11 +368,11 @@ class DoliDBMssql extends DoliDB
} }
else 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; $original_query=$query;
$query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")"; $query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")";
} }
} }
} }
@ -459,14 +459,14 @@ class DoliDBMssql extends DoliDB
return $ret; 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 * Renvoie la ligne courante (comme un objet) pour le curseur resultset
* *
* @param resource $resultset Curseur de la requete voulue * @param resource $resultset Curseur de la requete voulue
* @return object|false Object result line or false if KO or end of cursor * @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 // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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); return mssql_fetch_object($resultset);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return datas as an array * Return datas as an array
* *
* @param resource $resultset Resultset of request * @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor * @return array|false Array or false if KO or end of cursor
*/ */
function fetch_array($resultset) public function fetch_array($resultset)
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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 * Return datas as an array
* *
* @param resource $resultset Resultset of request * @param resource $resultset Resultset of request
* @return array|false Array or false if KO or end of cursor * @return array|false Array or false if KO or end of cursor
*/ */
function fetch_row($resultset) public function fetch_row($resultset)
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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); 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 * Return number of lines for result of a SELECT
* *
@ -513,7 +513,7 @@ class DoliDBMssql extends DoliDB
* @return int Nb of lines * @return int Nb of lines
* @see affected_rows * @see affected_rows
*/ */
function num_rows($resultset) public function num_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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); 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 * 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 * @return int Nombre de lignes
* @see num_rows * @see num_rows
*/ */
function affected_rows($resultset) public function affected_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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 * @param resource $resultset Curseur de la requete voulue
* @return bool * @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 // Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion
if (! is_resource($resultset)) { $resultset=$this->_results; } if (! is_resource($resultset)) { $resultset=$this->_results; }
@ -562,7 +562,7 @@ class DoliDBMssql extends DoliDB
* @param string $stringtoencode String to escape * @param string $stringtoencode String to escape
* @return string String escaped * @return string String escaped
*/ */
function escape($stringtoencode) public function escape($stringtoencode)
{ {
return addslashes($stringtoencode); return addslashes($stringtoencode);
} }
@ -575,7 +575,7 @@ class DoliDBMssql extends DoliDB
* @param string $param Date TMS to convert * @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS * @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"); 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...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() public function errno()
{ {
if (! $this->connected) if (! $this->connected)
{ {
@ -638,7 +638,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Error text * @return string Error text
*/ */
function error() public function error()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mssql_get_last_message. // 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 * Get last ID after an insert INSERT
* *
@ -657,7 +657,7 @@ class DoliDBMssql extends DoliDB
* @param string $fieldid Field name * @param string $fieldid Field name
* @return int Id of row or -1 on error * @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 // phpcs:enable
$res = $this->query("SELECT @@IDENTITY as id"); $res = $this->query("SELECT @@IDENTITY as id");
@ -679,7 +679,7 @@ class DoliDBMssql extends DoliDB
* @param int $withQuotes Return string with quotes * @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value' * @return string XXX(field) or XXX('value') or field or 'value'
*/ */
function encrypt($fieldorvalue, $withQuotes = 0) public function encrypt($fieldorvalue, $withQuotes = 0)
{ {
global $conf; global $conf;
@ -699,7 +699,7 @@ class DoliDBMssql extends DoliDB
* @param string $value Value to decrypt * @param string $value Value to decrypt
* @return string Decrypted value if used * @return string Decrypted value if used
*/ */
function decrypt($value) public function decrypt($value)
{ {
global $conf; 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 connexion ID
* *
* @return string Id connexion * @return string Id connexion
*/ */
function DDLGetConnectId() public function DDLGetConnectId()
{ {
// phpcs:enable // phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()'); $resql=$this->query('SELECT CONNECTION_ID()');
@ -732,7 +732,7 @@ class DoliDBMssql extends DoliDB
else return '?'; else return '?';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new database * Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated * 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 * @param string $owner Username of database owner
* @return false|resource|true resource defined if OK, false if KO * @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 // phpcs:enable
/*if (empty($charset)) $charset=$this->forcecharset; /*if (empty($charset)) $charset=$this->forcecharset;
@ -770,7 +770,7 @@ class DoliDBMssql extends DoliDB
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List tables into a database * List tables into a database
* *
@ -778,21 +778,21 @@ class DoliDBMssql extends DoliDB
* @param string $table Nmae of table filter ('xxx%') * @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array * @return array List of tables in an array
*/ */
function DDLListTables($database, $table = '') public function DDLListTables($database, $table = '')
{ {
// phpcs:enable // phpcs:enable
$this->_results = mssql_list_tables($database, $this->db); $this->_results = mssql_list_tables($database, $this->db);
return $this->_results; return $this->_results;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List information of columns into a table. * List information of columns into a table.
* *
* @param string $table Name of table * @param string $table Name of table
* @return array Tableau des informations des champs de la table * @return array Tableau des informations des champs de la table
*/ */
function DDLInfoTable($table) public function DDLInfoTable($table)
{ {
// phpcs:enable // phpcs:enable
@ -804,7 +804,7 @@ class DoliDBMssql extends DoliDB
return $infotables; return $infotables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a table into database * Create a table into database
* *
@ -817,7 +817,7 @@ class DoliDBMssql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur * @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
// FIXME: $fulltext_keys parameter is unused // FIXME: $fulltext_keys parameter is unused
@ -885,14 +885,14 @@ class DoliDBMssql extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a table into database * Drop a table into database
* *
* @param string $table Name of table * @param string $table Name of table
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function DDLDropTable($table) public function DDLDropTable($table)
{ {
// phpcs:enable // phpcs:enable
$sql = "DROP TABLE ".$table; $sql = "DROP TABLE ".$table;
@ -903,7 +903,7 @@ class DoliDBMssql extends DoliDB
return 1; 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 * 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 * @param string $field Optionnel : Name of field if we want description of field
* @return false|resource|true Resource * @return false|resource|true Resource
*/ */
function DDLDescTable($table, $field = "") public function DDLDescTable($table, $field = "")
{ {
// phpcs:enable // phpcs:enable
$sql="DESC ".$table." ".$field; $sql="DESC ".$table." ".$field;
@ -921,7 +921,7 @@ class DoliDBMssql extends DoliDB
return $this->_results; return $this->_results;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new field into table * Create a new field into table
* *
@ -931,7 +931,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc" * @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // 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; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update format of a field into a table * 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 * @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
@ -984,7 +984,7 @@ class DoliDBMssql extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a field from table * Drop a field from table
* *
@ -992,7 +992,7 @@ class DoliDBMssql extends DoliDB
* @param string $field_name Name of field to drop * @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function DDLDropField($table, $field_name) public function DDLDropField($table, $field_name)
{ {
// phpcs:enable // phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; $sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`";
@ -1005,7 +1005,7 @@ class DoliDBMssql extends DoliDB
else return 1; 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) * 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 * @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
$sql = "CREATE LOGIN ".$this->EscapeFieldName($dolibarr_main_db_user)." WITH PASSWORD='$dolibarr_main_db_pass'"; $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 * @return string Charset
*/ */
function getDefaultCharacterSetDatabase() public function getDefaultCharacterSetDatabase()
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1072,7 +1072,7 @@ class DoliDBMssql extends DoliDB
* *
* @return array List of Charset * @return array List of Charset
*/ */
function getListOfCharacterSet() public function getListOfCharacterSet()
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1085,7 +1085,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Collation value * @return string Collation value
*/ */
function getDefaultCollationDatabase() public function getDefaultCollationDatabase()
{ {
$resql=$this->query("SELECT SERVERPROPERTY('collation')"); $resql=$this->query("SELECT SERVERPROPERTY('collation')");
if (!$resql) if (!$resql)
@ -1101,7 +1101,7 @@ class DoliDBMssql extends DoliDB
* *
* @return array Liste of Collation * @return array Liste of Collation
*/ */
function getListOfCollation() public function getListOfCollation()
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1114,7 +1114,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Full path of dump program * @return string Full path of dump program
*/ */
function getPathOfDump() public function getPathOfDump()
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1127,7 +1127,7 @@ class DoliDBMssql extends DoliDB
* *
* @return string Full path of restore program * @return string Full path of restore program
*/ */
function getPathOfRestore() public function getPathOfRestore()
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1141,7 +1141,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerParametersValues($filter = '') public function getServerParametersValues($filter = '')
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1157,7 +1157,7 @@ class DoliDBMssql extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerStatusValues($filter = '') public function getServerStatusValues($filter = '')
{ {
// FIXME: Dummy method // FIXME: Dummy method
// TODO: Implement // TODO: Implement
@ -1166,21 +1166,21 @@ class DoliDBMssql extends DoliDB
return array(); return array();
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Escape a field name according to escape's syntax * Escape a field name according to escape's syntax
* *
* @param string $fieldname Field's name to escape * @param string $fieldname Field's name to escape
* @return string field's name escaped * @return string field's name escaped
*/ */
function EscapeFieldName($fieldname) public function EscapeFieldName($fieldname)
{ {
// phpcs:enable // phpcs:enable
return "[".$fieldname."]"; return "[".$fieldname."]";
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Get information on field * 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 * @param mixed $fields String for one field or array of string for multiple field
* @return false|object * @return false|object
*/ */
function GetFieldInformation($table, $fields) public function GetFieldInformation($table, $fields)
{ {
// phpcs:enable // phpcs:enable
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME"; $sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";

View File

@ -54,7 +54,7 @@ class DoliDBMysqli extends DoliDB
* @param string $name Nom de la database * @param string $name Nom de la database
* @param int $port Port of database server * @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; global $conf,$langs;
@ -167,14 +167,14 @@ class DoliDBMysqli extends DoliDB
return $line; return $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Select a database * Select a database
* *
* @param string $database Name of database * @param string $database Name of database
* @return boolean true if OK, false if KO * @return boolean true if OK, false if KO
*/ */
function select_db($database) public function select_db($database)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@ -193,7 +193,7 @@ class DoliDBMysqli extends DoliDB
* @return mysqli Database access object * @return mysqli Database access object
* @see close * @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); 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 * @return string Version string
*/ */
function getVersion() public function getVersion()
{ {
return $this->db->server_info; return $this->db->server_info;
} }
@ -218,7 +218,7 @@ class DoliDBMysqli extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getDriverInfo() public function getDriverInfo()
{ {
return $this->db->client_info; return $this->db->client_info;
} }
@ -230,7 +230,7 @@ class DoliDBMysqli extends DoliDB
* @return bool True if disconnect successfull, false otherwise * @return bool True if disconnect successfull, false otherwise
* @see connect * @see connect
*/ */
function close() public function close()
{ {
if ($this->db) 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...) * @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 * @return bool|mysqli_result Resultset of answer
*/ */
function query($query, $usesavepoint = 0, $type = 'auto') public function query($query, $usesavepoint = 0, $type = 'auto')
{ {
global $conf; global $conf;
@ -287,14 +287,14 @@ class DoliDBMysqli extends DoliDB
return $ret; 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 * Renvoie la ligne courante (comme un objet) pour le curseur resultset
* *
* @param mysqli_result $resultset Curseur de la requete voulue * @param mysqli_result $resultset Curseur de la requete voulue
* @return object|null Object result line or null if KO or end of cursor * @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 // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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 * Return datas as an array
* *
* @param mysqli_result $resultset Resultset of request * @param mysqli_result $resultset Resultset of request
* @return array|null Array or null if KO or end of cursor * @return array|null Array or null if KO or end of cursor
*/ */
function fetch_array($resultset) public function fetch_array($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -318,14 +318,14 @@ class DoliDBMysqli extends DoliDB
return $resultset->fetch_array(); return $resultset->fetch_array();
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return datas as an array * Return datas as an array
* *
* @param mysqli_result $resultset Resultset of request * @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 * @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 // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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 * Return number of lines for result of a SELECT
* *
@ -349,7 +349,7 @@ class DoliDBMysqli extends DoliDB
* @return int Nb of lines * @return int Nb of lines
* @see affected_rows * @see affected_rows
*/ */
function num_rows($resultset) public function num_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -357,7 +357,7 @@ class DoliDBMysqli extends DoliDB
return $resultset->num_rows; 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 * 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 * @return int Nombre de lignes
* @see num_rows * @see num_rows
*/ */
function affected_rows($resultset) public function affected_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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 * @param mysqli_result $resultset Curseur de la requete voulue
* @return void * @return void
*/ */
function free($resultset = null) public function free($resultset = null)
{ {
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; } if (! is_object($resultset)) { $resultset=$this->_results; }
@ -396,7 +396,7 @@ class DoliDBMysqli extends DoliDB
* @param string $stringtoencode String to escape * @param string $stringtoencode String to escape
* @return string String escaped * @return string String escaped
*/ */
function escape($stringtoencode) public function escape($stringtoencode)
{ {
return $this->db->real_escape_string($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...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() public function errno()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide. // 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 * @return string Error text
*/ */
function error() public function error()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour mysqli_error. // 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 * Get last ID after an insert INSERT
* *
@ -476,7 +476,7 @@ class DoliDBMysqli extends DoliDB
* @param string $fieldid Field name * @param string $fieldid Field name
* @return int|string Id of row * @return int|string Id of row
*/ */
function last_insert_id($tab, $fieldid = 'rowid') public function last_insert_id($tab, $fieldid = 'rowid')
{ {
// phpcs:enable // phpcs:enable
return $this->db->insert_id; return $this->db->insert_id;
@ -491,7 +491,7 @@ class DoliDBMysqli extends DoliDB
* @return string XXX(field) or XXX('value') or field or 'value' * @return string XXX(field) or XXX('value') or field or 'value'
* *
*/ */
function encrypt($fieldorvalue, $withQuotes = 0) public function encrypt($fieldorvalue, $withQuotes = 0)
{ {
global $conf; global $conf;
@ -524,7 +524,7 @@ class DoliDBMysqli extends DoliDB
* @param string $value Value to decrypt * @param string $value Value to decrypt
* @return string Decrypted value if used * @return string Decrypted value if used
*/ */
function decrypt($value) public function decrypt($value)
{ {
global $conf; 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 connexion ID
* *
* @return string Id connexion * @return string Id connexion
*/ */
function DDLGetConnectId() public function DDLGetConnectId()
{ {
// phpcs:enable // phpcs:enable
$resql=$this->query('SELECT CONNECTION_ID()'); $resql=$this->query('SELECT CONNECTION_ID()');
@ -570,7 +570,7 @@ class DoliDBMysqli extends DoliDB
else return '?'; else return '?';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new database * Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated * 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 * @param string $owner Username of database owner
* @return bool|mysqli_result resource defined if OK, null if KO * @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 // phpcs:enable
if (empty($charset)) $charset=$this->forcecharset; if (empty($charset)) $charset=$this->forcecharset;
@ -604,7 +604,7 @@ class DoliDBMysqli extends DoliDB
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List tables into a database * List tables into a database
* *
@ -612,7 +612,7 @@ class DoliDBMysqli extends DoliDB
* @param string $table Nmae of table filter ('xxx%') * @param string $table Nmae of table filter ('xxx%')
* @return array List of tables in an array * @return array List of tables in an array
*/ */
function DDLListTables($database, $table = '') public function DDLListTables($database, $table = '')
{ {
// phpcs:enable // phpcs:enable
$listtables=array(); $listtables=array();
@ -632,14 +632,14 @@ class DoliDBMysqli extends DoliDB
return $listtables; return $listtables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List information of columns into a table. * List information of columns into a table.
* *
* @param string $table Name of table * @param string $table Name of table
* @return array Tableau des informations des champs de la table * @return array Tableau des informations des champs de la table
*/ */
function DDLInfoTable($table) public function DDLInfoTable($table)
{ {
// phpcs:enable // phpcs:enable
$infotables=array(); $infotables=array();
@ -658,7 +658,7 @@ class DoliDBMysqli extends DoliDB
return $infotables; return $infotables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a table into database * Create a table into database
* *
@ -671,7 +671,7 @@ class DoliDBMysqli extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur * @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
// FIXME: $fulltext_keys parameter is unused // FIXME: $fulltext_keys parameter is unused
@ -742,14 +742,14 @@ class DoliDBMysqli extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a table into database * Drop a table into database
* *
* @param string $table Name of table * @param string $table Name of table
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function DDLDropTable($table) public function DDLDropTable($table)
{ {
// phpcs:enable // phpcs:enable
$sql = "DROP TABLE ".$table; $sql = "DROP TABLE ".$table;
@ -760,7 +760,7 @@ class DoliDBMysqli extends DoliDB
return 1; 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 * 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 * @param string $field Optionnel : Name of field if we want description of field
* @return bool|mysqli_result Resultset x (x->Field, x->Type, ...) * @return bool|mysqli_result Resultset x (x->Field, x->Type, ...)
*/ */
function DDLDescTable($table, $field = "") public function DDLDescTable($table, $field = "")
{ {
// phpcs:enable // phpcs:enable
$sql="DESC ".$table." ".$field; $sql="DESC ".$table." ".$field;
@ -778,7 +778,7 @@ class DoliDBMysqli extends DoliDB
return $this->_results; return $this->_results;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new field into table * Create a new field into table
* *
@ -788,7 +788,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc" * @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // 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; return -1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update format of a field into a table * 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 * @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
@ -877,7 +877,7 @@ class DoliDBMysqli extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a field from table * Drop a field from table
* *
@ -885,7 +885,7 @@ class DoliDBMysqli extends DoliDB
* @param string $field_name Name of field to drop * @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function DDLDropField($table, $field_name) public function DDLDropField($table, $field_name)
{ {
// phpcs:enable // phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; $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) * 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 * @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
$sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'"; $sql = "CREATE USER '".$this->escape($dolibarr_main_db_user)."'";
@ -953,7 +953,7 @@ class DoliDBMysqli extends DoliDB
* @return string Charset * @return string Charset
* @see getDefaultCollationDatabase * @see getDefaultCollationDatabase
*/ */
function getDefaultCharacterSetDatabase() public function getDefaultCharacterSetDatabase()
{ {
$resql=$this->query('SHOW VARIABLES LIKE \'character_set_database\''); $resql=$this->query('SHOW VARIABLES LIKE \'character_set_database\'');
if (!$resql) if (!$resql)
@ -972,7 +972,7 @@ class DoliDBMysqli extends DoliDB
* *
* @return array|null List of Charset * @return array|null List of Charset
*/ */
function getListOfCharacterSet() public function getListOfCharacterSet()
{ {
$resql=$this->query('SHOW CHARSET'); $resql=$this->query('SHOW CHARSET');
$liste = array(); $liste = array();
@ -999,7 +999,7 @@ class DoliDBMysqli extends DoliDB
* @return string Collation value * @return string Collation value
* @see getDefaultCharacterSetDatabase * @see getDefaultCharacterSetDatabase
*/ */
function getDefaultCollationDatabase() public function getDefaultCollationDatabase()
{ {
$resql=$this->query('SHOW VARIABLES LIKE \'collation_database\''); $resql=$this->query('SHOW VARIABLES LIKE \'collation_database\'');
if (!$resql) if (!$resql)
@ -1018,7 +1018,7 @@ class DoliDBMysqli extends DoliDB
* *
* @return array|null Liste of Collation * @return array|null Liste of Collation
*/ */
function getListOfCollation() public function getListOfCollation()
{ {
$resql=$this->query('SHOW COLLATION'); $resql=$this->query('SHOW COLLATION');
$liste = array(); $liste = array();
@ -1043,7 +1043,7 @@ class DoliDBMysqli extends DoliDB
* *
* @return string Full path of dump program * @return string Full path of dump program
*/ */
function getPathOfDump() public function getPathOfDump()
{ {
$fullpathofdump='/pathtomysqldump/mysqldump'; $fullpathofdump='/pathtomysqldump/mysqldump';
@ -1062,7 +1062,7 @@ class DoliDBMysqli extends DoliDB
* *
* @return string Full path of restore program * @return string Full path of restore program
*/ */
function getPathOfRestore() public function getPathOfRestore()
{ {
$fullpathofimport='/pathtomysql/mysql'; $fullpathofimport='/pathtomysql/mysql';
@ -1082,7 +1082,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerParametersValues($filter = '') public function getServerParametersValues($filter = '')
{ {
$result=array(); $result=array();
@ -1103,7 +1103,7 @@ class DoliDBMysqli extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerStatusValues($filter = '') public function getServerStatusValues($filter = '')
{ {
$result=array(); $result=array();

View File

@ -40,9 +40,9 @@ class DoliDBPgsql extends DoliDB
//! Database label //! Database label
const LABEL='PostgreSQL'; // Label of manager const LABEL='PostgreSQL'; // Label of manager
//! Charset //! 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 //! 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 //! Version min database
const VERSIONMIN='9.0.0'; // Version min database const VERSIONMIN='9.0.0'; // Version min database
/** @var resource Resultset of last query */ /** @var resource Resultset of last query */
@ -62,7 +62,7 @@ class DoliDBPgsql extends DoliDB
* @param string $name Nom de la database * @param string $name Nom de la database
* @param int $port Port of database server * @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; global $conf,$langs;
@ -368,7 +368,7 @@ class DoliDBPgsql extends DoliDB
return $line; return $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Select a database * Select a database
* Ici postgresql n'a aucune fonction equivalente de mysql_select_db * 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 * @param string $database Name of database
* @return bool true if OK, false if KO * @return bool true if OK, false if KO
*/ */
function select_db($database) public function select_db($database)
{ {
// phpcs:enable // phpcs:enable
if ($database == $this->database_name) { if ($database == $this->database_name) {
@ -398,7 +398,7 @@ class DoliDBPgsql extends DoliDB
* @return false|resource Database access handler * @return false|resource Database access handler
* @see close * @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 // 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 * @return string Version string
*/ */
function getVersion() public function getVersion()
{ {
$resql=$this->query('SHOW server_version'); $resql=$this->query('SHOW server_version');
if ($resql) if ($resql)
@ -462,7 +462,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getDriverInfo() public function getDriverInfo()
{ {
return 'pgsql php driver'; return 'pgsql php driver';
} }
@ -473,7 +473,7 @@ class DoliDBPgsql extends DoliDB
* @return boolean True if disconnect successfull, false otherwise * @return boolean True if disconnect successfull, false otherwise
* @see connect * @see connect
*/ */
function close() public function close()
{ {
if ($this->db) 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...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return false|resource Resultset of answer * @return false|resource Resultset of answer
*/ */
function query($query, $usesavepoint = 0, $type = 'auto') public function query($query, $usesavepoint = 0, $type = 'auto')
{ {
global $conf; global $conf;
@ -554,14 +554,14 @@ class DoliDBPgsql extends DoliDB
return $ret; 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 * Renvoie la ligne courante (comme un objet) pour le curseur resultset
* *
* @param resource $resultset Curseur de la requete voulue * @param resource $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor * @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 // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -569,14 +569,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_object($resultset); return pg_fetch_object($resultset);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return datas as an array * Return datas as an array
* *
* @param resource $resultset Resultset of request * @param resource $resultset Resultset of request
* @return false|array Array * @return false|array Array
*/ */
function fetch_array($resultset) public function fetch_array($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -584,14 +584,14 @@ class DoliDBPgsql extends DoliDB
return pg_fetch_array($resultset); return pg_fetch_array($resultset);
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return datas as an array * Return datas as an array
* *
* @param resource $resultset Resultset of request * @param resource $resultset Resultset of request
* @return false|array Array * @return false|array Array
*/ */
function fetch_row($resultset) public function fetch_row($resultset)
{ {
// phpcs:enable // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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); 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 * 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 * @return int Nb of lines, -1 on error
* @see affected_rows * @see affected_rows
*/ */
function num_rows($resultset) public function num_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -615,7 +615,7 @@ class DoliDBPgsql extends DoliDB
return pg_num_rows($resultset); 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 * 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 * @return int Nb of lines
* @see num_rows * @see num_rows
*/ */
function affected_rows($resultset) public function affected_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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 * @param resource $resultset Result set of request
* @return void * @return void
*/ */
function free($resultset = null) public function free($resultset = null)
{ {
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
if (! is_resource($resultset)) { $resultset=$this->_results; } 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 * @param int $offset Numero of line from where starting fetch
* @return string String with SQL syntax to add a limit and offset * @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; global $conf;
if (empty($limit)) return ""; if (empty($limit)) return "";
@ -672,7 +672,7 @@ class DoliDBPgsql extends DoliDB
* @param string $stringtoencode String to escape * @param string $stringtoencode String to escape
* @return string String escaped * @return string String escaped
*/ */
function escape($stringtoencode) public function escape($stringtoencode)
{ {
return pg_escape_string($stringtoencode); return pg_escape_string($stringtoencode);
} }
@ -684,7 +684,7 @@ class DoliDBPgsql extends DoliDB
* @param string $param Date TMS to convert * @param string $param Date TMS to convert
* @return string Date in a string YYYY-MM-DD HH:MM:SS * @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"); 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 * @param string $resko resultat si test non egal
* @return string chaine formate SQL * @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)'; 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...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() public function errno()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide. // 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 * @return string Error text
*/ */
function error() public function error()
{ {
return pg_last_error($this->db); 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 * Get last ID after an insert INSERT
* *
@ -786,7 +786,7 @@ class DoliDBPgsql extends DoliDB
* @param string $fieldid Field name * @param string $fieldid Field name
* @return string Id of row * @return string Id of row
*/ */
function last_insert_id($tab, $fieldid = 'rowid') public function last_insert_id($tab, $fieldid = 'rowid')
{ {
// phpcs:enable // phpcs:enable
//$result = pg_query($this->db,"SELECT MAX(".$fieldid.") FROM ".$tab); //$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 * @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value' * @return string XXX(field) or XXX('value') or field or 'value'
*/ */
function encrypt($fieldorvalue, $withQuotes = 0) public function encrypt($fieldorvalue, $withQuotes = 0)
{ {
global $conf; global $conf;
@ -830,7 +830,7 @@ class DoliDBPgsql extends DoliDB
* @param int $value Value to decrypt * @param int $value Value to decrypt
* @return string Decrypted value if used * @return string Decrypted value if used
*/ */
function decrypt($value) public function decrypt($value)
{ {
global $conf; 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 connexion ID
* *
* @return string Id connexion * @return string Id connexion
*/ */
function DDLGetConnectId() public function DDLGetConnectId()
{ {
// phpcs:enable // phpcs:enable
return '?'; 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 * Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated * 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 * @param string $owner Username of database owner
* @return false|resource resource defined if OK, null if KO * @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 // phpcs:enable
if (empty($charset)) $charset=$this->forcecharset; if (empty($charset)) $charset=$this->forcecharset;
@ -886,7 +886,7 @@ class DoliDBPgsql extends DoliDB
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List tables into a database * List tables into a database
* *
@ -894,7 +894,7 @@ class DoliDBPgsql extends DoliDB
* @param string $table Name of table filter ('xxx%') * @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array * @return array List of tables in an array
*/ */
function DDLListTables($database, $table = '') public function DDLListTables($database, $table = '')
{ {
// phpcs:enable // phpcs:enable
$listtables=array(); $listtables=array();
@ -912,7 +912,7 @@ class DoliDBPgsql extends DoliDB
return $listtables; return $listtables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List information of columns into a table. * 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 * @return array Tableau des informations des champs de la table
* *
*/ */
function DDLInfoTable($table) public function DDLInfoTable($table)
{ {
// phpcs:enable // phpcs:enable
$infotables=array(); $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 * Create a table into database
* *
@ -967,7 +967,7 @@ class DoliDBPgsql extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur * @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
// FIXME: $fulltext_keys parameter is unused // FIXME: $fulltext_keys parameter is unused
@ -1035,14 +1035,14 @@ class DoliDBPgsql extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a table into database * Drop a table into database
* *
* @param string $table Name of table * @param string $table Name of table
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function DDLDropTable($table) public function DDLDropTable($table)
{ {
// phpcs:enable // phpcs:enable
$sql = "DROP TABLE ".$table; $sql = "DROP TABLE ".$table;
@ -1053,7 +1053,7 @@ class DoliDBPgsql extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a user to connect to database * 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 * @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
// Note: using ' on user does not works with pgsql // Note: using ' on user does not works with pgsql
@ -1079,7 +1079,7 @@ class DoliDBPgsql extends DoliDB
return 1; 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 * 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 * @param string $field Optionnel : Name of field if we want description of field
* @return false|resource Resultset x (x->attname) * @return false|resource Resultset x (x->attname)
*/ */
function DDLDescTable($table, $field = "") public function DDLDescTable($table, $field = "")
{ {
// phpcs:enable // phpcs:enable
$sql ="SELECT attname FROM pg_attribute, pg_type WHERE typname = '".$table."' AND attrelid = typrelid"; $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; return $this->_results;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new field into table * Create a new field into table
* *
@ -1109,7 +1109,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc" * @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // 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; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update format of a field into a table * 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 * @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
@ -1185,7 +1185,7 @@ class DoliDBPgsql extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a field from table * Drop a field from table
* *
@ -1193,7 +1193,7 @@ class DoliDBPgsql extends DoliDB
* @param string $field_name Name of field to drop * @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function DDLDropField($table, $field_name) public function DDLDropField($table, $field_name)
{ {
// phpcs:enable // phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name; $sql= "ALTER TABLE ".$table." DROP COLUMN ".$field_name;
@ -1211,7 +1211,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return string Charset * @return string Charset
*/ */
function getDefaultCharacterSetDatabase() public function getDefaultCharacterSetDatabase()
{ {
$resql=$this->query('SHOW SERVER_ENCODING'); $resql=$this->query('SHOW SERVER_ENCODING');
if ($resql) if ($resql)
@ -1227,7 +1227,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return array List of Charset * @return array List of Charset
*/ */
function getListOfCharacterSet() public function getListOfCharacterSet()
{ {
$resql=$this->query('SHOW SERVER_ENCODING'); $resql=$this->query('SHOW SERVER_ENCODING');
$liste = array(); $liste = array();
@ -1252,7 +1252,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return string Collation value * @return string Collation value
*/ */
function getDefaultCollationDatabase() public function getDefaultCollationDatabase()
{ {
$resql=$this->query('SHOW LC_COLLATE'); $resql=$this->query('SHOW LC_COLLATE');
if ($resql) if ($resql)
@ -1268,7 +1268,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return array Liste of Collation * @return array Liste of Collation
*/ */
function getListOfCollation() public function getListOfCollation()
{ {
$resql=$this->query('SHOW LC_COLLATE'); $resql=$this->query('SHOW LC_COLLATE');
$liste = array(); $liste = array();
@ -1292,7 +1292,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return string Full path of dump program * @return string Full path of dump program
*/ */
function getPathOfDump() public function getPathOfDump()
{ {
$fullpathofdump='/pathtopgdump/pg_dump'; $fullpathofdump='/pathtopgdump/pg_dump';
@ -1320,7 +1320,7 @@ class DoliDBPgsql extends DoliDB
* *
* @return string Full path of restore program * @return string Full path of restore program
*/ */
function getPathOfRestore() public function getPathOfRestore()
{ {
//$tool='pg_restore'; //$tool='pg_restore';
$tool='psql'; $tool='psql';
@ -1352,7 +1352,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerParametersValues($filter = '') public function getServerParametersValues($filter = '')
{ {
$result=array(); $result=array();
@ -1373,7 +1373,7 @@ class DoliDBPgsql extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerStatusValues($filter = '') public function getServerStatusValues($filter = '')
{ {
/* This is to return current running requests. /* This is to return current running requests.
$sql='SELECT datname,procpid,current_query FROM pg_stat_activity ORDER BY procpid'; $sql='SELECT datname,procpid,current_query FROM pg_stat_activity ORDER BY procpid';

View File

@ -38,8 +38,8 @@ class DoliDBSqlite3 extends DoliDB
const LABEL='Sqlite3'; const LABEL='Sqlite3';
//! Version min database //! Version min database
const VERSIONMIN='3.0.0'; const VERSIONMIN='3.0.0';
/** @var SQLite3Result Resultset of last query */ /** @var SQLite3Result Resultset of last query */
private $_results; private $_results;
const WEEK_MONDAY_FIRST=1; const WEEK_MONDAY_FIRST=1;
const WEEK_YEAR = 2; const WEEK_YEAR = 2;
@ -47,17 +47,17 @@ class DoliDBSqlite3 extends DoliDB
/** /**
* Constructor. * Constructor.
* This create an opened connexion to a database server and eventually to a database * This create an opened connexion to a database server and eventually to a database
* *
* @param string $type Type of database (mysql, pgsql...) * @param string $type Type of database (mysql, pgsql...)
* @param string $host Address of database server * @param string $host Address of database server
* @param string $user Nom de l'utilisateur autorise * @param string $user Nom de l'utilisateur autorise
* @param string $pass Mot de passe * @param string $pass Mot de passe
* @param string $name Nom de la database * @param string $name Nom de la database
* @param int $port Port of database server * @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; 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...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return string SQL request line converted * @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 // Removed empty line if this is a comment line for SVN tagging
if (preg_match('/^--\s\$Id/i', $line)) { if (preg_match('/^--\s\$Id/i', $line)) {
@ -295,14 +295,14 @@ class DoliDBSqlite3 extends DoliDB
return $line; return $line;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Select a database * Select a database
* *
* @param string $database Name of database * @param string $database Name of database
* @return boolean true if OK, false if KO * @return boolean true if OK, false if KO
*/ */
function select_db($database) public function select_db($database)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG); dol_syslog(get_class($this)."::select_db database=".$database, LOG_DEBUG);
@ -323,7 +323,7 @@ class DoliDBSqlite3 extends DoliDB
* @return SQLite3 Database access handler * @return SQLite3 Database access handler
* @see close * @see close
*/ */
function connect($host, $login, $passwd, $name, $port = 0) public function connect($host, $login, $passwd, $name, $port = 0)
{ {
global $main_data_dir; global $main_data_dir;
@ -356,7 +356,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getVersion() public function getVersion()
{ {
$tmp=$this->db->version(); $tmp=$this->db->version();
return $tmp['versionString']; return $tmp['versionString'];
@ -367,7 +367,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Version string * @return string Version string
*/ */
function getDriverInfo() public function getDriverInfo()
{ {
return 'sqlite3 php driver'; return 'sqlite3 php driver';
} }
@ -379,7 +379,7 @@ class DoliDBSqlite3 extends DoliDB
* @return bool True if disconnect successfull, false otherwise * @return bool True if disconnect successfull, false otherwise
* @see connect * @see connect
*/ */
function close() public function close()
{ {
if ($this->db) 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...) * @param string $type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
* @return SQLite3Result Resultset of answer * @return SQLite3Result Resultset of answer
*/ */
function query($query, $usesavepoint = 0, $type = 'auto') public function query($query, $usesavepoint = 0, $type = 'auto')
{ {
$ret=null; $ret=null;
$query = trim($query); $query = trim($query);
@ -490,14 +490,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret; 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 * Renvoie la ligne courante (comme un objet) pour le curseur resultset
* *
* @param SQLite3Result $resultset Curseur de la requete voulue * @param SQLite3Result $resultset Curseur de la requete voulue
* @return false|object Object result line or false if KO or end of cursor * @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 // phpcs:enable
// Si le resultset n'est pas fourni, on prend le dernier utilise sur cette connexion // 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 * Return datas as an array
* *
* @param SQLite3Result $resultset Resultset of request * @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor * @return false|array Array or false if KO or end of cursor
*/ */
function fetch_array($resultset) public function fetch_array($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
@ -528,14 +528,14 @@ class DoliDBSqlite3 extends DoliDB
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return datas as an array * Return datas as an array
* *
* @param SQLite3Result $resultset Resultset of request * @param SQLite3Result $resultset Resultset of request
* @return false|array Array or false if KO or end of cursor * @return false|array Array or false if KO or end of cursor
*/ */
function fetch_row($resultset) public function fetch_row($resultset)
{ {
// phpcs:enable // phpcs:enable
// If resultset not provided, we take the last used by connexion // 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 * Return number of lines for result of a SELECT
* *
@ -559,7 +559,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines * @return int Nb of lines
* @see affected_rows * @see affected_rows
*/ */
function num_rows($resultset) public function num_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// FIXME: SQLite3Result does not have a queryString member // FIXME: SQLite3Result does not have a queryString member
@ -572,7 +572,7 @@ class DoliDBSqlite3 extends DoliDB
return 0; return 0;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return number of lines for result of a SELECT * Return number of lines for result of a SELECT
* *
@ -580,7 +580,7 @@ class DoliDBSqlite3 extends DoliDB
* @return int Nb of lines * @return int Nb of lines
* @see affected_rows * @see affected_rows
*/ */
function affected_rows($resultset) public function affected_rows($resultset)
{ {
// phpcs:enable // phpcs:enable
// FIXME: SQLite3Result does not have a queryString member // FIXME: SQLite3Result does not have a queryString member
@ -602,7 +602,7 @@ class DoliDBSqlite3 extends DoliDB
* @param SQLite3Result $resultset Curseur de la requete voulue * @param SQLite3Result $resultset Curseur de la requete voulue
* @return void * @return void
*/ */
function free($resultset = null) public function free($resultset = null)
{ {
// If resultset not provided, we take the last used by connexion // If resultset not provided, we take the last used by connexion
if (! is_object($resultset)) { $resultset=$this->_results; } if (! is_object($resultset)) { $resultset=$this->_results; }
@ -616,7 +616,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $stringtoencode String to escape * @param string $stringtoencode String to escape
* @return string String escaped * @return string String escaped
*/ */
function escape($stringtoencode) public function escape($stringtoencode)
{ {
return Sqlite3::escapeString($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...) * @return string Error code (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
*/ */
function errno() public function errno()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide. // 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 * @return string Error text
*/ */
function error() public function error()
{ {
if (! $this->connected) { if (! $this->connected) {
// Si il y a eu echec de connexion, $this->db n'est pas valide pour sqlite_error. // 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 * Get last ID after an insert INSERT
* *
@ -710,7 +710,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $fieldid Field name * @param string $fieldid Field name
* @return int Id of row * @return int Id of row
*/ */
function last_insert_id($tab, $fieldid = 'rowid') public function last_insert_id($tab, $fieldid = 'rowid')
{ {
// phpcs:enable // phpcs:enable
return $this->db->lastInsertRowId(); return $this->db->lastInsertRowId();
@ -724,7 +724,7 @@ class DoliDBSqlite3 extends DoliDB
* @param int $withQuotes Return string with quotes * @param int $withQuotes Return string with quotes
* @return string XXX(field) or XXX('value') or field or 'value' * @return string XXX(field) or XXX('value') or field or 'value'
*/ */
function encrypt($fieldorvalue, $withQuotes = 0) public function encrypt($fieldorvalue, $withQuotes = 0)
{ {
global $conf; global $conf;
@ -757,7 +757,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $value Value to decrypt * @param string $value Value to decrypt
* @return string Decrypted value if used * @return string Decrypted value if used
*/ */
function decrypt($value) public function decrypt($value)
{ {
global $conf; 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 connexion ID
* *
* @return string Id connexion * @return string Id connexion
*/ */
function DDLGetConnectId() public function DDLGetConnectId()
{ {
// phpcs:enable // phpcs:enable
return '?'; return '?';
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new database * Create a new database
* Do not use function xxx_create_db (xxx=mysql, ...) as they are deprecated * 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 * @param string $owner Username of database owner
* @return SQLite3Result resource defined if OK, null if KO * @return SQLite3Result resource defined if OK, null if KO
*/ */
function DDLCreateDb($database, $charset = '', $collation = '', $owner = '') public function DDLCreateDb($database, $charset = '', $collation = '', $owner = '')
{ {
// phpcs:enable // phpcs:enable
if (empty($charset)) $charset=$this->forcecharset; if (empty($charset)) $charset=$this->forcecharset;
@ -832,7 +832,7 @@ class DoliDBSqlite3 extends DoliDB
return $ret; return $ret;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List tables into a database * List tables into a database
* *
@ -840,7 +840,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $table Name of table filter ('xxx%') * @param string $table Name of table filter ('xxx%')
* @return array List of tables in an array * @return array List of tables in an array
*/ */
function DDLListTables($database, $table = '') public function DDLListTables($database, $table = '')
{ {
// phpcs:enable // phpcs:enable
$listtables=array(); $listtables=array();
@ -860,7 +860,7 @@ class DoliDBSqlite3 extends DoliDB
return $listtables; return $listtables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* List information of columns into a table. * 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 * @return array Tableau des informations des champs de la table
* TODO modify for sqlite * TODO modify for sqlite
*/ */
function DDLInfoTable($table) public function DDLInfoTable($table)
{ {
// phpcs:enable // phpcs:enable
$infotables=array(); $infotables=array();
@ -887,7 +887,7 @@ class DoliDBSqlite3 extends DoliDB
return $infotables; return $infotables;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a table into database * Create a table into database
* *
@ -900,7 +900,7 @@ class DoliDBSqlite3 extends DoliDB
* @param array $keys Tableau des champs cles noms => valeur * @param array $keys Tableau des champs cles noms => valeur
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
// FIXME: $fulltext_keys parameter is unused // FIXME: $fulltext_keys parameter is unused
@ -967,14 +967,14 @@ class DoliDBSqlite3 extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a table into database * Drop a table into database
* *
* @param string $table Name of table * @param string $table Name of table
* @return int <0 if KO, >=0 if OK * @return int <0 if KO, >=0 if OK
*/ */
function DDLDropTable($table) public function DDLDropTable($table)
{ {
// phpcs:enable // phpcs:enable
$sql = "DROP TABLE ".$table; $sql = "DROP TABLE ".$table;
@ -985,7 +985,7 @@ class DoliDBSqlite3 extends DoliDB
return 1; 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 * 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 * @param string $field Optionnel : Name of field if we want description of field
* @return SQLite3Result Resource * @return SQLite3Result Resource
*/ */
function DDLDescTable($table, $field = "") public function DDLDescTable($table, $field = "")
{ {
// phpcs:enable // phpcs:enable
$sql="DESC ".$table." ".$field; $sql="DESC ".$table." ".$field;
@ -1003,7 +1003,7 @@ class DoliDBSqlite3 extends DoliDB
return $this->_results; return $this->_results;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Create a new field into table * Create a new field into table
* *
@ -1013,7 +1013,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_position Optionnel ex.: "after champtruc" * @param string $field_position Optionnel ex.: "after champtruc"
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
// cles recherchees dans le tableau des descriptions (field_desc) : type,value,attribute,null,default,extra // 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; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Update format of a field into a table * 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 * @param string $field_desc Array with description of field format
* @return int <0 if KO, >0 if OK * @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 // phpcs:enable
$sql = "ALTER TABLE ".$table; $sql = "ALTER TABLE ".$table;
@ -1072,7 +1072,7 @@ class DoliDBSqlite3 extends DoliDB
return 1; return 1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Drop a field from table * Drop a field from table
* *
@ -1080,7 +1080,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $field_name Name of field to drop * @param string $field_name Name of field to drop
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function DDLDropField($table, $field_name) public function DDLDropField($table, $field_name)
{ {
// phpcs:enable // phpcs:enable
$sql= "ALTER TABLE ".$table." DROP COLUMN `".$field_name."`"; $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) * 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 * @param string $dolibarr_main_db_name Database name where user must be granted
* @return int <0 if KO, >=0 if OK * @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 // phpcs:enable
$sql = "INSERT INTO user "; $sql = "INSERT INTO user ";
@ -1147,7 +1147,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Charset * @return string Charset
*/ */
function getDefaultCharacterSetDatabase() public function getDefaultCharacterSetDatabase()
{ {
return 'UTF-8'; return 'UTF-8';
} }
@ -1157,7 +1157,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return array List of Charset * @return array List of Charset
*/ */
function getListOfCharacterSet() public function getListOfCharacterSet()
{ {
$liste = array(); $liste = array();
$i=0; $i=0;
@ -1171,7 +1171,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Collation value * @return string Collation value
*/ */
function getDefaultCollationDatabase() public function getDefaultCollationDatabase()
{ {
return 'UTF-8'; return 'UTF-8';
} }
@ -1181,7 +1181,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return array List of Collation * @return array List of Collation
*/ */
function getListOfCollation() public function getListOfCollation()
{ {
$liste = array(); $liste = array();
$i=0; $i=0;
@ -1195,7 +1195,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Full path of dump program * @return string Full path of dump program
*/ */
function getPathOfDump() public function getPathOfDump()
{ {
// FIXME: not for SQLite // FIXME: not for SQLite
$fullpathofdump='/pathtomysqldump/mysqldump'; $fullpathofdump='/pathtomysqldump/mysqldump';
@ -1215,7 +1215,7 @@ class DoliDBSqlite3 extends DoliDB
* *
* @return string Full path of restore program * @return string Full path of restore program
*/ */
function getPathOfRestore() public function getPathOfRestore()
{ {
// FIXME: not for SQLite // FIXME: not for SQLite
$fullpathofimport='/pathtomysql/mysql'; $fullpathofimport='/pathtomysql/mysql';
@ -1236,7 +1236,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerParametersValues($filter = '') public function getServerParametersValues($filter = '')
{ {
$result=array(); $result=array();
static $pragmas; static $pragmas;
@ -1285,7 +1285,7 @@ class DoliDBSqlite3 extends DoliDB
* @param string $filter Filter list on a particular value * @param string $filter Filter list on a particular value
* @return array Array of key-values (key=>value) * @return array Array of key-values (key=>value)
*/ */
function getServerStatusValues($filter = '') public function getServerStatusValues($filter = '')
{ {
$result=array(); $result=array();
/* /*

View File

@ -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; global $conf, $langs, $mysoc;
@ -107,7 +107,7 @@ class doc_generic_contract_odt extends ModelePDFContract
* @param Translate $langs Lang object to use for output * @param Translate $langs Lang object to use for output
* @return string Description * @return string Description
*/ */
function info($langs) public function info($langs)
{ {
global $conf,$langs; global $conf,$langs;
@ -181,19 +181,19 @@ class doc_generic_contract_odt extends ModelePDFContract
return $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. * Function to build a document on disk using the generic odt module.
* *
* @param Contract $object Object source to build document * @param Contract $object Object source to build document
* @param Translate $outputlangs Lang output object * @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file * @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details * @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @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 // phpcs:enable
global $user,$langs,$conf,$mysoc,$hookmanager; global $user,$langs,$conf,$mysoc,$hookmanager;
@ -291,10 +291,9 @@ class doc_generic_contract_odt extends ModelePDFContract
// Recipient name // Recipient name
$contactobject=null; $contactobject=null;
if (! empty($usecontact)) if (! empty($usecontact)) {
{ // On peut utiliser le nom de la societe du contact
// On peut utiliser le nom de la societe du contact if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) {
$socobject = $object->contact; $socobject = $object->contact;
} else { } else {
$socobject = $object->thirdparty; $socobject = $object->thirdparty;

View File

@ -61,7 +61,7 @@ class pdf_strato extends ModelePDFContract
public $type; 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) * e.g.: PHP ≥ 5.4 = array(5, 4)
*/ */
public $phpmin = array(5, 4); public $phpmin = array(5, 4);
@ -124,7 +124,7 @@ class pdf_strato extends ModelePDFContract
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) public function __construct($db)
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
@ -160,7 +160,7 @@ class pdf_strato extends ModelePDFContract
$this->posxdesc=$this->marge_gauche+1; $this->posxdesc=$this->marge_gauche+1;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Function to build pdf onto disk * Function to build pdf onto disk
* *
@ -171,9 +171,9 @@ class pdf_strato extends ModelePDFContract
* @param int $hidedesc Do not show desc * @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref * @param int $hideref Do not show ref
* @return int 1=OK, 0=KO * @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 // phpcs:enable
global $user,$langs,$conf,$hookmanager,$mysoc; global $user,$langs,$conf,$hookmanager,$mysoc;
@ -513,7 +513,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidebottom Hide bottom bar of array * @param int $hidebottom Hide bottom bar of array
* @return void * @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; global $conf;
@ -522,7 +522,7 @@ class pdf_strato extends ModelePDFContract
if ($hidetop) $hidetop=-1; if ($hidetop) $hidetop=-1;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
/* /*
$pdf->SetXY($this->marge_gauche, $tab_top); $pdf->SetXY($this->marge_gauche, $tab_top);
$pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); $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); $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->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. $pdf->MultiCell(0, 3, ''); // Set interline to 3. Then writeMultiCell must use 3 also.
*/ */
// Output Rect // 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 $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 * @param Translate $outputlangs Object language for output
* @return void * @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); $pdf->SetDrawColor(128, 128, 128);
$posmiddle = $this->marge_gauche + round(($this->page_largeur - $this->marge_gauche - $this->marge_droite)/2); $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->SetXY($posmiddle + 5, $posy + 5);
$pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1); $pdf->MultiCell($this->page_largeur-$this->marge_droite - $posmiddle - 5, 20, '', 1);
} }
/** /**
* Show top header of page. * Show top header of page.
* *
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
* @param CommonObject $object Object to show * @param CommonObject $object Object to show
* @param int $showaddress 0=no, 1=yes * @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @return void * @return void
*/ */
function _pagehead(&$pdf, $object, $showaddress, $outputlangs) private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{ {
global $conf,$langs; global $conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
@ -767,7 +767,7 @@ class pdf_strato extends ModelePDFContract
* @param int $hidefreetext 1=Hide free text * @param int $hidefreetext 1=Hide free text
* @return integer * @return integer
*/ */
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;

View File

@ -108,29 +108,29 @@ class ExportExcel2007 extends ExportExcel
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Close Excel file * Close Excel file
* *
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function close_file() public function close_file()
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL)) if (! empty($conf->global->MAIN_USE_PHP_WRITEEXCEL))
{ {
$this->workbook->close(); $this->workbook->close();
} }
else else
{ {
require_once PHPEXCEL_PATH.'PHPExcel/Writer/Excel5.php'; 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); $objWriter->save($this->file);
$this->workbook->disconnectWorksheets(); $this->workbook->disconnectWorksheets();
unset($this->workbook); unset($this->workbook);
} }
return 1; return 1;
} }
} }

View File

@ -64,7 +64,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
public function __construct($db) public function __construct($db)
{ {
global $conf, $langs, $mysoc; global $conf, $langs, $mysoc;
// Load translation files required by the page // Load translation files required by the page
@ -99,7 +99,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
// Recupere emetteur // Recupere emetteur
$this->emetteur=$mysoc; $this->emetteur=$mysoc;
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // Par defaut, si n'etait pas defini 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 * @return string Description
*/ */
public function info($langs) public function info($langs)
{ {
global $conf, $langs; global $conf, $langs;
// Load translation files required by the page // Load translation files required by the page
@ -188,9 +188,9 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$texte.= '</form>'; $texte.= '</form>';
return $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. * 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; return -1;
} }
} }

View File

@ -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 * Function to build pdf onto disk
* *

View File

@ -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 * Fonction generant la rapport sur le disque
* *
@ -125,7 +125,7 @@ class pdf_paiement
$year = sprintf("%04d", $year); $year = sprintf("%04d", $year);
$file = $dir . "/payments-".$year."-".$month.".pdf"; $file = $dir . "/payments-".$year."-".$month.".pdf";
switch ($this->doc_type) { switch ($this->doc_type) {
case "client": case "client":
$file = $dir . "/payments-".$year."-".$month.".pdf"; $file = $dir . "/payments-".$year."-".$month.".pdf";
break; break;
@ -159,9 +159,9 @@ class pdf_paiement
$num=0; $num=0;
$lines=array(); $lines=array();
// count number of lines of payment // count number of lines of payment
$sql = "SELECT p.rowid as prowid"; $sql = "SELECT p.rowid as prowid";
switch ($this->doc_type) { switch ($this->doc_type) {
case "client": case "client":
$sql.= " FROM ".MAIN_DB_PREFIX."paiement as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement as p";
break; break;
@ -361,7 +361,7 @@ class pdf_paiement
$default_font_size = pdf_getPDFFontSize($outputlangs); $default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$conf->global->MAIN_INFO_SOCIETE_NOM; $title=$conf->global->MAIN_INFO_SOCIETE_NOM;
switch($this->doc_type) { switch($this->doc_type) {
case "client": case "client":
$title.=' - '.$outputlangs->transnoentities("ListOfCustomerPayments"); $title.=' - '.$outputlangs->transnoentities("ListOfCustomerPayments");
break; break;

View File

@ -33,12 +33,12 @@ class mod_reception_moonstone extends ModelNumRefReception
public $error = ''; public $error = '';
public $nom = 'Moonstone'; public $nom = 'Moonstone';
/** /**
* Return default description of numbering model * Return default description of numbering model
* *
* @return string text description * @return string text description
*/ */
public function info() public function info()
{ {
global $conf,$langs; global $conf,$langs;
@ -119,9 +119,9 @@ class mod_reception_moonstone extends ModelNumRefReception
$numFinal=get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date); $numFinal=get_next_value($db, $mask, 'reception', 'ref', '', $objsoc, $date);
return $numFinal; return $numFinal;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return next free value * Return next free value
* *

View File

@ -32,7 +32,7 @@ abstract class ModelePdfReception extends CommonDocGenerator
public $error=''; public $error='';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of active generation modules * Return list of active generation modules
* *

View File

@ -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 * Set accountancy account code for a third party into this->code
* *

View File

@ -38,7 +38,7 @@ abstract class ModeleThirdPartyDoc extends CommonDocGenerator
*/ */
public $error=''; public $error='';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of active generation modules * Return list of active generation modules
* *
@ -246,7 +246,7 @@ abstract class ModeleThirdPartyCode
return $s; return $s;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Check if mask/numbering use prefix * Check if mask/numbering use prefix
* *

View File

@ -33,11 +33,11 @@ require_once DOL_DOCUMENT_ROOT .'/core/modules/supplier_invoice/modules_facturef
*/ */
class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
{ {
/** /**
* Dolibarr version of the loaded document * Dolibarr version of the loaded document
* @public string * @public string
*/ */
public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
/** /**
* @var string Error code (or message) * @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 * @return string Text with description
*/ */
function info() public function info()
{ {
global $langs; global $langs;
$langs->load("bills"); $langs->load("bills");
return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit); return $langs->trans("CactusNumRefModelDesc1", $this->prefixinvoice, $this->prefixcreditnote, $this->prefixdeposit);
} }
/** /**
* Returns a numbering example * Returns a numbering example
* *
* @return string Example * @return string Example
*/ */
function getExample() public function getExample()
{ {
return $this->prefixinvoice."1301-0001"; return $this->prefixinvoice."1301-0001";
} }
@ -92,7 +92,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
* *
* @return boolean false if conflict, true if ok * @return boolean false if conflict, true if ok
*/ */
function canBeActivated() public function canBeActivated()
{ {
global $conf,$langs,$db; global $conf,$langs,$db;
@ -164,13 +164,13 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices
/** /**
* Return next value * Return next value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param Object $object Object invoice * @param Object $object Object invoice
* @param string $mode 'next' for next value or 'last' for last value * @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; 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 Societe $objsoc Object third party
* @param string $objforref Object for number to search * @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Next free 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); return $this->getNextValue($objsoc, $objforref, $mode);
} }

View File

@ -65,9 +65,9 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
* *
* @return string Description Text * @return string Description Text
*/ */
function info() public function info()
{ {
global $conf, $langs; global $conf, $langs;
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("bills","admin")); $langs->loadLangs(array("bills","admin"));
@ -129,7 +129,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
* *
* @return string Example * @return string Example
*/ */
function getExample() public function getExample()
{ {
global $conf,$langs,$mysoc; global $conf,$langs,$mysoc;
@ -153,7 +153,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value * @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; global $db,$conf;
@ -182,18 +182,18 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices
$numFinal=get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date); $numFinal=get_next_value($db, $mask, 'facture_fourn', 'ref', '', $objsoc, $object->date);
return $numFinal; return $numFinal;
} }
/** /**
* Return next free value * Return next free value
* *
* @param Societe $objsoc Object third party * @param Societe $objsoc Object third party
* @param string $objforref Object for number to search * @param string $objforref Object for number to search
* @param string $mode 'next' for next value or 'last' for last value * @param string $mode 'next' for next value or 'last' for last value
* @return string Next free 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); return $this->getNextValue($objsoc, $objforref, $mode);
} }
} }

View File

@ -40,7 +40,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
public $error=''; public $error='';
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return list of active generation models * Return list of active generation models
* *
@ -48,7 +48,7 @@ abstract class ModelePDFSuppliersInvoices extends CommonDocGenerator
* @param integer $maxfilenamelength Max length of value to show * @param integer $maxfilenamelength Max length of value to show
* @return array List of numbers * @return array List of numbers
*/ */
static function liste_modeles($db, $maxfilenamelength = 0) public static function liste_modeles($db, $maxfilenamelength = 0)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -120,18 +120,18 @@ abstract class ModeleNumRefSuppliersInvoices
* @param string $mode 'next' for next value or 'last' for last value * @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) public function getNextValue($objsoc, $object, $mode)
{ {
global $langs; global $langs;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
/** Returns version of the model numbering /** Returns version of the model numbering
* *
* @return string Value * @return string Value
*/ */
public function getVersion() public function getVersion()
{ {
global $langs; global $langs;
$langs->load("admin"); $langs->load("admin");
@ -140,5 +140,5 @@ abstract class ModeleNumRefSuppliersInvoices
if ($this->version == 'dolibarr') return DOL_VERSION; if ($this->version == 'dolibarr') return DOL_VERSION;
if ($this->version) return $this->version; if ($this->version) return $this->version;
return $langs->trans("NotAvailable"); return $langs->trans("NotAvailable");
} }
} }

View File

@ -610,7 +610,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show total to pay * Show total to pay
* *
@ -621,7 +621,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param Translate $outputlangs Objet langs * @param Translate $outputlangs Objet langs
* @return int Position pour suite * @return int Position pour suite
*/ */
function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) private function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf,$mysoc; global $conf,$mysoc;
@ -832,7 +832,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
* @param string $currency Currency code * @param string $currency Currency code
* @return void * @return void
*/ */
function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '') private function _tableau(&$pdf, $tab_top, $tab_height, $nexY, $outputlangs, $hidetop = 0, $hidebottom = 0, $currency = '')
{ {
global $conf; global $conf;
@ -932,17 +932,17 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Show payments table * Show payments table
* *
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
* @param FactureFournisseur $object Object invoice * @param FactureFournisseur $object Object invoice
* @param int $posy Position y in PDF * @param int $posy Position y in PDF
* @param Translate $outputlangs Object langs for output * @param Translate $outputlangs Object langs for output
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function _tableau_versements(&$pdf, $object, $posy, $outputlangs) private function _tableau_versements(&$pdf, $object, $posy, $outputlangs)
{ {
// phpcs:enable // phpcs:enable
global $conf; global $conf;
@ -1028,13 +1028,13 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
/** /**
* Show top header of page. * Show top header of page.
* *
* @param PDF $pdf Object PDF * @param PDF $pdf Object PDF
* @param FactureFournisseur $object Object to show * @param FactureFournisseur $object Object to show
* @param int $showaddress 0=no, 1=yes * @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @return void * @return void
*/ */
function _pagehead(&$pdf, $object, $showaddress, $outputlangs) private function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
{ {
global $langs, $conf, $mysoc; global $langs, $conf, $mysoc;
@ -1238,19 +1238,19 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
return $top_shift; return $top_shift;
} }
/** /**
* Show footer of page. Need this->emetteur object * Show footer of page. Need this->emetteur object
* *
* @param PDF $pdf PDF * @param PDF $pdf PDF
* @param FactureFournisseur $object Object to show * @param FactureFournisseur $object Object to show
* @param Translate $outputlangs Object lang for output * @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text * @param int $hidefreetext 1=Hide free text
* @return int Return height of bottom margin including footer text * @return int Return height of bottom margin including footer text
*/ */
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0) private function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{ {
global $conf; global $conf;
$showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS; $showdetails=$conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS;
return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext); return pdf_pagefoot($pdf, $outputlangs, 'SUPPLIER_INVOICE_FREE_TEXT', $this->emetteur, $this->marge_basse, $this->marge_gauche, $this->page_hauteur, $object, $showdetails, $hidefreetext);
} }
} }

View File

@ -72,7 +72,7 @@ class ActionsDatapolicy
* =0 if OK but we want to process standard actions too, * =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions. * >0 if OK and we want to replace standard actions.
*/ */
function getNomUrl($parameters, &$object, &$action) public function getNomUrl($parameters, &$object, &$action)
{ {
global $db, $langs, $conf, $user; global $db, $langs, $conf, $user;
$this->resprints = ''; $this->resprints = '';
@ -300,7 +300,7 @@ class ActionsDatapolicy
* =0 if OK but we want to process standard actions too, * =0 if OK but we want to process standard actions too,
* >0 if OK and we want to replace standard actions. * >0 if OK and we want to replace standard actions.
*/ */
function beforePDFCreation($parameters, &$object, &$action) public function beforePDFCreation($parameters, &$object, &$action)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
global $hookmanager; global $hookmanager;
@ -329,7 +329,7 @@ class ActionsDatapolicy
* @param HookManager $hookmanager Hook manager * @param HookManager $hookmanager Hook manager
* @return void * @return void
*/ */
function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;
$langs->load('datapolicy@datapolicy'); $langs->load('datapolicy@datapolicy');
@ -388,7 +388,7 @@ class ActionsDatapolicy
* @param HookManager $hookmanager Hook manager * @param HookManager $hookmanager Hook manager
* @return void * @return void
*/ */
function printCommonFooter($parameters, &$object, &$action, $hookmanager) public function printCommonFooter($parameters, &$object, &$action, $hookmanager)
{ {
global $conf, $user, $langs; global $conf, $user, $langs;

View File

@ -35,7 +35,7 @@ Class DataPolicy
* *
* @return number * @return number
*/ */
function getAllContactNotInformed() public function getAllContactNotInformed()
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;
@ -71,7 +71,7 @@ Class DataPolicy
* *
* @return number * @return number
*/ */
function getAllCompaniesNotInformed() public function getAllCompaniesNotInformed()
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;
@ -106,7 +106,7 @@ Class DataPolicy
* *
* @return number * @return number
*/ */
function getAllAdherentsNotInformed() public function getAllAdherentsNotInformed()
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;
@ -142,73 +142,73 @@ Class DataPolicy
* @param mixed $contact Contact * @param mixed $contact Contact
* @return void * @return void
*/ */
function sendMailDataPolicyContact($contact) public function sendMailDataPolicyContact($contact)
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;
$error = 0; $error = 0;
$from = $user->getFullName($langs) . ' <' . $user->email . '>'; $from = $user->getFullName($langs) . ' <' . $user->email . '>';
$sendto = $contact->email; $sendto = $contact->email;
$code= md5($contact->email); $code= md5($contact->email);
if (!empty($contact->default_lang)) { if (!empty($contact->default_lang)) {
$l = $contact->default_lang; $l = $contact->default_lang;
} else { } else {
$l = $langs->defaultlang; $l = $langs->defaultlang;
} }
$s = "DATAPOLICIESSUBJECT_" . $l; $s = "DATAPOLICIESSUBJECT_" . $l;
$ma = "DATAPOLICIESCONTENT_" . $l; $ma = "DATAPOLICIESCONTENT_" . $l;
$la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l;
$lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l;
$subject = $conf->global->$s; $subject = $conf->global->$s;
$message = $conf->global->$ma; $message = $conf->global->$ma;
$linka = $conf->global->$la; $linka = $conf->global->$la;
$linkr = $conf->global->$lr; $linkr = $conf->global->$lr;
$sendtocc = $sendtobcc = ''; $sendtocc = $sendtobcc = '';
$filepath = $mimetype = $filename = array(); $filepath = $mimetype = $filename = array();
$deliveryreceipt = 0; $deliveryreceipt = 0;
$substitutionarray = array( $substitutionarray = array(
'__LINKACCEPT__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=1&c='.$contact->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linka.'</a>', '__LINKACCEPT__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=1&c='.$contact->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linka.'</a>',
'__LINKREFUSED__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=2&c='.$contact->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linkr.'</a>', '__LINKREFUSED__' => '<a href="'.dol_buildpath('/datapolicy/public/index.php?action=2&c='.$contact->id.'&l='.$l.'&key='.$code, 3).'" target="_blank">'.$linkr.'</a>',
'__FIRSTNAME__' => $contact->firstname, '__FIRSTNAME__' => $contact->firstname,
'__NAME__' => $contact->lastname, '__NAME__' => $contact->lastname,
'__CIVILITY__' => $contact->civility, '__CIVILITY__' => $contact->civility,
); );
$subject = make_substitutions($subject, $substitutionarray); $subject = make_substitutions($subject, $substitutionarray);
$message = make_substitutions($message, $substitutionarray); $message = make_substitutions($message, $substitutionarray);
$actiontypecode = 'AC_EMAIL'; $actiontypecode = 'AC_EMAIL';
$actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto;
if ($message) { if ($message) {
if ($sendtocc) if ($sendtocc)
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
$actionmsg = dol_concatdesc($actionmsg, $message); $actionmsg = dol_concatdesc($actionmsg, $message);
} }
// Send mail // Send mail
require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php';
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
if ($mailfile->error) { if ($mailfile->error) {
$resultmasssend .= '<div class="error">' . $mailfile->error . '</div>'; $resultmasssend .= '<div class="error">' . $mailfile->error . '</div>';
} else { } else {
$result4 = $mailfile->sendfile(); $result4 = $mailfile->sendfile();
if (!$error) { if (!$error) {
$resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>"; $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>";
$contact->array_options['options_datapolicy_send'] = date('Y-m-d', time()); $contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
$contact->update($contact->id); $contact->update($contact->id);
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} }
setEventMessage($resultmasssend); setEventMessage($resultmasssend);
} }
/** /**
@ -217,7 +217,7 @@ Class DataPolicy
* @param Societe $societe Object societe * @param Societe $societe Object societe
* @return void * @return void
*/ */
function sendMailDataPolicyCompany($societe) public function sendMailDataPolicyCompany($societe)
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;
@ -291,7 +291,7 @@ Class DataPolicy
* @param Adherent $adherent Member * @param Adherent $adherent Member
* @return void * @return void
*/ */
function sendMailDataPolicyAdherent($adherent) public function sendMailDataPolicyAdherent($adherent)
{ {
global $langs, $conf, $db, $user; global $langs, $conf, $db, $user;

View File

@ -130,8 +130,7 @@ class Interventions extends DolibarrApi
if ($socids) $sql.= " AND t.fk_soc IN (".$socids.")"; 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 if ($search_sale > 0) $sql.= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
// Insert sale filter // Insert sale filter
if ($search_sale > 0) if ($search_sale > 0) {
{
$sql .= " AND sc.fk_user = ".$search_sale; $sql .= " AND sc.fk_user = ".$search_sale;
} }
// Add sql filters // Add sql filters

View File

@ -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. * 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. * 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 int $fk_user Id user
* @param date $dateStart Start date of period to check * @param date $dateStart Start date of period to check
* @param date $dateEnd End 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: * @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 * 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). * @return boolean False = New range overlap an existing holiday, True = no overlapping (is never on holiday during checked period).
* @see verifDateHolidayForTimestamp * @see verifDateHolidayForTimestamp
*/ */
@ -1216,7 +1216,7 @@ class Holiday extends CommonObject
return $this->LibStatut($this->statut, $mode, $this->date_debut); 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 * 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. * Return list of people with permission to validate leave requests.
* Search for permission "approve leave requests" * Search for permission "approve leave requests"

View File

@ -45,9 +45,9 @@ class FormProduct
/** /**
* Constructor * Constructor
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
*/ */
function __construct($db) 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 * Output a combo box with list of units
* pour l'instant on ne definit pas les unites dans la base * 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); 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 * Return a combo box with list of units
* For the moment, units labels are defined in measuring_units_string * 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 $measuring_style Unit to show: weight, size, surface, volume
* @param string $default Force unit * @param string $default Force unit
* @param int $adddefault Add empty unit called "Default" * @param int $adddefault Add empty unit called "Default"
* @return string * @return string
*/ */
public function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0) 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'; require_once DOL_DOCUMENT_ROOT . '/core/class/cunits.class.php';
$measuringUnits = new CUnits($db); $measuringUnits = new CUnits($db);
$result = $measuringUnits->fetchAll('', '', 0, 0, array( $result = $measuringUnits->fetchAll(
't.unit_type' => $measuring_style, '',
't.active' => 1 '',
)); 0,
0,
array(
't.unit_type' => $measuring_style,
't.active' => 1,
)
);
if ($result < 0) { if ($result < 0) {
dol_print_error($db); dol_print_error($db);
return - 1; return - 1;
@ -332,8 +338,7 @@ class FormProduct
if ($adddefault) if ($adddefault)
$return .= '<option value="0">' . $langs->trans("Default") . '</option>'; $return .= '<option value="0">' . $langs->trans("Default") . '</option>';
foreach ($measuringUnits->records as $lines) foreach ($measuringUnits->records as $lines) {
{
$return .= '<option value="' . $lines->code . '"'; $return .= '<option value="' . $lines->code . '"';
if ($key == $default) { if ($key == $default) {
$return .= ' selected'; $return .= ' selected';

View File

@ -2299,7 +2299,7 @@ class Ticket extends CommonObject
* @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...)
* @return array Array of contacts * @return array Array of contacts
*/ */
function listeContact($statut = -1, $source = 'external', $list = 0, $code = '') public function listeContact($statut = -1, $source = 'external', $list = 0, $code = '')
{ {
global $langs; global $langs;
@ -2436,14 +2436,14 @@ class Ticket extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Return if at least one photo is available * Return if at least one photo is available
* *
* @param string $sdir Directory to scan * @param string $sdir Directory to scan
* @return boolean True if at least one photo is available, False if not * @return boolean True if at least one photo is available, False if not
*/ */
function is_photo_available($sdir) public function is_photo_available($sdir)
{ {
// phpcs:enable // phpcs:enable
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';

View File

@ -1,17 +1,18 @@
<?php <?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (c) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (c) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (c) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk> * Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013-2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com> * Copyright (C) 2018 charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -1057,12 +1058,12 @@ class User extends CommonObject
// Remove extrafields // Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields(); $result=$this->deleteExtraFields();
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
} }
} }
// Remove user // Remove user
@ -2485,7 +2486,7 @@ class User extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@ -2506,7 +2507,7 @@ class User extends CommonObject
return $dn; return $dn;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions * Initialize the info array (array of LDAP values) that will be used to call LDAP functions
* *
@ -2891,7 +2892,7 @@ class User extends CommonObject
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau * Reconstruit l'arborescence hierarchique des users sous la forme d'un tableau
* Set and return this->users that is an array sorted according to tree with arrays of: * Set and return this->users that is an array sorted according to tree with arrays of:

View File

@ -93,10 +93,10 @@ class UserGroup extends CommonObject
* @param DoliDb $db Database handler * @param DoliDb $db Database handler
*/ */
public function __construct($db) public function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->nb_rights = 0; $this->nb_rights = 0;
} }
/** /**
@ -637,15 +637,15 @@ class UserGroup extends CommonObject
$sql .= " WHERE fk_usergroup = ".$this->id; $sql .= " WHERE fk_usergroup = ".$this->id;
$this->db->query($sql); $this->db->query($sql);
// Remove extrafields // Remove extrafields
if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
{ {
$result=$this->deleteExtraFields(); $result=$this->deleteExtraFields();
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
} }
} }
$sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup";
@ -914,7 +914,7 @@ class UserGroup extends CommonObject
return $result; return $result;
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *
@ -936,7 +936,7 @@ class UserGroup extends CommonObject
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Initialize the info array (array of LDAP values) that will be used to call LDAP functions * Initialize the info array (array of LDAP values) that will be used to call LDAP functions
* *