forked from Wavyzz/dolibarr
Removed phpcodesniffer errors
This commit is contained in:
@@ -40,9 +40,11 @@ $action = GETPOST("action");
|
|||||||
|
|
||||||
if ($action == "set")
|
if ($action == "set")
|
||||||
{
|
{
|
||||||
|
$db->begin();
|
||||||
for ($i = 0 ; $i < 2 ; $i++)
|
for ($i = 0 ; $i < 2 ; $i++)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
|
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
|
||||||
@@ -51,23 +53,32 @@ if ($action == "set")
|
|||||||
if($account->fetch($id)>0)
|
if($account->fetch($id)>0)
|
||||||
{
|
{
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
|
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
|
|
||||||
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $res > 0) $error++;
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
}
|
||||||
|
else $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
$db->commit();
|
||||||
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$db->rollback();
|
||||||
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,14 +73,16 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ouverture d'une connexion vers le serveur et eventuellement une database.
|
* Constructor.
|
||||||
* @param type Type de base de donnees (mysql ou pgsql)
|
* This create an opened connexion to a database server and eventually to a database
|
||||||
* @param host Addresse de la base de donnees
|
*
|
||||||
* @param user Nom de l'utilisateur autorise
|
* @param string $type Type of database (mysql, pgsql...)
|
||||||
* @param pass Mot de passe
|
* @param string $host Address of database server
|
||||||
* @param name Nom de la database
|
* @param string $user Nom de l'utilisateur autorise
|
||||||
* @param port Port of database server
|
* @param string $pass Mot de passe
|
||||||
* @return int 1 en cas de succes, 0 sinon
|
* @param string $name Nom de la database
|
||||||
|
* @param int $port Port of database server
|
||||||
|
* @return int 1 if OK, 0 if not
|
||||||
*/
|
*/
|
||||||
function DoliDb($type='mssql', $host, $user, $pass, $name='', $port=0)
|
function DoliDb($type='mssql', $host, $user, $pass, $name='', $port=0)
|
||||||
{
|
{
|
||||||
@@ -153,9 +155,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a SQL request in Mysql syntax to PostgreSQL syntax
|
* Convert a SQL request in Mysql syntax to native syntax
|
||||||
* @param line SQL request line to convert
|
*
|
||||||
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
* @param string $line SQL request line to convert
|
||||||
|
* @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
|
||||||
*/
|
*/
|
||||||
function convertSQLFromMysql($line,$type='ddl')
|
function convertSQLFromMysql($line,$type='ddl')
|
||||||
@@ -164,9 +167,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selectionne une database.
|
* Select a database
|
||||||
* @param database Nom de la database
|
*
|
||||||
* @return boolean true si ok, false si ko
|
* @param string $database Name of database
|
||||||
|
* @return boolean true if OK, false if KO
|
||||||
*/
|
*/
|
||||||
function select_db($database)
|
function select_db($database)
|
||||||
{
|
{
|
||||||
@@ -174,13 +178,14 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection vers le serveur
|
* Connexion to server
|
||||||
* @param host addresse de la base de donnees
|
*
|
||||||
* @param login nom de l'utilisateur autoris
|
* @param string $host database server host
|
||||||
* @param passwd mot de passe
|
* @param string $login login
|
||||||
* @param name nom de la database (ne sert pas sous mysql, sert sous pgsql)
|
* @param string $passwd password
|
||||||
* @param port Port of database server
|
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||||
* @return resource handler d'acces a la base
|
* @param string $port Port of database server
|
||||||
|
* @return resource Database access handler
|
||||||
* @see close
|
* @see close
|
||||||
*/
|
*/
|
||||||
function connect($host, $login, $passwd, $name, $port=0)
|
function connect($host, $login, $passwd, $name, $port=0)
|
||||||
@@ -198,8 +203,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return label of manager
|
* Return label of manager
|
||||||
* \return string Label
|
*
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLabel()
|
function getLabel()
|
||||||
{
|
{
|
||||||
@@ -207,8 +213,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur
|
* Return version of database server
|
||||||
* \return string Chaine version
|
*
|
||||||
|
* @return string Version string
|
||||||
*/
|
*/
|
||||||
function getVersion()
|
function getVersion()
|
||||||
{
|
{
|
||||||
@@ -219,8 +226,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur dans un tableau
|
* Return version of database server into an array
|
||||||
* \return array Tableau de chaque niveau de version
|
*
|
||||||
|
* @return array Version array
|
||||||
*/
|
*/
|
||||||
function getVersionArray()
|
function getVersionArray()
|
||||||
{
|
{
|
||||||
@@ -230,6 +238,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Close database connexion
|
* Close database connexion
|
||||||
|
*
|
||||||
* @return boolean True if disconnect successfull, false otherwise
|
* @return boolean True if disconnect successfull, false otherwise
|
||||||
* @see connect
|
* @see connect
|
||||||
*/
|
*/
|
||||||
@@ -246,8 +255,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Debut d'une transaction.
|
* Start transaction
|
||||||
* \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
|
*
|
||||||
|
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||||
*/
|
*/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
@@ -270,10 +280,11 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a database transaction
|
* Validate a database transaction
|
||||||
* @param log Add more log to default log line
|
*
|
||||||
|
* @param $log Add more log to default log line
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||||
*/
|
*/
|
||||||
function commit()
|
function commit($log='')
|
||||||
{
|
{
|
||||||
if ($this->transaction_opened <= 1)
|
if ($this->transaction_opened <= 1)
|
||||||
{
|
{
|
||||||
@@ -293,8 +304,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Annulation d'une transaction et retour aux anciennes valeurs
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
*
|
||||||
|
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
*/
|
*/
|
||||||
function rollback()
|
function rollback()
|
||||||
{
|
{
|
||||||
@@ -314,6 +326,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
|
*
|
||||||
* @param query SQL query string
|
* @param query SQL query string
|
||||||
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||||
@@ -404,9 +417,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la ligne courante (comme un objet) pour le curseur resultset.
|
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return object Object result line or false if KO or end of cursor
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return object Object result line or false if KO or end of cursor
|
||||||
*/
|
*/
|
||||||
function fetch_object($resultset)
|
function fetch_object($resultset)
|
||||||
{
|
{
|
||||||
@@ -416,9 +430,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees dans un tableau.
|
* Renvoie les donnees dans un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_array($resultset)
|
function fetch_array($resultset)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,14 +72,16 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ouverture d'une connexion vers le serveur et eventuellement une database.
|
* Constructor.
|
||||||
* @param type Type de base de donnees (mysql ou pgsql)
|
* This create an opened connexion to a database server and eventually to a database
|
||||||
* @param host Addresse de la base de donnees
|
*
|
||||||
* @param user Nom de l'utilisateur autorise
|
* @param string $type Type of database (mysql, pgsql...)
|
||||||
* @param pass Mot de passe
|
* @param string $host Address of database server
|
||||||
* @param name Nom de la database
|
* @param string $user Nom de l'utilisateur autorise
|
||||||
* @param port Port of database server
|
* @param string $pass Mot de passe
|
||||||
* @return int 1 en cas de succes, 0 sinon
|
* @param string $name Nom de la database
|
||||||
|
* @param int $port Port of database server
|
||||||
|
* @return int 1 if OK, 0 if not
|
||||||
*/
|
*/
|
||||||
function DoliDb($type='mysql', $host, $user, $pass, $name='', $port=0)
|
function DoliDb($type='mysql', $host, $user, $pass, $name='', $port=0)
|
||||||
{
|
{
|
||||||
@@ -180,9 +182,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a SQL request in Mysql syntax to PostgreSQL syntax
|
* Convert a SQL request in Mysql syntax to native syntax
|
||||||
* @param line SQL request line to convert
|
*
|
||||||
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
* @param string $line SQL request line to convert
|
||||||
|
* @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
|
||||||
*/
|
*/
|
||||||
function convertSQLFromMysql($line,$type='ddl')
|
function convertSQLFromMysql($line,$type='ddl')
|
||||||
@@ -191,9 +194,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Selectionne une database.
|
* Select a database
|
||||||
* \param database Nom de la database
|
*
|
||||||
* \return boolean true si ok, false si ko
|
* @param string $database Name of database
|
||||||
|
* @return boolean true if OK, false if KO
|
||||||
*/
|
*/
|
||||||
function select_db($database)
|
function select_db($database)
|
||||||
{
|
{
|
||||||
@@ -202,14 +206,15 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Connexion to server
|
* Connexion to server
|
||||||
* \param host database server host
|
*
|
||||||
* \param login login
|
* @param string $host database server host
|
||||||
* \param passwd password
|
* @param string $login login
|
||||||
* \param name nom de la database (ne sert pas sous mysql, sert sous pgsql)
|
* @param string $passwd password
|
||||||
* \param port Port of database server
|
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||||
* \return resource Database access handler
|
* @param string $port Port of database server
|
||||||
* \seealso close
|
* @return resource Database access handler
|
||||||
|
* @see close
|
||||||
*/
|
*/
|
||||||
function connect($host, $login, $passwd, $name, $port=0)
|
function connect($host, $login, $passwd, $name, $port=0)
|
||||||
{
|
{
|
||||||
@@ -227,8 +232,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return label of manager
|
* Return label of manager
|
||||||
* \return string Label
|
*
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLabel()
|
function getLabel()
|
||||||
{
|
{
|
||||||
@@ -236,8 +242,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur
|
* Return version of database server
|
||||||
* \return string Chaine version
|
*
|
||||||
|
* @return string Version string
|
||||||
*/
|
*/
|
||||||
function getVersion()
|
function getVersion()
|
||||||
{
|
{
|
||||||
@@ -245,26 +252,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur sous forme de nombre
|
* Return version of database server into an array
|
||||||
* \return string Chaine version
|
*
|
||||||
*/
|
* @return array Version array
|
||||||
function getIntVersion()
|
|
||||||
{
|
|
||||||
$version= $this->getVersion();
|
|
||||||
$vlist=preg_split('/[.-]/',$version);
|
|
||||||
if (dol_strlen($vlist[1])==1){
|
|
||||||
$vlist[1]="0".$vlist[1];
|
|
||||||
}
|
|
||||||
if (dol_strlen($vlist[2])==1){
|
|
||||||
$vlist[2]="0".$vlist[2];
|
|
||||||
}
|
|
||||||
return $vlist[0].$vlist[1].$vlist[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Renvoie la version du serveur dans un tableau
|
|
||||||
* \return array Tableau de chaque niveau de version
|
|
||||||
*/
|
*/
|
||||||
function getVersionArray()
|
function getVersionArray()
|
||||||
{
|
{
|
||||||
@@ -274,6 +264,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Close database connexion
|
* Close database connexion
|
||||||
|
*
|
||||||
* @return boolean True if disconnect successfull, false otherwise
|
* @return boolean True if disconnect successfull, false otherwise
|
||||||
* @see connect
|
* @see connect
|
||||||
*/
|
*/
|
||||||
@@ -290,8 +281,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Debut d'une transaction.
|
* Start transaction
|
||||||
* \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
|
*
|
||||||
|
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||||
*/
|
*/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
@@ -314,7 +306,8 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a database transaction
|
* Validate a database transaction
|
||||||
* @param log Add more log to default log line
|
*
|
||||||
|
* @param $log Add more log to default log line
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||||
*/
|
*/
|
||||||
function commit($log='')
|
function commit($log='')
|
||||||
@@ -337,9 +330,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Annulation d'une transaction et retour aux anciennes valeurs
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
* \param log Add more log to default log line
|
*
|
||||||
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
* @param $log Add more log to default log line
|
||||||
|
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
*/
|
*/
|
||||||
function rollback($log='')
|
function rollback($log='')
|
||||||
{
|
{
|
||||||
@@ -359,6 +353,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
|
*
|
||||||
* @param query SQL query string
|
* @param query SQL query string
|
||||||
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||||
@@ -398,9 +393,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la ligne courante (comme un objet) pour le curseur resultset.
|
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return object Object result line or false if KO or end of cursor
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return object Object result line or false if KO or end of cursor
|
||||||
*/
|
*/
|
||||||
function fetch_object($resultset)
|
function fetch_object($resultset)
|
||||||
{
|
{
|
||||||
@@ -410,9 +406,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees dans un tableau.
|
* Renvoie les donnees dans un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_array($resultset)
|
function fetch_array($resultset)
|
||||||
{
|
{
|
||||||
@@ -423,9 +420,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees comme un tableau.
|
* Renvoie les donnees comme un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_row($resultset)
|
function fetch_row($resultset)
|
||||||
{
|
{
|
||||||
@@ -435,10 +433,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
* Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
||||||
* \see affected_rows
|
*
|
||||||
* \param resultset Curseur de la requete voulue
|
* @see affected_rows
|
||||||
* \return int Nombre de lignes
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
function num_rows($resultset)
|
function num_rows($resultset)
|
||||||
{
|
{
|
||||||
@@ -448,10 +447,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief 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
|
||||||
* \see num_rows
|
*
|
||||||
* \param resultset Curseur de la requete voulue
|
* @see num_rows
|
||||||
* \return int Nombre de lignes
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
function affected_rows($resultset)
|
function affected_rows($resultset)
|
||||||
{
|
{
|
||||||
@@ -464,8 +464,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Libere le dernier resultset utilise sur cette connexion.
|
* Libere le dernier resultset utilise sur cette connexion.
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
|
* @param resultset Curseur de la requete voulue
|
||||||
*/
|
*/
|
||||||
function free($resultset=0)
|
function free($resultset=0)
|
||||||
{
|
{
|
||||||
@@ -477,10 +478,11 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Defini les limites de la requete.
|
* Defini les limites de la requete
|
||||||
* \param limit nombre maximum de lignes retournees
|
*
|
||||||
* \param offset numero de la ligne a partir de laquelle recuperer les ligne
|
* @param limit nombre maximum de lignes retournees
|
||||||
* \return string chaine exprimant la syntax sql de la limite
|
* @param offset numero de la ligne a partir de laquelle recuperer les ligne
|
||||||
|
* @return string chaine exprimant la syntax sql de la limite
|
||||||
*/
|
*/
|
||||||
function plimit($limit=0,$offset=0)
|
function plimit($limit=0,$offset=0)
|
||||||
{
|
{
|
||||||
@@ -493,6 +495,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define sort criteria of request
|
* Define sort criteria of request
|
||||||
|
*
|
||||||
* @param sortfield List of sort fields
|
* @param sortfield List of sort fields
|
||||||
* @param sortorder Sort order
|
* @param sortorder Sort order
|
||||||
* @return string String to provide syntax of a sort sql string
|
* @return string String to provide syntax of a sort sql string
|
||||||
@@ -522,7 +525,8 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape a string to insert data.
|
* Escape a string to insert data
|
||||||
|
*
|
||||||
* @param stringtoencode String to escape
|
* @param stringtoencode String to escape
|
||||||
* @return string String escaped
|
* @return string String escaped
|
||||||
*/
|
*/
|
||||||
@@ -535,6 +539,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
* Convert (by PHP) a GM Timestamp date into a string date with PHP server TZ to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
|
*
|
||||||
* @param param Date TMS to convert
|
* @param param Date TMS to convert
|
||||||
* @return string Date in a string YYYYMMDDHHMMSS
|
* @return string Date in a string YYYYMMDDHHMMSS
|
||||||
*/
|
*/
|
||||||
@@ -546,6 +551,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
||||||
* 19700101020000 -> 3600 with TZ+1
|
* 19700101020000 -> 3600 with TZ+1
|
||||||
|
*
|
||||||
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
* @return date Date TMS
|
* @return date Date TMS
|
||||||
*/
|
*/
|
||||||
@@ -559,6 +565,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Formate a SQL IF
|
* Formate a SQL IF
|
||||||
|
*
|
||||||
* @param test chaine test
|
* @param test chaine test
|
||||||
* @param resok resultat si test egal
|
* @param resok resultat si test egal
|
||||||
* @param resko resultat si test non egal
|
* @param resko resultat si test non egal
|
||||||
|
|||||||
@@ -73,14 +73,16 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ouverture d'une connexion vers le serveur et eventuellement une database.
|
* Constructor.
|
||||||
* @param type Type de base de donnees (mysql ou pgsql)
|
* This create an opened connexion to a database server and eventually to a database
|
||||||
* @param host Addresse de la base de donnees
|
*
|
||||||
* @param user Nom de l'utilisateur autorise
|
* @param string $type Type of database (mysql, pgsql...)
|
||||||
* @param pass Mot de passe
|
* @param string $host Address of database server
|
||||||
* @param name Nom de la database
|
* @param string $user Nom de l'utilisateur autorise
|
||||||
* @param port Port of database server
|
* @param string $pass Mot de passe
|
||||||
* @return int 1 en cas de succes, 0 sinon
|
* @param string $name Nom de la database
|
||||||
|
* @param int $port Port of database server
|
||||||
|
* @return int 1 if OK, 0 if not
|
||||||
*/
|
*/
|
||||||
function DoliDb($type='mysqli', $host, $user, $pass, $name='', $port=0)
|
function DoliDb($type='mysqli', $host, $user, $pass, $name='', $port=0)
|
||||||
{
|
{
|
||||||
@@ -183,9 +185,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a SQL request in Mysql syntax to PostgreSQL syntax
|
* Convert a SQL request in Mysql syntax to native syntax
|
||||||
* @param line SQL request line to convert
|
*
|
||||||
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
* @param string $line SQL request line to convert
|
||||||
|
* @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
|
||||||
*/
|
*/
|
||||||
function convertSQLFromMysql($line,$type='ddl')
|
function convertSQLFromMysql($line,$type='ddl')
|
||||||
@@ -194,9 +197,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Selectionne une database.
|
* Select a database
|
||||||
* \param database Nom de la database
|
*
|
||||||
* \return boolean true si ok, false si ko
|
* @param string $database Name of database
|
||||||
|
* @return boolean true if OK, false if KO
|
||||||
*/
|
*/
|
||||||
function select_db($database)
|
function select_db($database)
|
||||||
{
|
{
|
||||||
@@ -206,14 +210,15 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Connexion to server
|
* Connexion to server
|
||||||
* \param host database server host
|
*
|
||||||
* \param login login
|
* @param string $host database server host
|
||||||
* \param passwd password
|
* @param string $login login
|
||||||
* \param name nom de la database (ne sert pas sous mysql, sert sous pgsql)
|
* @param string $passwd password
|
||||||
* \param port Port of database server
|
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||||
* \return resource Database access handler
|
* @param string $port Port of database server
|
||||||
* \seealso close
|
* @return resource Database access handler
|
||||||
|
* @see close
|
||||||
*/
|
*/
|
||||||
function connect($host, $login, $passwd, $name, $port=0)
|
function connect($host, $login, $passwd, $name, $port=0)
|
||||||
{
|
{
|
||||||
@@ -232,8 +237,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return label of manager
|
* Return label of manager
|
||||||
* \return string Label
|
*
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLabel()
|
function getLabel()
|
||||||
{
|
{
|
||||||
@@ -241,8 +247,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur
|
* Return version of database server
|
||||||
* \return string Chaine version
|
*
|
||||||
|
* @return string Version string
|
||||||
*/
|
*/
|
||||||
function getVersion()
|
function getVersion()
|
||||||
{
|
{
|
||||||
@@ -253,25 +260,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur sous forme de nombre
|
* Return version of database server into an array
|
||||||
* \return string Chaine version
|
*
|
||||||
*/
|
* @return array Version array
|
||||||
function getIntVersion()
|
|
||||||
{
|
|
||||||
$version= $this->getVersion();
|
|
||||||
$vlist=preg_split('/[.-]/',$version);
|
|
||||||
if (dol_strlen($vlist[1])==1){
|
|
||||||
$vlist[1]="0".$vlist[1];
|
|
||||||
}
|
|
||||||
if (dol_strlen($vlist[2])==1){
|
|
||||||
$vlist[2]="0".$vlist[2];
|
|
||||||
}
|
|
||||||
return $vlist[0].$vlist[1].$vlist[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Renvoie la version du serveur dans un tableau
|
|
||||||
* \return array Tableau de chaque niveau de version
|
|
||||||
*/
|
*/
|
||||||
function getVersionArray()
|
function getVersionArray()
|
||||||
{
|
{
|
||||||
@@ -281,6 +272,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Close database connexion
|
* Close database connexion
|
||||||
|
*
|
||||||
* @return boolean True if disconnect successfull, false otherwise
|
* @return boolean True if disconnect successfull, false otherwise
|
||||||
* @see connect
|
* @see connect
|
||||||
*/
|
*/
|
||||||
@@ -297,8 +289,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Debut d'une transaction.
|
* Start transaction
|
||||||
* \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
|
*
|
||||||
|
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||||
*/
|
*/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
@@ -321,7 +314,8 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a database transaction
|
* Validate a database transaction
|
||||||
* @param log Add more log to default log line
|
*
|
||||||
|
* @param $log Add more log to default log line
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||||
*/
|
*/
|
||||||
function commit($log='')
|
function commit($log='')
|
||||||
@@ -344,9 +338,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Annulation d'une transaction et retour aux anciennes valeurs
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
* \param log Add more log to default log line
|
*
|
||||||
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
* @param $log Add more log to default log line
|
||||||
|
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
*/
|
*/
|
||||||
function rollback($log='')
|
function rollback($log='')
|
||||||
{
|
{
|
||||||
@@ -366,6 +361,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute a SQL request and return the resultset
|
* Execute a SQL request and return the resultset
|
||||||
|
*
|
||||||
* @param query SQL query string
|
* @param query SQL query string
|
||||||
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollbock to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||||
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
* Note that with Mysql, this parameter is not used as Myssql can already commit a transaction even if one request is in error, without using savepoints.
|
||||||
@@ -403,9 +399,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la ligne courante (comme un objet) pour le curseur resultset.
|
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return object Object result line or false if KO or end of cursor
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return object Object result line or false if KO or end of cursor
|
||||||
*/
|
*/
|
||||||
function fetch_object($resultset)
|
function fetch_object($resultset)
|
||||||
{
|
{
|
||||||
@@ -416,9 +413,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees dans un tableau.
|
* Renvoie les donnees dans un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_array($resultset)
|
function fetch_array($resultset)
|
||||||
{
|
{
|
||||||
@@ -428,9 +426,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees comme un tableau.
|
* Renvoie les donnees comme un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_row($resultset)
|
function fetch_row($resultset)
|
||||||
{
|
{
|
||||||
@@ -448,10 +447,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
* Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
||||||
* \see affected_rows
|
*
|
||||||
* \param resultset Curseur de la requete voulue
|
* @see affected_rows
|
||||||
* \return int Nombre de lignes
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
function num_rows($resultset)
|
function num_rows($resultset)
|
||||||
{
|
{
|
||||||
@@ -461,10 +461,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief 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
|
||||||
* \see num_rows
|
* @see num_rows
|
||||||
* \param resultset Curseur de la requete voulue
|
* @param resultset Curseur de la requete voulue
|
||||||
* \return int Nombre de lignes
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function affected_rows($resultset)
|
function affected_rows($resultset)
|
||||||
@@ -478,8 +478,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Libere le dernier resultset utilise sur cette connexion.
|
* Libere le dernier resultset utilise sur cette connexion
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
|
* @param resultset Curseur de la requete voulue
|
||||||
*/
|
*/
|
||||||
function free($resultset=0)
|
function free($resultset=0)
|
||||||
{
|
{
|
||||||
@@ -491,10 +492,11 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Defini les limites de la requete.
|
* Defini les limites de la requete
|
||||||
* \param limit nombre maximum de lignes retournees
|
*
|
||||||
* \param offset numero de la ligne a partir de laquelle recuperer les ligne
|
* @param limit nombre maximum de lignes retournees
|
||||||
* \return string chaine exprimant la syntax sql de la limite
|
* @param offset numero de la ligne a partir de laquelle recuperer les ligne
|
||||||
|
* @return string chaine exprimant la syntax sql de la limite
|
||||||
*/
|
*/
|
||||||
function plimit($limit=0,$offset=0)
|
function plimit($limit=0,$offset=0)
|
||||||
{
|
{
|
||||||
@@ -507,6 +509,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define sort criteria of request
|
* Define sort criteria of request
|
||||||
|
*
|
||||||
* @param sortfield List of sort fields
|
* @param sortfield List of sort fields
|
||||||
* @param sortorder Sort order
|
* @param sortorder Sort order
|
||||||
* @return string String to provide syntax of a sort sql string
|
* @return string String to provide syntax of a sort sql string
|
||||||
@@ -536,7 +539,8 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape a string to insert data.
|
* Escape a string to insert data
|
||||||
|
*
|
||||||
* @param stringtoencode String to escape
|
* @param stringtoencode String to escape
|
||||||
* @return string String escaped
|
* @return string String escaped
|
||||||
*/
|
*/
|
||||||
@@ -548,6 +552,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field.
|
* Convert (by PHP) a GM Timestamp date into a PHP server TZ to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
|
*
|
||||||
* @param param Date TMS to convert
|
* @param param Date TMS to convert
|
||||||
* @return string Date in a string YYYYMMDDHHMMSS
|
* @return string Date in a string YYYYMMDDHHMMSS
|
||||||
*/
|
*/
|
||||||
@@ -559,6 +564,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
||||||
* 19700101020000 -> 3600 with TZ+1
|
* 19700101020000 -> 3600 with TZ+1
|
||||||
|
*
|
||||||
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
* @return date Date TMS
|
* @return date Date TMS
|
||||||
*/
|
*/
|
||||||
@@ -572,6 +578,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Formate a SQL IF
|
* Formate a SQL IF
|
||||||
|
*
|
||||||
* @param test chaine test
|
* @param test chaine test
|
||||||
* @param resok resultat si test egal
|
* @param resok resultat si test egal
|
||||||
* @param resko resultat si test non egal
|
* @param resko resultat si test non egal
|
||||||
|
|||||||
@@ -62,14 +62,16 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ouverture d'une connexion vers le serveur et une database.
|
* Constructor.
|
||||||
* \param type type de base de donnees (mysql ou pgsql)
|
* This create an opened connexion to a database server and eventually to a database
|
||||||
* \param host addresse de la base de donnees
|
*
|
||||||
* \param user nom de l'utilisateur autorise
|
* @param string $type Type of database (mysql, pgsql...)
|
||||||
* \param pass mot de passe
|
* @param string $host Address of database server
|
||||||
* \param name nom de la database
|
* @param string $user Nom de l'utilisateur autorise
|
||||||
* \param port Port of database server
|
* @param string $pass Mot de passe
|
||||||
* \return int 1 en cas de succes, 0 sinon
|
* @param string $name Nom de la database
|
||||||
|
* @param int $port Port of database server
|
||||||
|
* @return int 1 if OK, 0 if not
|
||||||
*/
|
*/
|
||||||
function DoliDb($type='pgsql', $host, $user, $pass, $name='', $port=0)
|
function DoliDb($type='pgsql', $host, $user, $pass, $name='', $port=0)
|
||||||
{
|
{
|
||||||
@@ -147,9 +149,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a SQL request in Mysql syntax to PostgreSQL syntax
|
* Convert a SQL request in Mysql syntax to native syntax
|
||||||
* @param line SQL request line to convert
|
*
|
||||||
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
* @param string $line SQL request line to convert
|
||||||
|
* @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
|
||||||
*/
|
*/
|
||||||
function convertSQLFromMysql($line,$type='auto')
|
function convertSQLFromMysql($line,$type='auto')
|
||||||
@@ -321,11 +324,12 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
* On compare juste manuellement si la database choisie est bien celle activee par la connexion
|
* On compare juste manuellement si la database choisie est bien celle activee par la connexion
|
||||||
* @param database nom de la database
|
*
|
||||||
* @return boolean true si ok, false si ko
|
* @param string $database Name of database
|
||||||
|
* @return boolean true if OK, false if KO
|
||||||
*/
|
*/
|
||||||
function select_db($database)
|
function select_db($database)
|
||||||
{
|
{
|
||||||
@@ -334,13 +338,15 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connection vers le serveur
|
* Connexion to server
|
||||||
* @param host addresse de la base de donnees
|
*
|
||||||
* @param login nom de l'utilisateur autorise
|
* @param string $host database server host
|
||||||
* @param passwd mot de passe
|
* @param string $login login
|
||||||
* @param name nom de la database (ne sert pas sous mysql, sert sous pgsql)
|
* @param string $passwd password
|
||||||
* @param port Port of database server
|
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||||
* @return resource handler d'acces a la base
|
* @param string $port Port of database server
|
||||||
|
* @return resource Database access handler
|
||||||
|
* @see close
|
||||||
*/
|
*/
|
||||||
function connect($host, $login, $passwd, $name, $port=0)
|
function connect($host, $login, $passwd, $name, $port=0)
|
||||||
{
|
{
|
||||||
@@ -364,8 +370,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return label of manager
|
* Return label of manager
|
||||||
* \return string Label
|
*
|
||||||
|
* @return string Label
|
||||||
*/
|
*/
|
||||||
function getLabel()
|
function getLabel()
|
||||||
{
|
{
|
||||||
@@ -373,8 +380,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return version of server
|
* Return version of database server
|
||||||
* \return string String with version
|
*
|
||||||
|
* @return string Version string
|
||||||
*/
|
*/
|
||||||
function getVersion()
|
function getVersion()
|
||||||
{
|
{
|
||||||
@@ -388,25 +396,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la version du serveur sous forme de nombre
|
* Return version of database server into an array
|
||||||
* \return string Chaine version
|
*
|
||||||
*/
|
* @return array Version array
|
||||||
function getIntVersion()
|
|
||||||
{
|
|
||||||
$version = $this->getVersion();
|
|
||||||
$vlist = preg_split('/[.-]/',$version);
|
|
||||||
if (dol_strlen($vlist[1])==1){
|
|
||||||
$vlist[1]="0".$vlist[1];
|
|
||||||
}
|
|
||||||
if (dol_strlen($vlist[2])==1){
|
|
||||||
$vlist[2]="0".$vlist[2];
|
|
||||||
}
|
|
||||||
return $vlist[0].$vlist[1].$vlist[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Renvoie la version du serveur dans un tableau
|
|
||||||
* \return array Tableau de chaque niveau de version
|
|
||||||
*/
|
*/
|
||||||
function getVersionArray()
|
function getVersionArray()
|
||||||
{
|
{
|
||||||
@@ -415,6 +407,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Close database connexion
|
* Close database connexion
|
||||||
|
*
|
||||||
* @return boolean True if disconnect successfull, false otherwise
|
* @return boolean True if disconnect successfull, false otherwise
|
||||||
* @see connect
|
* @see connect
|
||||||
*/
|
*/
|
||||||
@@ -430,8 +423,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Debut d'une transaction.
|
* Start transaction
|
||||||
* \return int 1 si ouverture transaction ok ou deja ouverte, 0 en cas d'erreur
|
*
|
||||||
|
* @return int 1 if transaction successfuly opened or already opened, 0 if error
|
||||||
*/
|
*/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
@@ -454,6 +448,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a database transaction
|
* Validate a database transaction
|
||||||
|
*
|
||||||
* @param log Add more log to default log line
|
* @param log Add more log to default log line
|
||||||
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
* @return int 1 if validation is OK or transaction level no started, 0 if ERROR
|
||||||
*/
|
*/
|
||||||
@@ -477,8 +472,8 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Annulation d'une transaction et retour aux anciennes valeurs
|
* Annulation d'une transaction et retour aux anciennes valeurs
|
||||||
* \return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
* @return int 1 si annulation ok ou transaction non ouverte, 0 en cas d'erreur
|
||||||
*/
|
*/
|
||||||
function rollback()
|
function rollback()
|
||||||
{
|
{
|
||||||
@@ -498,7 +493,8 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert request to PostgreSQL syntax, execute it and return the resultset.
|
* Convert request to PostgreSQL syntax, execute it and return the resultset
|
||||||
|
*
|
||||||
* @param query SQL query string
|
* @param query SQL query string
|
||||||
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
|
* @param usesavepoint 0=Default mode, 1=Run a savepoint before and a rollback to savepoint if error (this allow to have some request with errors inside global transactions).
|
||||||
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
* @param type Type of SQL order ('ddl' for insert, update, select, delete or 'dml' for create, alter...)
|
||||||
@@ -555,9 +551,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la ligne courante (comme un objet) pour le curseur resultset.
|
* Renvoie la ligne courante (comme un objet) pour le curseur resultset
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return object Object result line or false if KO or end of cursor
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return object Object result line or false if KO or end of cursor
|
||||||
*/
|
*/
|
||||||
function fetch_object($resultset)
|
function fetch_object($resultset)
|
||||||
{
|
{
|
||||||
@@ -567,9 +564,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees dans un tableau.
|
* Renvoie les donnees dans un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_array($resultset)
|
function fetch_array($resultset)
|
||||||
{
|
{
|
||||||
@@ -579,9 +577,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie les donnees comme un tableau.
|
* Renvoie les donnees comme un tableau
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
* \return array
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
function fetch_row($resultset)
|
function fetch_row($resultset)
|
||||||
{
|
{
|
||||||
@@ -591,10 +590,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
* Renvoie le nombre de lignes dans le resultat d'une requete SELECT
|
||||||
* \see affected_rows
|
*
|
||||||
* \param resultset Curseur de la requete voulue
|
* @see affected_rows
|
||||||
* \return int Nombre de lignes
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
function num_rows($resultset)
|
function num_rows($resultset)
|
||||||
{
|
{
|
||||||
@@ -604,10 +604,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief 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
|
||||||
* \see num_rows
|
*
|
||||||
* \param resultset Curseur de la requete voulue
|
* @see num_rows
|
||||||
* \return int Nombre de lignes
|
* @param resultset Curseur de la requete voulue
|
||||||
|
* @return int Nombre de lignes
|
||||||
*/
|
*/
|
||||||
function affected_rows($resultset)
|
function affected_rows($resultset)
|
||||||
{
|
{
|
||||||
@@ -620,8 +621,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Libere le dernier resultset utilise sur cette connexion.
|
* Libere le dernier resultset utilise sur cette connexion
|
||||||
* \param resultset Curseur de la requete voulue
|
*
|
||||||
|
* @param resultset Curseur de la requete voulue
|
||||||
*/
|
*/
|
||||||
function free($resultset=0)
|
function free($resultset=0)
|
||||||
{
|
{
|
||||||
@@ -633,10 +635,11 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Defini les limites de la requete.
|
* Defini les limites de la requete
|
||||||
* \param limit nombre maximum de lignes retournees
|
*
|
||||||
* \param offset numero de la ligne a partir de laquelle recuperer les lignes
|
* @param limit nombre maximum de lignes retournees
|
||||||
* \return string chaine exprimant la syntax sql de la limite
|
* @param offset numero de la ligne a partir de laquelle recuperer les lignes
|
||||||
|
* @return string chaine exprimant la syntax sql de la limite
|
||||||
*/
|
*/
|
||||||
function plimit($limit=0,$offset=0)
|
function plimit($limit=0,$offset=0)
|
||||||
{
|
{
|
||||||
@@ -649,6 +652,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Define sort criteria of request
|
* Define sort criteria of request
|
||||||
|
*
|
||||||
* @param sortfield List of sort fields
|
* @param sortfield List of sort fields
|
||||||
* @param sortorder Sort order
|
* @param sortorder Sort order
|
||||||
* @return string String to provide syntax of a sort sql string
|
* @return string String to provide syntax of a sort sql string
|
||||||
@@ -678,7 +682,8 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escape a string to insert data.
|
* Escape a string to insert data
|
||||||
|
*
|
||||||
* @param stringtoencode String to escape
|
* @param stringtoencode String to escape
|
||||||
* @return string String escaped
|
* @return string String escaped
|
||||||
*/
|
*/
|
||||||
@@ -690,6 +695,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
* Convert (by PHP) a GM Timestamp date into a GM string date to insert into a date field.
|
||||||
* Function to use to build INSERT, UPDATE or WHERE predica
|
* Function to use to build INSERT, UPDATE or WHERE predica
|
||||||
|
*
|
||||||
* @param param Date TMS to convert
|
* @param param Date TMS to convert
|
||||||
* @return string Date in a string YYYYMMDDHHMMSS
|
* @return string Date in a string YYYYMMDDHHMMSS
|
||||||
*/
|
*/
|
||||||
@@ -701,6 +707,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
* Convert (by PHP) a PHP server TZ string date into a GM Timestamps date
|
||||||
* 19700101020000 -> 3600 with TZ+1
|
* 19700101020000 -> 3600 with TZ+1
|
||||||
|
*
|
||||||
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
* @param string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||||
* @return date Date TMS
|
* @return date Date TMS
|
||||||
*/
|
*/
|
||||||
@@ -714,6 +721,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Formate a SQL IF
|
* Formate a SQL IF
|
||||||
|
*
|
||||||
* @param test chaine test
|
* @param test chaine test
|
||||||
* @param resok resultat si test egal
|
* @param resok resultat si test egal
|
||||||
* @param resko resultat si test non egal
|
* @param resko resultat si test non egal
|
||||||
@@ -726,8 +734,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la derniere requete soumise par la methode query()
|
* Renvoie la derniere requete soumise par la methode query()
|
||||||
* \return lastquery
|
*
|
||||||
|
* @return lastquery
|
||||||
*/
|
*/
|
||||||
function lastquery()
|
function lastquery()
|
||||||
{
|
{
|
||||||
@@ -735,8 +744,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie la derniere requete en erreur
|
* Renvoie la derniere requete en erreur
|
||||||
* \return string lastqueryerror
|
*
|
||||||
|
* @return string lastqueryerror
|
||||||
*/
|
*/
|
||||||
function lastqueryerror()
|
function lastqueryerror()
|
||||||
{
|
{
|
||||||
@@ -744,8 +754,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le libelle derniere erreur
|
* Renvoie le libelle derniere erreur
|
||||||
* \return string lasterror
|
*
|
||||||
|
* @return string lasterror
|
||||||
*/
|
*/
|
||||||
function lasterror()
|
function lasterror()
|
||||||
{
|
{
|
||||||
@@ -753,8 +764,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le code derniere erreur
|
* Renvoie le code derniere erreur
|
||||||
* \return string lasterrno
|
*
|
||||||
|
* @return string lasterrno
|
||||||
*/
|
*/
|
||||||
function lasterrno()
|
function lasterrno()
|
||||||
{
|
{
|
||||||
@@ -762,8 +774,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le code erreur generique de l'operation precedente.
|
* Renvoie le code erreur generique de l'operation precedente.
|
||||||
* \return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
|
*
|
||||||
|
* @return error_num (Exemples: DB_ERROR_TABLE_ALREADY_EXISTS, DB_ERROR_RECORD_ALREADY_EXISTS...)
|
||||||
*/
|
*/
|
||||||
function errno()
|
function errno()
|
||||||
{
|
{
|
||||||
@@ -827,8 +840,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie le texte de l'erreur pgsql de l'operation precedente.
|
* Renvoie le texte de l'erreur pgsql de l'operation precedente
|
||||||
* \return error_text
|
*
|
||||||
|
* @return error_text
|
||||||
*/
|
*/
|
||||||
function error()
|
function error()
|
||||||
{
|
{
|
||||||
@@ -836,9 +850,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Get last ID after an insert INSERT.
|
* Get last ID after an insert INSERT
|
||||||
* \param tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
*
|
||||||
* \return int id
|
* @param tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||||
|
* @return int id
|
||||||
*/
|
*/
|
||||||
function last_insert_id($tab,$fieldid='rowid')
|
function last_insert_id($tab,$fieldid='rowid')
|
||||||
{
|
{
|
||||||
@@ -857,6 +872,7 @@ class DoliDb
|
|||||||
/**
|
/**
|
||||||
* Encrypt sensitive data in database
|
* Encrypt sensitive data in database
|
||||||
* Warning: This function includes the escape, so it must use direct value
|
* Warning: This function includes the escape, so it must use direct value
|
||||||
|
*
|
||||||
* @param fieldorvalue Field name or value to encrypt
|
* @param fieldorvalue Field name or value to encrypt
|
||||||
* @param withQuotes Return string with quotes
|
* @param withQuotes Return string with quotes
|
||||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
* @return return XXX(field) or XXX('value') or field or 'value'
|
||||||
@@ -877,9 +893,10 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Decrypt sensitive data in database
|
* Decrypt sensitive data in database
|
||||||
* \param value Value to decrypt
|
*
|
||||||
* \return return Decrypted value if used
|
* @param value Value to decrypt
|
||||||
|
* @return return Decrypted value if used
|
||||||
*/
|
*/
|
||||||
function decrypt($value)
|
function decrypt($value)
|
||||||
{
|
{
|
||||||
@@ -901,8 +918,9 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Renvoie l'id de la connexion
|
* Renvoie l'id de la connexion
|
||||||
* \return string Id connexion
|
*
|
||||||
|
* @return string Id connexion
|
||||||
*/
|
*/
|
||||||
function DDLGetConnectId()
|
function DDLGetConnectId()
|
||||||
{
|
{
|
||||||
@@ -912,13 +930,14 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a new database
|
* Create a new database
|
||||||
* \param database Database name to create
|
* Ne pas utiliser les fonctions xxx_create_db (xxx=mysql, ...) car elles sont deprecated
|
||||||
* \param charset Charset used to store data
|
*
|
||||||
* \param collation Charset used to sort data
|
* @param database Database name to create
|
||||||
* \param owner Username of database owner
|
* @param charset Charset used to store data
|
||||||
* \return resource resource defined if OK, null if KO
|
* @param collation Charset used to sort data
|
||||||
* \remarks Ne pas utiliser les fonctions xxx_create_db (xxx=mysql, ...) car elles sont deprecated
|
* @param owner Username of database owner
|
||||||
|
* @return resource resource defined if OK, null if KO
|
||||||
*/
|
*/
|
||||||
function DDLCreateDb($database,$charset='',$collation='',$owner='')
|
function DDLCreateDb($database,$charset='',$collation='',$owner='')
|
||||||
{
|
{
|
||||||
@@ -930,9 +949,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste des tables dans une database.
|
* Liste des tables dans une database.
|
||||||
* \param database Nom de la database
|
* @param database Nom de la database
|
||||||
* \return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
function DDLListTables($database, $table='')
|
function DDLListTables($database, $table='')
|
||||||
{
|
{
|
||||||
@@ -949,9 +968,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Liste les informations des champs d'une table.
|
* Liste les informations des champs d'une table.
|
||||||
* \param table Nom de la table
|
* @param table Nom de la table
|
||||||
* \return array Tableau des informations des champs de la table
|
* @return array Tableau des informations des champs de la table
|
||||||
* TODO modifier pour postgresql
|
* TODO modifier pour postgresql
|
||||||
*/
|
*/
|
||||||
function DDLInfoTable($table)
|
function DDLInfoTable($table)
|
||||||
@@ -973,15 +992,16 @@ class DoliDb
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Cree une table
|
* Cree une table
|
||||||
* \param table Nom de la table
|
*
|
||||||
* \param fields Tableau associatif [nom champ][tableau des descriptions]
|
* @param table Nom de la table
|
||||||
* \param primary_key Nom du champ qui sera la clef primaire
|
* @param fields Tableau associatif [nom champ][tableau des descriptions]
|
||||||
* \param unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
|
* @param primary_key Nom du champ qui sera la clef primaire
|
||||||
* \param fulltext Tableau des Nom de champs qui seront indexes en fulltext
|
* @param unique_keys Tableau associatifs Nom de champs qui seront clef unique => valeur
|
||||||
* \param key Tableau des champs cles noms => valeur
|
* @param fulltext Tableau des Nom de champs qui seront indexes en fulltext
|
||||||
* \param type Type de la table
|
* @param key Tableau des champs cles noms => valeur
|
||||||
* \return int <0 si KO, >=0 si OK
|
* @param type Type de la table
|
||||||
|
* @return int <0 si KO, >=0 si OK
|
||||||
* TODO
|
* TODO
|
||||||
*/
|
*/
|
||||||
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
|
function DDLCreateTable($table,$fields,$primary_key,$type,$unique_keys="",$fulltext_keys="",$keys="")
|
||||||
@@ -1050,12 +1070,13 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Create a user
|
* Create a user
|
||||||
* \param dolibarr_main_db_host Ip serveur
|
*
|
||||||
* \param dolibarr_main_db_user Nom user a creer
|
* @param dolibarr_main_db_host Ip serveur
|
||||||
* \param dolibarr_main_db_pass Mot de passe user a creer
|
* @param dolibarr_main_db_user Nom user a creer
|
||||||
* \param dolibarr_main_db_name Database name where user must be granted
|
* @param dolibarr_main_db_pass Mot de passe user a creer
|
||||||
* \return int <0 si KO, >=0 si OK
|
* @param dolibarr_main_db_name Database name where user must be granted
|
||||||
|
* @return int <0 si KO, >=0 si OK
|
||||||
*/
|
*/
|
||||||
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
function DDLCreateUser($dolibarr_main_db_host,$dolibarr_main_db_user,$dolibarr_main_db_pass,$dolibarr_main_db_name)
|
||||||
{
|
{
|
||||||
@@ -1072,10 +1093,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief decrit une table dans une database.
|
* Decrit une table dans une database
|
||||||
* \param table Nom de la table
|
*
|
||||||
* \param field Optionnel : Nom du champ si l'on veut la desc d'un champ
|
* @param table Nom de la table
|
||||||
* \return resource
|
* @param field Optionnel : Nom du champ si l'on veut la desc d'un champ
|
||||||
|
* @return resource
|
||||||
*/
|
*/
|
||||||
function DDLDescTable($table,$field="")
|
function DDLDescTable($table,$field="")
|
||||||
{
|
{
|
||||||
@@ -1089,12 +1111,13 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Insert a new field in table
|
* Insert a new field in table
|
||||||
* \param table Nom de la table
|
*
|
||||||
* \param field_name Nom du champ a inserer
|
* @param table Nom de la table
|
||||||
* \param field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
|
* @param field_name Nom du champ a inserer
|
||||||
* \param field_position Optionnel ex.: "after champtruc"
|
* @param field_desc Tableau associatif de description du champ a inserer[nom du parametre][valeur du parametre]
|
||||||
* \return int <0 si KO, >0 si OK
|
* @param field_position Optionnel ex.: "after champtruc"
|
||||||
|
* @return int <0 si KO, >0 si OK
|
||||||
*/
|
*/
|
||||||
function DDLAddField($table,$field_name,$field_desc,$field_position="")
|
function DDLAddField($table,$field_name,$field_desc,$field_position="")
|
||||||
{
|
{
|
||||||
@@ -1126,6 +1149,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update format of a field into a table
|
* Update format of a field into a table
|
||||||
|
*
|
||||||
* @param table Name of table
|
* @param table Name of table
|
||||||
* @param field_name Name of field to modify
|
* @param field_name Name of field to modify
|
||||||
* @param field_desc Array with description of field format
|
* @param field_desc Array with description of field format
|
||||||
@@ -1145,10 +1169,11 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Drop a field in table
|
* Drop a field in table
|
||||||
* \param table Nom de la table
|
*
|
||||||
* \param field_name Nom du champ a inserer
|
* @param table Nom de la table
|
||||||
* \return int <0 si KO, >0 si OK
|
* @param field_name Nom du champ a inserer
|
||||||
|
* @return int <0 si KO, >0 si OK
|
||||||
*/
|
*/
|
||||||
function DDLDropField($table,$field_name)
|
function DDLDropField($table,$field_name)
|
||||||
{
|
{
|
||||||
@@ -1163,8 +1188,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return charset used to store data in database
|
* Return charset used to store data in database
|
||||||
* \return string Charset
|
*
|
||||||
|
* @return string Charset
|
||||||
*/
|
*/
|
||||||
function getDefaultCharacterSetDatabase()
|
function getDefaultCharacterSetDatabase()
|
||||||
{
|
{
|
||||||
@@ -1174,8 +1200,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return list of available charset that can be used to store data in database
|
* Return list of available charset that can be used to store data in database
|
||||||
* \return array List of Charset
|
*
|
||||||
|
* @return array List of Charset
|
||||||
*/
|
*/
|
||||||
function getListOfCharacterSet()
|
function getListOfCharacterSet()
|
||||||
{
|
{
|
||||||
@@ -1198,8 +1225,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return collation used in database
|
* Return collation used in database
|
||||||
* \return string Collation value
|
*
|
||||||
|
* @return string Collation value
|
||||||
*/
|
*/
|
||||||
function getDefaultCollationDatabase()
|
function getDefaultCollationDatabase()
|
||||||
{
|
{
|
||||||
@@ -1209,8 +1237,9 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return list of available collation that can be used for database
|
* Return list of available collation that can be used for database
|
||||||
* \return array Liste of Collation
|
*
|
||||||
|
* @return array Liste of Collation
|
||||||
*/
|
*/
|
||||||
function getListOfCollation()
|
function getListOfCollation()
|
||||||
{
|
{
|
||||||
@@ -1233,6 +1262,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return full path of dump program
|
* Return full path of dump program
|
||||||
|
*
|
||||||
* @return string Full path of dump program
|
* @return string Full path of dump program
|
||||||
*/
|
*/
|
||||||
function getPathOfDump()
|
function getPathOfDump()
|
||||||
@@ -1260,6 +1290,7 @@ class DoliDb
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return full path of restore program
|
* Return full path of restore program
|
||||||
|
*
|
||||||
* @return string Full path of restore program
|
* @return string Full path of restore program
|
||||||
*/
|
*/
|
||||||
function getPathOfRestore()
|
function getPathOfRestore()
|
||||||
@@ -1286,9 +1317,10 @@ class DoliDb
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Return value of server parameters
|
* Return value of server parameters
|
||||||
* \param filter Filter list on a particular value
|
*
|
||||||
* \return string Value for parameter
|
* @param filter Filter list on a particular value
|
||||||
|
* @return string Value for parameter
|
||||||
*/
|
*/
|
||||||
function getServerParametersValues($filter='')
|
function getServerParametersValues($filter='')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -58,9 +58,9 @@ function dol_shutdown()
|
|||||||
/**
|
/**
|
||||||
* Return value of a param into GET or POST supervariable
|
* Return value of a param into GET or POST supervariable
|
||||||
*
|
*
|
||||||
* @param paramname Name of parameter to found
|
* @param string $paramname Name of parameter to found
|
||||||
* @param check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's alpha only)
|
* @param string $check Type of check (''=no check, 'int'=check it's numeric, 'alpha'=check it's alpha only)
|
||||||
* @param method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
|
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
|
||||||
* @return string Value found or '' if check fails
|
* @return string Value found or '' if check fails
|
||||||
*/
|
*/
|
||||||
function GETPOST($paramname,$check='',$method=0)
|
function GETPOST($paramname,$check='',$method=0)
|
||||||
@@ -102,7 +102,7 @@ function dol_getprefix()
|
|||||||
* To link to a module file from a module file, use include('./mymodulefile');
|
* To link to a module file from a module file, use include('./mymodulefile');
|
||||||
* To link to a module file from a core file, then this function can be used
|
* To link to a module file from a core file, then this function can be used
|
||||||
*
|
*
|
||||||
* @param relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
|
* @param string $relpath Relative path to file (Ie: mydir/myfile, ../myfile, ...)
|
||||||
* @return int false if include fails.
|
* @return int false if include fails.
|
||||||
*/
|
*/
|
||||||
function dol_include_once($relpath)
|
function dol_include_once($relpath)
|
||||||
@@ -115,8 +115,8 @@ function dol_include_once($relpath)
|
|||||||
/**
|
/**
|
||||||
* Return path of url or filesystem. Return default_root or alternate root if file_exist fails
|
* Return path of url or filesystem. Return default_root or alternate root if file_exist fails
|
||||||
*
|
*
|
||||||
* @param path Relative path to file (if mode=0, ie: mydir/myfile, ../myfile, ...) or relative url (if mode=1).
|
* @param string $path Relative path to file (if mode=0, ie: mydir/myfile, ../myfile, ...) or relative url (if mode=1).
|
||||||
* @param type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path)
|
* @param int $type 0=Used for a Filesystem path, 1=Used for an URL path (output relative), 2=Used for an URL path (output full path)
|
||||||
* @return string Full filsystem path (if mode=0), Full url path (if mode=1)
|
* @return string Full filsystem path (if mode=0), Full url path (if mode=1)
|
||||||
*/
|
*/
|
||||||
function dol_buildpath($path,$type=0)
|
function dol_buildpath($path,$type=0)
|
||||||
@@ -168,8 +168,8 @@ function dol_buildpath($path,$type=0)
|
|||||||
* Create a clone of instance of object (new instance with same properties)
|
* Create a clone of instance of object (new instance with same properties)
|
||||||
* This function works for both PHP4 and PHP5
|
* This function works for both PHP4 and PHP5
|
||||||
*
|
*
|
||||||
* @param object Object to clone
|
* @param object $object Object to clone
|
||||||
* @return date Timestamp
|
* @return object Object clone
|
||||||
*/
|
*/
|
||||||
function dol_clone($object)
|
function dol_clone($object)
|
||||||
{
|
{
|
||||||
@@ -187,8 +187,8 @@ function dol_clone($object)
|
|||||||
/**
|
/**
|
||||||
* Optimize a size for some browsers (phone, smarphone, ...)
|
* Optimize a size for some browsers (phone, smarphone, ...)
|
||||||
*
|
*
|
||||||
* @param size Size we want
|
* @param int $size Size we want
|
||||||
* @param type Type of optimizing:
|
* @param string $type Type of optimizing:
|
||||||
* '' = function used to define a size for truncation
|
* '' = function used to define a size for truncation
|
||||||
* 'width' = function is used to define a width
|
* 'width' = function is used to define a width
|
||||||
* @return int New size after optimizing
|
* @return int New size after optimizing
|
||||||
@@ -318,7 +318,7 @@ function dol_string_nospecial($str,$newstr='_',$badchars='')
|
|||||||
/**
|
/**
|
||||||
* Returns text escaped for inclusion into javascript code
|
* Returns text escaped for inclusion into javascript code
|
||||||
*
|
*
|
||||||
* @param $stringtoescape String to escape
|
* @param string $stringtoescape String to escape
|
||||||
* @return string Escaped string
|
* @return string Escaped string
|
||||||
*/
|
*/
|
||||||
function dol_escape_js($stringtoescape)
|
function dol_escape_js($stringtoescape)
|
||||||
@@ -332,8 +332,8 @@ function dol_escape_js($stringtoescape)
|
|||||||
/**
|
/**
|
||||||
* Returns text escaped for inclusion in HTML alt or title tags
|
* Returns text escaped for inclusion in HTML alt or title tags
|
||||||
*
|
*
|
||||||
* @param $stringtoescape String to escape
|
* @param string $stringtoescape String to escape
|
||||||
* @param $keepb Do not clean b tags
|
* @param int $keepb Do not clean b tags
|
||||||
* @return string Escaped string
|
* @return string Escaped string
|
||||||
*/
|
*/
|
||||||
function dol_escape_htmltag($stringtoescape,$keepb=0)
|
function dol_escape_htmltag($stringtoescape,$keepb=0)
|
||||||
@@ -358,8 +358,8 @@ function dol_escape_htmltag($stringtoescape,$keepb=0)
|
|||||||
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
* On Windows LOG_ERR=4, LOG_WARNING=5, LOG_NOTICE=LOG_INFO=6, LOG_DEBUG=6 si define_syslog_variables ou PHP 5.3+, 7 si dolibarr
|
||||||
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
* On Linux LOG_ERR=3, LOG_WARNING=4, LOG_INFO=6, LOG_DEBUG=7
|
||||||
*
|
*
|
||||||
* @param string message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
* @param string $message Line to log. Ne doit pas etre traduit si level = LOG_ERR
|
||||||
* @param int level Log level
|
* @param int $level Log level
|
||||||
*/
|
*/
|
||||||
function dol_syslog($message, $level=LOG_INFO)
|
function dol_syslog($message, $level=LOG_INFO)
|
||||||
{
|
{
|
||||||
@@ -469,6 +469,7 @@ function dol_syslog($message, $level=LOG_INFO)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show tab header of a card
|
* Show tab header of a card
|
||||||
|
*
|
||||||
* @param links Array of tabs
|
* @param links Array of tabs
|
||||||
* @param active Active tab name
|
* @param active Active tab name
|
||||||
* @param title Title
|
* @param title Title
|
||||||
@@ -482,6 +483,7 @@ function dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show tab header of a card
|
* Show tab header of a card
|
||||||
|
*
|
||||||
* @param links Array of tabs
|
* @param links Array of tabs
|
||||||
* @param active Active tab name
|
* @param active Active tab name
|
||||||
* @param title Title
|
* @param title Title
|
||||||
@@ -548,7 +550,8 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show tab footer of a card
|
* Show tab footer of a card
|
||||||
* @param notab 0=Add tab footer, 1=no tab footer
|
*
|
||||||
|
* @param int $notab 0=Add tab footer, 1=no tab footer
|
||||||
*/
|
*/
|
||||||
function dol_fiche_end($notab=0)
|
function dol_fiche_end($notab=0)
|
||||||
{
|
{
|
||||||
@@ -557,7 +560,8 @@ function dol_fiche_end($notab=0)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return tab footer of a card
|
* Return tab footer of a card
|
||||||
* @param notab 0=Add tab footer, 1=no tab footer
|
*
|
||||||
|
* @param int $notab 0=Add tab footer, 1=no tab footer
|
||||||
*/
|
*/
|
||||||
function dol_get_fiche_end($notab=0)
|
function dol_get_fiche_end($notab=0)
|
||||||
{
|
{
|
||||||
@@ -574,7 +578,8 @@ function dolibarr_print_date($time,$format='',$to_gmt=false,$outputlangs='',$enc
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Output date in a string format according to outputlangs (or langs if not defined).
|
* Output date in a string format according to outputlangs (or langs if not defined).
|
||||||
* Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset.
|
* Return charset is always UTF-8, except if encodetoouput is defined. In this cas charset is output charset
|
||||||
|
*
|
||||||
* @param time GM Timestamps date (or deprecated strings 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS')
|
* @param time GM Timestamps date (or deprecated strings 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS')
|
||||||
* @param format Output date format
|
* @param format Output date format
|
||||||
* "%d %b %Y",
|
* "%d %b %Y",
|
||||||
@@ -721,6 +726,7 @@ function dol_print_date($time,$format='',$tzoutput='tzserver',$outputlangs='',$e
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string date into a GM Timestamps date
|
* Convert a string date into a GM Timestamps date
|
||||||
|
*
|
||||||
* @param string Date in a string
|
* @param string Date in a string
|
||||||
* YYYYMMDD
|
* YYYYMMDD
|
||||||
* YYYYMMDDHHMMSS
|
* YYYYMMDDHHMMSS
|
||||||
@@ -771,7 +777,8 @@ function dol_stringtotime($string, $gm=1)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array with date info
|
* Return an array with date info
|
||||||
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows.
|
* PHP getdate is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||||
|
*
|
||||||
* @param timestamp Timestamp
|
* @param timestamp Timestamp
|
||||||
* @param fast Fast mode
|
* @param fast Fast mode
|
||||||
* @return array Array of informations
|
* @return array Array of informations
|
||||||
@@ -825,6 +832,7 @@ function dolibarr_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$chec
|
|||||||
* Return a timestamp date built from detailed informations (by default a local PHP server timestamp)
|
* Return a timestamp date built from detailed informations (by default a local PHP server timestamp)
|
||||||
* Replace function mktime not available under Windows if year < 1970
|
* Replace function mktime not available under Windows if year < 1970
|
||||||
* PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
* PHP mktime is restricted to the years 1901-2038 on Unix and 1970-2038 on Windows
|
||||||
|
*
|
||||||
* @param hour Hour (can be -1 for undefined)
|
* @param hour Hour (can be -1 for undefined)
|
||||||
* @param minute Minute (can be -1 for undefined)
|
* @param minute Minute (can be -1 for undefined)
|
||||||
* @param second Second (can be -1 for undefined)
|
* @param second Second (can be -1 for undefined)
|
||||||
@@ -890,6 +898,7 @@ function dolibarr_date($fmt, $timestamp, $gm=false)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns formated date
|
* Returns formated date
|
||||||
|
*
|
||||||
* @param fmt Format (Exemple: 'Y-m-d H:i:s')
|
* @param fmt Format (Exemple: 'Y-m-d H:i:s')
|
||||||
* @param timestamp Date. Example: If timestamp=0 and gm=1, return 01/01/1970 00:00:00
|
* @param timestamp Date. Example: If timestamp=0 and gm=1, return 01/01/1970 00:00:00
|
||||||
* @param gm 1 if timestamp was built with gmmktime, 0 if timestamp was build with mktime
|
* @param gm 1 if timestamp was built with gmmktime, 0 if timestamp was build with mktime
|
||||||
@@ -917,6 +926,7 @@ function dol_date($fmt, $timestamp, $gm=false)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return string with formated size
|
* Return string with formated size
|
||||||
|
*
|
||||||
* @param size Size to print
|
* @param size Size to print
|
||||||
* @param shortvalue Tell if we want long value to use another unit (Ex: 1.5Kb instead of 1500b)
|
* @param shortvalue Tell if we want long value to use another unit (Ex: 1.5Kb instead of 1500b)
|
||||||
* @param shortunit Use short value of size unit
|
* @param shortunit Use short value of size unit
|
||||||
@@ -949,6 +959,7 @@ function dol_print_size($size,$shortvalue=0,$shortunit=0)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show Url link
|
* Show Url link
|
||||||
|
*
|
||||||
* @param url Url to show
|
* @param url Url to show
|
||||||
* @param target Target for link
|
* @param target Target for link
|
||||||
* @param max Max number of characters to show
|
* @param max Max number of characters to show
|
||||||
@@ -970,6 +981,7 @@ function dol_print_url($url,$target='_blank',$max=32)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Show EMail link
|
* Show EMail link
|
||||||
|
*
|
||||||
* @param email EMail to show (only email, without 'Name of recipient' before)
|
* @param email EMail to show (only email, without 'Name of recipient' before)
|
||||||
* @param cid Id of contact if known
|
* @param cid Id of contact if known
|
||||||
* @param socid Id of third party if known
|
* @param socid Id of third party if known
|
||||||
@@ -1026,6 +1038,7 @@ function dolibarr_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$s
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format phone numbers according to country
|
* Format phone numbers according to country
|
||||||
|
*
|
||||||
* @param phone Phone number to format
|
* @param phone Phone number to format
|
||||||
* @param country Country to use for formatting
|
* @param country Country to use for formatting
|
||||||
* @param cid Id of contact if known
|
* @param cid Id of contact if known
|
||||||
@@ -1104,6 +1117,7 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an IP formated to be shown on screen
|
* Return an IP formated to be shown on screen
|
||||||
|
*
|
||||||
* @param ip IP
|
* @param ip IP
|
||||||
* @param mode 1=return only country/flag,2=return only IP
|
* @param mode 1=return only country/flag,2=return only IP
|
||||||
* @return string Formated IP, with country if GeoIP module is enabled
|
* @return string Formated IP, with country if GeoIP module is enabled
|
||||||
@@ -1143,6 +1157,7 @@ function dol_print_ip($ip,$mode=0)
|
|||||||
/**
|
/**
|
||||||
* Return country code for current user.
|
* Return country code for current user.
|
||||||
* If software is used inside a local network, detection may fails (we need a public ip)
|
* If software is used inside a local network, detection may fails (we need a public ip)
|
||||||
|
*
|
||||||
* @return string country code (fr, es, it, us, ...)
|
* @return string country code (fr, es, it, us, ...)
|
||||||
*/
|
*/
|
||||||
function dol_user_country()
|
function dol_user_country()
|
||||||
@@ -1167,6 +1182,7 @@ function dol_user_country()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Format address string
|
* Format address string
|
||||||
|
*
|
||||||
* @param address Address
|
* @param address Address
|
||||||
* @param htmlid Html ID
|
* @param htmlid Html ID
|
||||||
* @param mode thirdparty|contact|member|other
|
* @param mode thirdparty|contact|member|other
|
||||||
@@ -1212,8 +1228,9 @@ function dol_print_address($address, $htmlid='gmap', $mode, $id)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if email syntax is ok.
|
* Return true if email syntax is ok
|
||||||
* @param address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
*
|
||||||
|
* @param string $address email (Ex: "toto@titi.com", "John Do <johndo@titi.com>")
|
||||||
* @return boolean true if email syntax is OK, false if KO or empty string
|
* @return boolean true if email syntax is OK, false if KO or empty string
|
||||||
*/
|
*/
|
||||||
function isValidEmail($address)
|
function isValidEmail($address)
|
||||||
@@ -1234,8 +1251,9 @@ function isValidEmail($address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if phone number syntax is ok.
|
* Return true if phone number syntax is ok
|
||||||
* @param address phone (Ex: "0601010101")
|
*
|
||||||
|
* @param string $address phone (Ex: "0601010101")
|
||||||
* @return boolean true if phone syntax is OK, false if KO or empty string
|
* @return boolean true if phone syntax is OK, false if KO or empty string
|
||||||
*/
|
*/
|
||||||
function isValidPhone($address)
|
function isValidPhone($address)
|
||||||
@@ -1245,10 +1263,11 @@ function isValidPhone($address)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a strlen call. Works even if mbstring module not enabled.
|
* Make a strlen call. Works even if mbstring module not enabled
|
||||||
* @param $string
|
*
|
||||||
* @param $stringencoding
|
* @param string $string String to calculate length
|
||||||
* @return int
|
* @param string $stringencoding Encoding of string
|
||||||
|
* @return int Length of string
|
||||||
*/
|
*/
|
||||||
function dol_strlen($string,$stringencoding='UTF-8')
|
function dol_strlen($string,$stringencoding='UTF-8')
|
||||||
{
|
{
|
||||||
@@ -1260,6 +1279,7 @@ function dol_strlen($string,$stringencoding='UTF-8')
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a substring. Works even in mbstring module not enabled
|
* Make a substring. Works even in mbstring module not enabled
|
||||||
|
*
|
||||||
* @param $string
|
* @param $string
|
||||||
* @param $start
|
* @param $start
|
||||||
* @param $length
|
* @param $length
|
||||||
|
|||||||
Reference in New Issue
Block a user