task #6689, strlen problem

replace  strlen with dol_strlen
This commit is contained in:
Philippe Grand 2010-08-24 14:42:18 +00:00
parent 7408c18ca6
commit fb06c15330
84 changed files with 226 additions and 226 deletions

View File

@ -232,7 +232,7 @@ function SaveToFile($file,$s,$mode='t')
$f=fopen($file,'w'.$mode);
if(!$f)
die('Can\'t write to file '.$file);
fwrite($f,$s,strlen($s));
fwrite($f,$s,dol_strlen($s));
fclose($f);
}

View File

@ -230,7 +230,7 @@ foreach($property as $key => $prop)
$varprop.="\t\t\$sql.= \" ";
if ($prop['istime'])
{
$varprop.='".(! isset($this->'.$prop['field'].') || strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
$varprop.='".(! isset($this->'.$prop['field'].') || dol_strlen($this->'.$prop['field'].')==0?\'NULL\':$this->db->idate(';
$varprop.="\$this->".$prop['field']."";
$varprop.='))."';
if ($i < sizeof($property)) $varprop.=",";
@ -271,8 +271,8 @@ foreach($property as $key => $prop)
$varprop.=$prop['field'].'=';
if ($prop['istime'])
{
// (strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
// (dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null')
$varprop.='".(dol_strlen($this->'.$prop['field'].')!=0 ? "\'".$this->db->idate(';
$varprop.='$this->'.$prop['field'];
$varprop.=')."\'" : \'null\').';
$varprop.='"';

View File

@ -206,7 +206,7 @@ if ($resql)
{
while ($record = $db->fetch_array($result))
{
if (strlen($record['box_order']) == 1)
if (dol_strlen($record['box_order']) == 1)
{
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
{
@ -221,7 +221,7 @@ if ($resql)
$resql = $db->query($sql);
}
}
else if (strlen($record['box_order']) == 2)
else if (dol_strlen($record['box_order']) == 2)
{
if (preg_match("/[13579]{1}/",substr($record['box_order'],-1)))
{

View File

@ -214,9 +214,9 @@ if ($handle)
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
@ -334,8 +334,8 @@ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";

View File

@ -182,8 +182,8 @@ while (($file = readdir($handle))!==false)
if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 0, strlen($file) -12);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.'/'.$file);
$module=new $classname($db);

View File

@ -306,10 +306,10 @@ if(is_dir($dir))
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,15) == 'pdf_expedition_')
{
$name = substr($file, 15, strlen($file) - 27);
$classname = substr($file, 0, strlen($file) - 12);
$name = substr($file, 15, dol_strlen($file) - 27);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";

View File

@ -272,7 +272,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
$classname = "mod_facture_".$file;
}
//print "x".$dir."-".$filebis."-".$classname;
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, strlen($filebis)-3, 3) == 'php')
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, dol_strlen($filebis)-3, 3) == 'php')
{
// Chargement de la classe de numerotation
require_once($dir.$filebis);
@ -418,8 +418,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
{
$var = !$var;
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.$file);
$module = new $classname($db);

View File

@ -306,10 +306,10 @@ $var=true;
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;

View File

@ -190,9 +190,9 @@ if ($handle)
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, strlen($file)-3, 3) == 'php')
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/supplier_order/".$file.".php");
@ -310,8 +310,8 @@ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";

View File

@ -212,9 +212,9 @@ if ($handle)
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, strlen($file)-3, 3) == 'php')
if (substr($file, 0, 14) == 'mod_livraison_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/livraison/".$file.".php");
@ -331,10 +331,10 @@ if(is_dir($dir))
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) - 16);
$classname = substr($file, 0, strlen($file) - 12);
$name = substr($file, 4, dol_strlen($file) - 16);
$classname = substr($file, 0, dol_strlen($file) - 12);
$var=!$var;
print "<tr $bc[$var]><td>";

View File

@ -233,9 +233,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
while (($file = readdir($handle))!==false)
{
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{

View File

@ -34,7 +34,7 @@ accessforbidden();
llxHeader();
if (! strlen(OSC_DB_NAME))
if (! dol_strlen(OSC_DB_NAME))
{
print "Non dispo";
llxFooter();

View File

@ -88,9 +88,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{

View File

@ -179,9 +179,9 @@ if ($handle)
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 12) == 'mod_project_' && substr($file, strlen($file)-3, 3) == 'php')
if (substr($file, 0, 12) == 'mod_project_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/project/".$file.".php");
@ -298,8 +298,8 @@ while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
{
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>$name";

View File

@ -216,9 +216,9 @@ foreach ($conf->file->dol_document_root as $dirroot)
{
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, strlen($file)-3, 3) == 'php')
if (substr($file, 0, 12) == 'mod_propale_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once($dir.$file.".php");
@ -335,10 +335,10 @@ $handle=opendir($dir);
$var=true;
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
if (substr($file, dol_strlen($file) -12) == '.modules.php' && substr($file,0,12) == 'pdf_propale_')
{
$name = substr($file, 12, strlen($file) - 24);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 12, dol_strlen($file) - 24);
$classname = substr($file, 0, dol_strlen($file) -12);
$var=!$var;
print "<tr ".$bc[$var].">\n <td>";

View File

@ -196,7 +196,7 @@ if ($handle)
{
if (substr($file, 0, 15) == 'mod_codeclient_' && substr($file, -3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
@ -265,7 +265,7 @@ if ($handle)
{
if (substr($file, 0, 15) == 'mod_codecompta_' && substr($file, -3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
$file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$file.".php");
@ -355,8 +355,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 4, strlen($file) -16);
$classname = substr($file, 0, strlen($file) -12);
$name = substr($file, 4, dol_strlen($file) -16);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.'/'.$file);
$module = new $classname($db);

View File

@ -55,9 +55,9 @@ foreach($conf->file->dol_document_root as $searchdir)
$handle=opendir($dirtoscan);
while (($file = readdir($handle))!==false)
{
if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
if (is_readable($dirtoscan.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, strlen($file) - 10);
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{

View File

@ -42,7 +42,7 @@ require(DOL_DOCUMENT_ROOT.'/cashdesk/include/environnement.php');
header("Content-type: text/html; charset=".$conf->file->character_set_client);
// Search from criteria
if ( strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length at least
if ( dol_strlen ($_GET["code"]) >= 0 ) // If search criteria is on char length at least
{
$sql = "SELECT p.rowid, p.ref, p.label, p.tva_tx";
if ($conf->stock->enabled && !empty($conf_fkentrepot)) $sql.= ", ps.reel";

View File

@ -634,7 +634,7 @@ class Categorie
$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
}
// We count number of _ to have level
$this->cats[$id_categ]['level']=strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));
$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/[^_]/i','',$this->cats[$id_categ]['fullpath']));
// Process all childs on several levels of this category
$protection++;

View File

@ -87,12 +87,12 @@ if ($type == "p") $sql.= " AND s.client IN (2, 3)";
if ($type == "f") $sql.= " AND s.fournisseur = 1";
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (strlen($stcomm))
if (dol_strlen($stcomm))
{
$sql.= " AND s.fk_stcomm=$stcomm";
}
if (strlen($begin)) // filtre sur la premiere lettre du nom
if (dol_strlen($begin)) // filtre sur la premiere lettre du nom
{
$sql.= " AND upper(p.name) like '$begin%'";
}

View File

@ -466,7 +466,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
}
}
if (strlen($sendto))
if (dol_strlen($sendto))
{
$langs->load("commercial");
@ -478,7 +478,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
if ($_POST['action'] == 'send')
{
if (strlen($_POST['subject'])) $subject = $_POST['subject'];
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
else $subject = $langs->transnoentities('Propal').' '.$propal->ref;
$actiontypecode='AC_PROP';
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
@ -1713,7 +1713,7 @@ else
{
$sql.= " AND date_format(p.datep, '%Y') = $year";
}
if (strlen($_POST['sf_ref']) > 0)
if (dol_strlen($_POST['sf_ref']) > 0)
{
$sql.= " AND p.ref like '%".addslashes($_POST["sf_ref"]) . "%'";
}

View File

@ -864,7 +864,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
}
}
if (strlen($sendto))
if (dol_strlen($sendto))
{
$langs->load("commercial");
@ -876,7 +876,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
if ($_POST['action'] == 'send')
{
if (strlen($_POST['subject'])) $subject=$_POST['subject'];
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
else $subject = $langs->transnoentities('Order').' '.$commande->ref;
$actiontypecode='AC_COM';
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";

View File

@ -55,7 +55,7 @@ class ComptaCompte
function create($user)
{
if (strlen(trim($this->numero)) && strlen(trim($this->intitule)))
if (dol_strlen(trim($this->numero)) && dol_strlen(trim($this->intitule)))
{
$sql = "SELECT count(*)";
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux ";

View File

@ -105,7 +105,7 @@ $sql.= " WHERE s.fk_stcomm = st.id AND s.client=1";
$sql.= " AND s.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (strlen($stcomm))
if (dol_strlen($stcomm))
{
$sql.= " AND s.fk_stcomm=$stcomm";
}
@ -132,7 +132,7 @@ if ($_GET["search_code_client"])
$sql.= " AND s.code_client like '%".addslashes($_GET["search_code_client"])."%'";
}
if (strlen($begin))
if (dol_strlen($begin))
{
$sql.= " AND s.nom like '".addslashes($begin)."'";
}

View File

@ -85,7 +85,7 @@ if (isset($_GET["afacturer"]) && $_GET['afacturer'] == 1)
{
$sql.= " AND fk_statut >=1 AND c.facture = 0";
}
if (strlen($_POST["sf_ref"]) > 0)
if (dol_strlen($_POST["sf_ref"]) > 0)
{
$sql.= " AND c.ref like '%".$_POST["sf_ref"] . "%'";
}

View File

@ -209,34 +209,34 @@ class Don extends CommonObject
{
$err = 0;
if (strlen(trim($this->societe)) == 0)
if (dol_strlen(trim($this->societe)) == 0)
{
if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0)
if ((dol_strlen(trim($this->nom)) + dol_strlen(trim($this->prenom))) == 0)
{
$error_string[$err] = "Vous devez saisir vos nom et prenom ou le nom de votre societe.";
$err++;
}
}
if (strlen(trim($this->adresse)) == 0)
if (dol_strlen(trim($this->adresse)) == 0)
{
$error_string[$err] = "L'adresse saisie est invalide";
$err++;
}
if (strlen(trim($this->cp)) == 0)
if (dol_strlen(trim($this->cp)) == 0)
{
$error_string[$err] = "Le code postal saisi est invalide";
$err++;
}
if (strlen(trim($this->ville)) == 0)
if (dol_strlen(trim($this->ville)) == 0)
{
$error_string[$err] = "La ville saisie est invalide";
$err++;
}
if (strlen(trim($this->email)) == 0)
if (dol_strlen(trim($this->email)) == 0)
{
$error_string[$err] = "L'email saisi est invalide";
$err++;
@ -245,7 +245,7 @@ class Don extends CommonObject
$this->amount = trim($this->amount);
$map = range(0,9);
for ($i = 0; $i < strlen($this->amount) ; $i++)
for ($i = 0; $i < dol_strlen($this->amount) ; $i++)
{
if (!isset($map[substr($this->amount, $i, 1)] ))
{

View File

@ -164,7 +164,7 @@ class ComptaJournalPaiement
$socnom = $obj->nom;
$libelle = $obj->libelle;
if (strlen($obj->nom) > 31)
if (dol_strlen($obj->nom) > 31)
{
$socnom = substr($obj->nom, 0 , 31);
}
@ -190,7 +190,7 @@ class ComptaJournalPaiement
$s = $socnom . ' '.$libelle;
$facnumber = $obj->facnumber;
if (strlen(trim($obj->increment)) > 0)
if (dol_strlen(trim($obj->increment)) > 0)
{
$facnumber = $obj->increment;
}

View File

@ -157,12 +157,12 @@ class ComptaJournalVente {
$tva = abs($obj->tva);
$facnumber = $obj->facnumber;
if (strlen(trim($obj->increment)) > 0)
if (dol_strlen(trim($obj->increment)) > 0)
{
$facnumber = $obj->increment;
}
if (strlen($obj->nom) > 31)
if (dol_strlen($obj->nom) > 31)
{
$socnom = substr($obj->nom, 0 , 31);
}

View File

@ -138,7 +138,7 @@ if ($handle)
{
while (($file = readdir($handle))!==false)
{
if (is_readable($updir.$file) && is_dir($updir.$file) && strlen($file) == 4)
if (is_readable($updir.$file) && is_dir($updir.$file) && dol_strlen($file) == 4)
{
$var=!$var;
print '<tr '.$bc[$var].'><td><a href="index.php?year='.$file.'">'.$file.'</a><td></tr>';

View File

@ -178,7 +178,7 @@ class ComptaExport
$this->linep[$i][5] = $obj->amount;
$this->linep[$i][6] = $obj->libelle;
if (strlen(trim( $obj->increment)) > 0)
if (dol_strlen(trim( $obj->increment)) > 0)
{
$this->linep[$i][7] = $obj->increment;
}

View File

@ -47,7 +47,7 @@ class ComptaExportTableur extends ComptaExport
$fname = DOL_DATA_ROOT ."/telephonie/ligne/commande/".$this->datef.".xls";
if (strlen(trim($this->fournisseur->email_commande)) == 0)
if (dol_strlen(trim($this->fournisseur->email_commande)) == 0)
{
return -3;
}

View File

@ -1166,7 +1166,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
}
}
if (strlen($sendto))
if (dol_strlen($sendto))
{
$langs->load("commercial");
@ -1178,7 +1178,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
if ($_POST['action'] == 'send')
{
if (strlen($_POST['subject'])) $subject = $_POST['subject'];
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
else $subject = $langs->transnoentities('Bill').' '.$fac->ref;
$actiontypecode='AC_FAC';
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";
@ -1192,7 +1192,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['a
}
if ($_POST['action'] == 'relance')
{
if (strlen($_POST['subject'])) $subject = $_POST['subject'];
if (dol_strlen($_POST['subject'])) $subject = $_POST['subject'];
else $subject = $langs->transnoentities('Relance facture '.$fac->ref);
$actiontypecode='AC_FAC';
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";

View File

@ -434,7 +434,7 @@ class FactureRec extends Facture
// \TODO A virer
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
if (trim(strlen($remise_percent)) > 0)
if (trim(dol_strlen($remise_percent)) > 0)
{
$remise = round(($pu * $remise_percent / 100), 2);
$price = $pu - $remise;

View File

@ -211,7 +211,7 @@ if ($_REQUEST["search_montant_ttc"])
$sql .= " AND f.total_ttc = '".$_REQUEST["search_montant_ttc"]."'";
}
if (strlen($_POST["sf_ref"]) > 0)
if (dol_strlen($_POST["sf_ref"]) > 0)
{
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
}

View File

@ -50,12 +50,12 @@ $sql = "SELECT cg.rowid, cg.numero, cg.intitule, cg.date_creation as dc";
$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux as cg";
if (strlen(trim($_GET["search_numero"])) )
if (dol_strlen(trim($_GET["search_numero"])) )
{
$sql .= " WHERE cg.numero LIKE '%".$_GET["search_numero"]."%'";
if ( strlen(trim($_GET["search_intitule"])))
if ( dol_strlen(trim($_GET["search_intitule"])))
{
$sql .= " AND cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
}
@ -63,7 +63,7 @@ if (strlen(trim($_GET["search_numero"])) )
}
else
{
if ( strlen(trim($_GET["search_intitule"])))
if ( dol_strlen(trim($_GET["search_intitule"])))
{
$sql .= " WHERE cg.intitule LIKE '%".$_GET["search_intitule"]."%'";
}

View File

@ -79,7 +79,7 @@ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
if (!$statut) $sql.= " AND pfd.traite = 0";
if ($statut) $sql.= " AND pfd.traite = ".$statut;
$sql.= " AND pfd.fk_facture = f.rowid";
if (strlen(trim($_GET["search_societe"])))
if (dol_strlen(trim($_GET["search_societe"])))
{
$sql.= " AND s.nom LIKE '%".$_GET["search_societe"]."%'";
}

View File

@ -556,9 +556,9 @@ class PaiementCharge extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."paiementcharge SET";
$sql.= " fk_charge=".(isset($this->fk_charge)?$this->fk_charge:"null").",";
$sql.= " datec=".(strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
$sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql.= " datep=".(strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
$sql.= " datec=".(dol_strlen($this->datec)!=0 ? "'".$this->db->idate($this->datec)."'" : 'null').",";
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql.= " datep=".(dol_strlen($this->datep)!=0 ? "'".$this->db->idate($this->datep)."'" : 'null').",";
$sql.= " amount=".(isset($this->amount)?$this->amount:"null").",";
$sql.= " fk_typepaiement=".(isset($this->fk_typepaiement)?$this->fk_typepaiement:"null").",";
$sql.= " num_paiement=".(isset($this->num_paiement)?"'".addslashes($this->num_paiement)."'":"null").",";

View File

@ -55,7 +55,7 @@ $sql .= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
$sql .= " WHERE f.rowid = l.fk_facture_fourn AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
$sql .= " AND c.rowid = l.fk_code_ventilation";
if (strlen(trim($_GET["search_facture"])))
if (dol_strlen(trim($_GET["search_facture"])))
{
$sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
}

View File

@ -59,7 +59,7 @@ $sql.= " , ".MAIN_DB_PREFIX."facturedet as l";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product";
$sql.= " WHERE f.rowid = l.fk_facture AND f.fk_statut = 1 AND l.fk_code_ventilation <> 0 ";
$sql.= " AND c.rowid = l.fk_code_ventilation";
if (strlen(trim($_GET["search_facture"])))
if (dol_strlen(trim($_GET["search_facture"])))
{
$sql .= " AND f.facnumber like '%".$_GET["search_facture"]."%'";
}

View File

@ -306,7 +306,7 @@ class Contact extends CommonObject
$info["phpgwContactCatId"] = 0;
$info["phpgwContactAccess"] = "public";
if (strlen($this->egroupware_id) == 0)
if (dol_strlen($this->egroupware_id) == 0)
{
$this->egroupware_id = 1;
}

View File

@ -334,17 +334,17 @@ if ($user->rights->societe->contact->creer)
print '<tr><td>'.$langs->trans("PostOrFunction").'</td><td colspan="3"><input name="poste" type="text" size="50" maxlength="80" value="'.(isset($_POST["poste"])?$_POST["poste"]:$contact->poste).'"></td>';
// Address
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->address)) == 0) $contact->address = $objsoc->address; // Predefined with third party
print '<tr><td>'.$langs->trans("Address").'</td><td colspan="3"><textarea class="flat" name="address" cols="70">'.(isset($_POST["address"])?$_POST["address"]:$contact->address).'</textarea></td>';
// Zip / Town
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->cp)) == 0) $contact->cp = $objsoc->cp; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->ville)) == 0) $contact->ville = $objsoc->ville; // Predefined with third party
print '<tr><td>'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3"><input name="cp" type="text" size="6" maxlength="80" value="'.(isset($_POST["cp"])?$_POST["cp"]:$contact->cp).'">&nbsp;';
print '<input name="ville" type="text" size="20" value="'.(isset($_POST["ville"])?$_POST["ville"]:$contact->ville).'" maxlength="80"></td></tr>';
// Country
if (strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id; // Predefined with third party
if (dol_strlen(trim($contact->fk_pays)) == 0) $contact->fk_pays = $objsoc->pays_id; // Predefined with third party
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
$form->select_pays((isset($_POST["pays_id"])?$_POST["pays_id"]:$contact->fk_pays),'pays_id',$conf->use_javascript_ajax?' onChange="company_save_refresh_create()"':'');
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
@ -363,16 +363,16 @@ if ($user->rights->societe->contact->creer)
print '</td></tr>';
// Phone / Fax
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->phone_pro)) == 0) $contact->phone_pro = $objsoc->tel; // Predefined with third party
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input name="phone_pro" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_pro"])?$_POST["phone_pro"]:$contact->phone_pro).'"></td>';
print '<td>'.$langs->trans("PhonePerso").'</td><td><input name="phone_perso" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$contact->phone_perso).'"></td></tr>';
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->fax)) == 0) $contact->fax = $objsoc->fax; // Predefined with third party
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input name="phone_mobile" type="text" size="18" maxlength="80" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$contact->phone_mobile).'"></td>';
print '<td>'.$langs->trans("Fax").'</td><td><input name="fax" type="text" size="18" maxlength="80" value="'.(isset($_POST["fax"])?$_POST["fax"]:$contact->fax).'"></td></tr>';
// EMail
if (($objsoc->typent_code == 'TE_PRIVATE') && strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email; // Predefined with third party
if (($objsoc->typent_code == 'TE_PRIVATE') && dol_strlen(trim($contact->email)) == 0) $contact->email = $objsoc->email; // Predefined with third party
print '<tr><td>'.$langs->trans("Email").'</td><td colspan="3"><input name="email" type="text" size="50" maxlength="80" value="'.(isset($_POST["email"])?$_POST["email"]:$contact->email).'"></td></tr>';
// Jabberid

View File

@ -90,7 +90,7 @@ $filenameurlencoded = dol_sanitizeFileName(urlencode($filename));
Header("Content-Disposition: attachment; filename=\"".$filename."\"");
Header("Content-Length: ".strlen($output));
Header("Content-Length: ".dol_strlen($output));
Header("Connection: close");
Header("Content-Type: text/x-vcard; name=\"".$filename."\"");

View File

@ -104,8 +104,8 @@ class Contrat extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."contratdet SET statut = 4,";
$sql.= " date_ouverture = ".(strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
$sql.= " date_fin_validite = ".(strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
$sql.= " date_ouverture = ".(dol_strlen($date)!=0?"'".$this->db->idate($date)."'":"null").",";
$sql.= " date_fin_validite = ".(dol_strlen($date_end)!=0?"'".$this->db->idate($date_end)."'":"null").",";
$sql.= " fk_user_ouverture = ".$user->id.",";
$sql.= " date_cloture = null,";
$sql.= " commentaire = '".addslashes($comment)."'";
@ -562,7 +562,7 @@ class Contrat extends CommonObject
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
$sql.= ",".($this->commercial_suivi_id>0?$this->commercial_suivi_id:"NULL");
$sql.= ",".($this->fk_projet>0?$this->fk_projet:"NULL");
$sql .= ", " . (strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
$sql .= ", " . (dol_strlen($this->ref)<=0 ? "null" : "'".$this->ref."'");
$sql.= ")";
$resql=$this->db->query($sql);
if ($resql)
@ -805,7 +805,7 @@ class Contrat extends CommonObject
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
$remise = 0;
$price = price2num(round($pu_ht, 2));
if (strlen($remise_percent) > 0)
if (dol_strlen($remise_percent) > 0)
{
$remise = round(($pu_ht * $remise_percent / 100), 2);
$price = $pu_ht - $remise;
@ -899,7 +899,7 @@ class Contrat extends CommonObject
$localtax2tx = price2num($localtax2tx);
$subprice = $price;
$remise = 0;
if (strlen($remise_percent) > 0)
if (dol_strlen($remise_percent) > 0)
{
$remise = round(($pu * $remise_percent / 100), 2);
$price = $pu - $remise;

View File

@ -62,7 +62,7 @@ class DolCookie
if (!empty($this->myKey))
{
$valuecrypt = base64_encode($this->myValue);
for ($f=0 ; $f<=strlen($valuecrypt)-1; $f++)
for ($f=0 ; $f<=dol_strlen($valuecrypt)-1; $f++)
{
$this->cookie .= intval(ord($valuecrypt[$f]))*$this->myKey."|";
}
@ -191,7 +191,7 @@ class DolCookie
$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
if ($fp = @fopen($file,'w'))
{
fputs($fp, $config, strlen($config));
fputs($fp, $config, dol_strlen($config));
fclose($fp);
// It's config file, so we set permission for creator only
// @chmod($file, octdec('0600'));

View File

@ -355,7 +355,7 @@ class DolGraph
{
$max = $this->GetMaxValueInData();
if ($max != 0) $max++;
$size=strlen(abs(ceil($max)));
$size=dol_strlen(abs(ceil($max)));
$factor=1;
for ($i=0; $i < ($size-1); $i++)
{
@ -378,7 +378,7 @@ class DolGraph
{
$min = $this->GetMinValueInData();
if ($min != 0) $min--;
$size=strlen(abs(floor($min)));
$size=dol_strlen(abs(floor($min)));
$factor=1;
for ($i=0; $i < ($size-1); $i++)
{
@ -452,7 +452,7 @@ class DolGraph
$paddleft=50;
$paddright=10;
$strl=strlen(max(abs($this->MaxValue),abs($this->MinValue)));
$strl=dol_strlen(max(abs($this->MaxValue),abs($this->MinValue)));
if ($strl > 6) $paddleft += ($strln * 4);
$group->setPadding($paddleft, $paddright); // Width on left and right for Y axis values
$group->legend->setSpace(0);

View File

@ -1007,8 +1007,8 @@ class Form
$found=0;
$currencytext=$langs->trans("Currency".$conf->monnaie);
$currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie);
if (strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code
if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code
if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code
if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code
// Multiprice
if ($price_level >= 1) // If we need a particular price level (from 1 to 6)
@ -1069,7 +1069,7 @@ class Form
if ($objp->duration)
{
$duration_value = substr($objp->duration,0,strlen($objp->duration)-1);
$duration_value = substr($objp->duration,0,dol_strlen($objp->duration)-1);
$duration_unit = substr($objp->duration,-1);
if ($duration_value > 1)
{
@ -1242,8 +1242,8 @@ class Form
{
$currencytext=$langs->trans("Currency".$conf->monnaie);
$currencytextnoent=$langs->transnoentities("Currency".$conf->monnaie);
if (strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code
if (strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code
if (dol_strlen($currencytext) > 10) $currencytext=$conf->monnaie; // If text is too long, we use the short code
if (dol_strlen($currencytextnoent) > 10) $currencytextnoent=$conf->monnaie; // If text is too long, we use the short code
$opt.= price($objp->fprice).' '.$currencytext."/".$objp->quantity;
$outval.= price($objp->fprice).' '.$currencytextnoent."/".$objp->quantity;
@ -2427,14 +2427,14 @@ class Form
}
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
if ($defaulttx < 0 || strlen($defaulttx) == 0)
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
{
$defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$idprod);
$defaultnpr=get_default_npr($societe_vendeuse,$societe_acheteuse,$idprod);
}
// Si taux par defaut n'a pu etre determine, on prend dernier de la liste.
// Comme ils sont tries par ordre croissant, dernier = plus eleve = taux courant
if ($defaulttx < 0 || strlen($defaulttx) == 0)
if ($defaulttx < 0 || dol_strlen($defaulttx) == 0)
{
$defaulttx = $txtva[sizeof($txtva)-1];
}
@ -2676,7 +2676,7 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($hour = 0; $hour < 24; $hour++)
{
if (strlen($hour) < 2)
if (dol_strlen($hour) < 2)
{
$hour = "0" . $hour;
}
@ -2702,7 +2702,7 @@ class Form
if ($empty) $retstring.='<option value="-1">&nbsp;</option>';
for ($min = 0; $min < 60 ; $min++)
{
if (strlen($min) < 2)
if (dol_strlen($min) < 2)
{
$min = "0" . $min;
}

View File

@ -152,7 +152,7 @@ class Notify
$sendto = $obj->firstname . " " . $obj->name . " <".$obj->email.">";
$actiondefid = $obj->adid;
if (strlen($sendto))
if (dol_strlen($sendto))
{
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
$application=($conf->global->MAIN_APPLICATION_TITLE?$conf->global->MAIN_APPLICATION_TITLE:'Dolibarr ERP/CRM');

View File

@ -611,7 +611,7 @@ class EcmDirectory // extends CommonObject
$this->cats[$id_categ]['fulllabel']=$this->cats[$id_categ]['label'];
}
// We count number of _ to have level
$this->cats[$id_categ]['level']=strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
$this->cats[$id_categ]['level']=dol_strlen(preg_replace('/([^_])/i','',$this->cats[$id_categ]['fullpath']));
// Traite ces enfants
$protection++;

View File

@ -604,16 +604,16 @@ class Expedition extends CommonObject
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
$sql.= " tms=".(strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').",";
$sql.= " ref=".(isset($this->ref)?"'".addslashes($this->ref)."'":"null").",";
$sql.= " ref_customer=".(isset($this->ref_customer)?"'".addslashes($this->ref_customer)."'":"null").",";
$sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").",";
$sql.= " date_creation=".(strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
$sql.= " date_creation=".(dol_strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').",";
$sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").",";
$sql.= " date_valid=".(strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').",";
$sql.= " date_valid=".(dol_strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').",";
$sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").",";
$sql.= " date_expedition=".(strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
$sql.= " date_delivery=".(strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
$sql.= " date_expedition=".(dol_strlen($this->date_expedition)!=0 ? "'".$this->db->idate($this->date_expedition)."'" : 'null').",";
$sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').",";
$sql.= " fk_address=".(isset($this->fk_adresse_livraison)?$this->fk_adresse_livraison:"null").",";
$sql.= " fk_expedition_methode=".(isset($this->expedition_method_id)?$this->expedition_method_id:"null").",";
$sql.= " tracking_number=".(isset($this->tracking_number)?"'".addslashes($this->tracking_number)."'":"null").",";

View File

@ -667,7 +667,7 @@ else
$expedition->fetch_object();
}
if (strlen($expedition->tracking_number))
if (dol_strlen($expedition->tracking_number))
{
$expedition->GetUrlTrackingStatus();
}

View File

@ -174,7 +174,7 @@ class Fichinter extends CommonObject
global $conf;
if (! is_numeric($this->duree)) { $this->duree = 0; }
if (! strlen($this->fk_project)) { $this->fk_project = 0; }
if (! dol_strlen($this->fk_project)) { $this->fk_project = 0; }
/*
* Insertion dans la base

View File

@ -614,7 +614,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
}
}
if (strlen($sendto))
if (dol_strlen($sendto))
{
$langs->load("commercial");
@ -626,7 +626,7 @@ if ($_POST['action'] == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile']
if ($_POST['action'] == 'send')
{
if (strlen($_POST['subject'])) $subject=$_POST['subject'];
if (dol_strlen($_POST['subject'])) $subject=$_POST['subject'];
else $subject = $langs->transnoentities('CustomerOrder').' '.$commande->ref;
$actiontypecode='AC_SUP_ORD';
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto.".\n";

View File

@ -106,7 +106,7 @@ if ($sall)
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
if (strlen($_GET["statut"]))
if (dol_strlen($_GET["statut"]))
{
$sql .= " AND fk_statut =".$_GET["statut"];
}

View File

@ -68,11 +68,11 @@ if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFI
$sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.rowid = p.fk_soc";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (strlen($stcomm)) {
if (dol_strlen($stcomm)) {
$sql .= " AND s.fk_stcomm=$stcomm";
}
if (strlen($begin)) {
if (dol_strlen($begin)) {
$sql .= " AND p.name like '$begin%'";
}

View File

@ -125,7 +125,7 @@ if ($user->rights->fournisseur->facture->lire)
$sql .= " AND f.total_ttc = '".$_GET["search_montant_ttc"]."'";
}
if (strlen($_POST["sf_ref"]) > 0)
if (dol_strlen($_POST["sf_ref"]) > 0)
{
$sql .= " AND f.facnumber like '%".$_POST["sf_ref"] . "%'";
}

View File

@ -67,7 +67,7 @@ class box_factures extends ModeleBoxes {
$text = $langs->trans("BoxTitleLastCustomerBills",$max);
$this->info_box_head = array(
'text' => $text,
'limit'=> strlen($text)
'limit'=> dol_strlen($text)
);
if ($user->rights->facture->lire)

View File

@ -885,9 +885,9 @@ class DolibarrModules
if (empty($r_type)) $r_type='w';
if (strlen($r_perms) )
if (dol_strlen($r_perms) )
{
if (strlen($r_subperms) )
if (dol_strlen($r_subperms) )
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
$sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)";

View File

@ -80,7 +80,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs)
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/cheque/pdf/";
// Positionne modele sur le nom du modele a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->FACTURE_ADDON_PDF)
{

View File

@ -147,7 +147,7 @@ function don_create($db, $id, $message, $modele, $outputlangs)
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/";
// Positionne modele sur le nom du modele <20> utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->DON_ADDON_MODEL)
{

View File

@ -149,7 +149,7 @@ function facture_pdf_create($db, $id, $message, $modele, $outputlangs)
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/facture/";
// Positionne modele sur le nom du modele a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->FACTURE_ADDON_PDF)
{

View File

@ -153,7 +153,7 @@ function fichinter_create($db, $object, $modele='', $outputlangs='')
$dir = DOL_DOCUMENT_ROOT."/includes/modules/fichinter/";
// Positionne modele sur le nom du modele de facture a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->FICHEINTER_ADDON_PDF)
{

View File

@ -226,12 +226,12 @@ class ImportCsv extends ModeleImports
if (strtolower($conf->global->IMPORT_CSV_FORCE_CHARSET) == 'utf8')
{
$newarrayres[$key]['val']=$val;
$newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null
$newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null
}
else
{
$newarrayres[$key]['val']=utf8_encode($val);
$newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null
$newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null
}
}
else // Autodetect format (UTF8 or ISO)
@ -239,12 +239,12 @@ class ImportCsv extends ModeleImports
if (utf8_check($val))
{
$newarrayres[$key]['val']=$val;
$newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null
$newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null
}
else
{
$newarrayres[$key]['val']=utf8_encode($val);
$newarrayres[$key]['type']=(strlen($val)?1:-1); // If empty we considere it's null
$newarrayres[$key]['type']=(dol_strlen($val)?1:-1); // If empty we considere it's null
}
}
}

View File

@ -147,7 +147,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
$dir = DOL_DOCUMENT_ROOT."/includes/modules/livraison/pdf/";
// Positionne modele sur le nom du modele de bon de livraison a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->LIVRAISON_ADDON_PDF)
{

View File

@ -143,7 +143,7 @@ class mailing_peche extends MailingTargets
$other=$tab[3];
if (! empty($buffer))
{
//print 'xx'.strlen($buffer).empty($buffer)."<br>\n";
//print 'xx'.dol_strlen($buffer).empty($buffer)."<br>\n";
$id=$cpt;
if (isValidEMail($email))
{

View File

@ -77,7 +77,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/member/cards/";
// Positionne modele sur le nom du modele a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->ADHERENT_CARDS_ADDON_PDF)
{

View File

@ -149,7 +149,7 @@ function project_pdf_create($db, $comid, $modele,$outputlangs)
$dir = DOL_DOCUMENT_ROOT."/includes/modules/project/pdf/";
// Positionne modele sur le nom du modele de projet a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if (! empty($conf->global->PROJECT_ADDON_PDF))
{

View File

@ -99,7 +99,7 @@ class modGeneratePassStandard extends ModeleGenPassword
{
// pick a random character from the possible ones
$char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
$char = substr($possible, mt_rand(0, dol_strlen($possible)-1), 1);
// we don't want this character if it's already in the password
if (!strstr($password, $char))
@ -120,7 +120,7 @@ class modGeneratePassStandard extends ModeleGenPassword
*/
function validatePassword($password)
{
if (strlen($password) < $this->length) return 0;
if (dol_strlen($password) < $this->length) return 0;
return 1;
}
}

View File

@ -177,7 +177,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
}
else
{
if (strlen($code) == 0)
if (dol_strlen($code) == 0)
{
$result=-2;
}
@ -235,7 +235,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
{
$res = 0;
if (strlen($code) < 11)
if (dol_strlen($code) < 11)
{
$res = -1;
}

View File

@ -290,7 +290,7 @@ function thirdparty_doc_create($db, $id, $message, $modele, $outputlangs)
$srctemplatepath='';
// Positionne modele sur le nom du modele a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if ($conf->global->COMPANY_ADDON_PDF)
{

View File

@ -148,7 +148,7 @@ function supplier_order_pdf_create($db, $comid, $modele,$outputlangs)
$dir = DOL_DOCUMENT_ROOT."/includes/modules/supplier_order/pdf/";
// Positionne modele sur le nom du modele de commande fournisseur a utiliser
if (! strlen($modele))
if (! dol_strlen($modele))
{
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
{

View File

@ -54,15 +54,15 @@ $error = 0;
$main_dir=isset($_POST["main_dir"])?trim($_POST["main_dir"]):'';
// On supprime / de fin dans main_dir
if (substr($main_dir, strlen($main_dir) -1) == "/")
if (substr($main_dir, dol_strlen($main_dir) -1) == "/")
{
$main_dir = substr($main_dir, 0, strlen($main_dir)-1);
$main_dir = substr($main_dir, 0, dol_strlen($main_dir)-1);
}
// On supprime / de fin dans main_url
if (substr($_POST["main_url"], strlen($_POST["main_url"]) -1) == "/")
if (substr($_POST["main_url"], dol_strlen($_POST["main_url"]) -1) == "/")
{
$_POST["main_url"] = substr($_POST["main_url"], 0, strlen($_POST["main_url"])-1);
$_POST["main_url"] = substr($_POST["main_url"], 0, dol_strlen($_POST["main_url"])-1);
}
// Directory for generated documents (invoices, orders, ecm, etc...)

View File

@ -151,7 +151,7 @@ if ($_POST["action"] == "set")
sort($tabledata);
foreach($tabledata as $file)
{
$name = substr($file, 0, strlen($file) - 4);
$name = substr($file, 0, dol_strlen($file) - 4);
$buffer = '';
$fp = fopen($dir.$file,"r");
if ($fp)
@ -261,7 +261,7 @@ if ($_POST["action"] == "set")
sort($tabledata);
foreach($tabledata as $file)
{
$name = substr($file, 0, strlen($file) - 4);
$name = substr($file, 0, dol_strlen($file) - 4);
//print "<tr><td>Creation de la table $name</td>";
$buffer = '';
$fp = fopen($dir.$file,"r");
@ -480,7 +480,7 @@ if ($_POST["action"] == "set")
sort($tabledata);
foreach($tabledata as $file)
{
$name = substr($file, 0, strlen($file) - 4);
$name = substr($file, 0, dol_strlen($file) - 4);
$fp = fopen($dir.$file,"r");
dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG);
if ($fp)

View File

@ -82,13 +82,13 @@ if ($_POST["action"] == "set")
exit;
}
if (strlen(trim($_POST["pass"])) == 0)
if (dol_strlen(trim($_POST["pass"])) == 0)
{
Header("Location: etape4.php?error=2&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit;
}
if (strlen(trim($_POST["login"])) == 0)
if (dol_strlen(trim($_POST["login"])) == 0)
{
Header("Location: etape4.php?error=3&selectlang=$setuplang".(isset($_POST["login"])?'&login='.$_POST["login"]:''));
exit;

View File

@ -81,7 +81,7 @@ print '<td valign="top" class="label"><b>';
print $langs->trans("WebPagesDirectory");
print "</b></td>";
if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
if(! isset($dolibarr_main_url_root) || dol_strlen($dolibarr_main_url_root) == 0)
{
//print "x".$_SERVER["SCRIPT_FILENAME"]." y".$_SERVER["DOCUMENT_ROOT"];
@ -98,7 +98,7 @@ if(! isset($dolibarr_main_url_root) || strlen($dolibarr_main_url_root) == 0)
}
else
{
$dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
$dolibarr_main_document_root = substr($_SERVER["SCRIPT_FILENAME"],0,dol_strlen($_SERVER["SCRIPT_FILENAME"]) - 21);
// Nettoyage du path propose
// Gere les chemins windows avec double "\"
$dolibarr_main_document_root = str_replace('\\\\','/',$dolibarr_main_document_root);

View File

@ -183,7 +183,7 @@ if ($ok)
print '<tr><td nowrap>';
print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>';
$name = substr($file, 0, strlen($file) - 4);
$name = substr($file, 0, dol_strlen($file) - 4);
// Run sql script
$ok=run_sql($dir.$file, 0, '', 1);

View File

@ -322,7 +322,7 @@ if (! isset($_GET["action"]) || preg_match('/upgrade/i',$_GET["action"]))
print '<tr><td nowrap>';
print $langs->trans("ChoosedMigrateScript").'</td><td align="right">'.$file.'</td></tr>'."\n";
$name = substr($file, 0, strlen($file) - 4);
$name = substr($file, 0, dol_strlen($file) - 4);
// Run sql script
$ok=run_sql($dir.$file, 0, '', 1);

View File

@ -2673,7 +2673,7 @@ function migrate_project_task_time($db,$langs,$conf)
{
$obj = $db->fetch_object($resql);
if ($obj->task_duration > 0 && strlen($obj->task_duration) < 3)
if ($obj->task_duration > 0 && dol_strlen($obj->task_duration) < 3)
{
$newtime = $obj->task_duration*60*60;

View File

@ -253,10 +253,10 @@ class DoliDb
{
$version= $this->getVersion();
$vlist=preg_split('/[.-]/',$version);
if (strlen($vlist[1])==1){
if (dol_strlen($vlist[1])==1){
$vlist[1]="0".$vlist[1];
}
if (strlen($vlist[2])==1){
if (dol_strlen($vlist[2])==1){
$vlist[2]="0".$vlist[2];
}
return $vlist[0].$vlist[1].$vlist[2];

View File

@ -261,10 +261,10 @@ class DoliDb
{
$version= $this->getVersion();
$vlist=preg_split('/[.-]/',$version);
if (strlen($vlist[1])==1){
if (dol_strlen($vlist[1])==1){
$vlist[1]="0".$vlist[1];
}
if (strlen($vlist[2])==1){
if (dol_strlen($vlist[2])==1){
$vlist[2]="0".$vlist[2];
}
return $vlist[0].$vlist[1].$vlist[2];

View File

@ -376,10 +376,10 @@ class DoliDb
{
$version = $this->getVersion();
$vlist = preg_split('/[.-]/',$version);
if (strlen($vlist[1])==1){
if (dol_strlen($vlist[1])==1){
$vlist[1]="0".$vlist[1];
}
if (strlen($vlist[2])==1){
if (dol_strlen($vlist[2])==1){
$vlist[2]="0".$vlist[2];
}
return $vlist[0].$vlist[1].$vlist[2];

View File

@ -455,7 +455,7 @@ function dol_print_date($time,$format='',$to_gmt=false,$outputlangs='',$encodeto
if ($format == 'dayhourxcard') $format='%Y%m%dT%H%M%SZ';
// If date undefined or "", we return ""
if (strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
if (dol_strlen($time) == 0) return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
//print 'x'.$time;
@ -845,22 +845,22 @@ function dol_print_phone($phone,$country="FR",$cid=0,$socid=0,$addlink=0,$separ=
if (strtoupper($country) == "FR")
{
// France
if (strlen($phone) == 10) {
if (dol_strlen($phone) == 10) {
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,2).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2);
}
elseif (strlen($newphone) == 7)
elseif (dol_strlen($newphone) == 7)
{
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2);
}
elseif (strlen($newphone) == 9)
elseif (dol_strlen($newphone) == 9)
{
$newphone=substr($newphone,0,2).$separ.substr($newphone,2,3).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2);
}
elseif (strlen($newphone) == 11)
elseif (dol_strlen($newphone) == 11)
{
$newphone=substr($newphone,0,3).$separ.substr($newphone,3,2).$separ.substr($newphone,5,2).$separ.substr($newphone,7,2).$separ.substr($newphone,9,2);
}
elseif (strlen($newphone) == 12)
elseif (dol_strlen($newphone) == 12)
{
$newphone=substr($newphone,0,4).$separ.substr($newphone,4,2).$separ.substr($newphone,6,2).$separ.substr($newphone,8,2).$separ.substr($newphone,10,2);
}
@ -2091,7 +2091,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
$return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>';
if (strlen($mesg))
if (dol_strlen($mesg))
{
$return.= '<td class="nobordernopadding" align="right" valign="middle"><b>'.$mesg.'</b></td>';
}
@ -2384,7 +2384,7 @@ function price($amount, $html=0, $outlangs='', $trunc=1, $rounding=-1)
$end='';
// We increase nbdecimal if there is more decimal than asked (to not loose information)
if (strlen($decpart) > $nbdecimal) $nbdecimal=strlen($decpart);
if (dol_strlen($decpart) > $nbdecimal) $nbdecimal=dol_strlen($decpart);
// Si on depasse max
if ($trunc && $nbdecimal > $conf->global->MAIN_MAX_DECIMALS_SHOWN)
{
@ -2448,7 +2448,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
// We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10
$temps=sprintf("%0.10F",$amount-intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000
$temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1
$nbofdec=max(0,strlen($temps)-2); // -2 to remove "0."
$nbofdec=max(0,dol_strlen($temps)-2); // -2 to remove "0."
$amount=number_format($amount,$nbofdec,$dec,$thousand);
}
//print "QQ".$amount.'<br>';
@ -2469,7 +2469,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
elseif ($rounding == 'MS') $nbofdectoround=$conf->global->MAIN_MAX_DECIMALS_SHOWN;
elseif ($rounding == '2') $nbofdectoround=2; // For admin info page
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
if (strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0.
if (dol_strlen($nbofdectoround)) $amount = round($amount,$nbofdectoround); // $nbofdectoround can be 0.
else return 'ErrorBadParameterProvidedToFunction';
//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>';
@ -2480,7 +2480,7 @@ function price2num($amount,$rounding='',$alreadysqlnb=0)
// We put in temps value of decimal ("0.00001"). Works with 0 and 2.0E-5 and 9999.10
$temps=sprintf("%0.10F",$amount-intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000
$temps=preg_replace('/([\.1-9])0+$/','\\1',$temps); // temps=0. or 0.00002 or 9999.1
$nbofdec=max(0,strlen($temps)-2); // -2 to remove "0."
$nbofdec=max(0,dol_strlen($temps)-2); // -2 to remove "0."
$amount=number_format($amount,min($nbofdec,$nbofdectoround),$dec,$thousand); // Convert amount to format with dolibarr dec and thousand
}
//print "TT".$amount.'<br>';
@ -2984,7 +2984,7 @@ function dol_htmlentities($a,$b,$c)
*/
function dol_string_is_good_iso($s)
{
$len=strlen($s);
$len=dol_strlen($s);
$ok=1;
for($scursor=0;$scursor<$len;$scursor++)
{
@ -3034,11 +3034,11 @@ function dol_nboflines_bis($texte,$maxlinesize=0,$charset='UTF-8')
{
foreach ($a as $line)
{
if (strlen($line)>$maxlinesize)
if (dol_strlen($line)>$maxlinesize)
{
//$line_dec = html_entity_decode(strip_tags($line));
$line_dec = html_entity_decode($line);
if(strlen($line_dec)>$maxlinesize)
if(dol_strlen($line_dec)>$maxlinesize)
{
$line_dec=wordwrap($line_dec,$maxlinesize,'\n',true);
$nblines+=substr_count($line_dec,'\n');
@ -3284,7 +3284,7 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort, $case_sensitive
*/
function utf8_check($Str)
{
for ($i=0; $i<strlen($Str); $i++)
for ($i=0; $i<dol_strlen($Str); $i++)
{
if (ord($Str[$i]) < 0x80) continue; # 0bbbbbbb
elseif ((ord($Str[$i]) & 0xE0) == 0xC0) $n=1; # 110bbbbb
@ -3294,7 +3294,7 @@ function utf8_check($Str)
elseif ((ord($Str[$i]) & 0xFE) == 0xFC) $n=5; # 1111110b
else return false; # Does not match any model
for ($j=0; $j<$n; $j++) { # n bytes matching 10bbbbbb follow ?
if ((++$i == strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
if ((++$i == dol_strlen($Str)) || ((ord($Str[$i]) & 0xC0) != 0x80))
return false;
}
}

View File

@ -368,7 +368,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$maskcounter=$reg[1];
$maskraz=-1;
$maskoffset=0;
if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@ -377,10 +377,10 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$maskrefclient_maskclientcode=$regClientRef[1];
$maskrefclient_maskcounter=$regClientRef[2];
$maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset
$maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code where n is length in mask
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
}
else $maskrefclient='';
@ -388,8 +388,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
if (preg_match('/\{(t+)\}/i',$mask,$regType))
{
$masktype=$regType[1];
$masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,strlen($regType[1]));//get n first characters of client code where n is length in mask
$masktype_value=str_pad($masktype_value,strlen($regType[1]),"#",STR_PAD_RIGHT);
$masktype_value=substr(preg_replace('/^TE_/','',$objsoc->typent_code),0,dol_strlen($regType[1]));//get n first characters of client code where n is length in mask
$masktype_value=str_pad($masktype_value,dol_strlen($regType[1]),"#",STR_PAD_RIGHT);
}
else $masktype='';
@ -430,16 +430,16 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$yearoffset=0;
$yearcomp=0;
if (date("m",$date) < $maskraz) { $yearoffset=-1; } // If current month lower that month of return to zero, year is previous year
if (strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
if (strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
if (strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
if (dol_strlen($reg[2]) == 4) $yearcomp=sprintf("%04d",date("Y",$date)+$yearoffset);
if (dol_strlen($reg[2]) == 2) $yearcomp=sprintf("%02d",date("y",$date)+$yearoffset);
if (dol_strlen($reg[2]) == 1) $yearcomp=substr(date("y",$date),2,1)+$yearoffset;
$sqlwhere='';
$sqlwhere.='( (SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.$yearcomp;
$sqlwhere.='( (SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.$yearcomp;
if ($monthcomp > 1) // Test useless if monthcomp = 1 (or 0 is same as 1)
{
$sqlwhere.=' AND SUBSTRING('.$field.', '.(strlen($reg[1])+strlen($reg[2])+1).', '.strlen($reg[3]).') >= '.$monthcomp.')';
$sqlwhere.=' OR SUBSTRING('.$field.', '.(strlen($reg[1])+1).', '.strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )';
$sqlwhere.=' AND SUBSTRING('.$field.', '.(dol_strlen($reg[1])+dol_strlen($reg[2])+1).', '.dol_strlen($reg[3]).') >= '.$monthcomp.')';
$sqlwhere.=' OR SUBSTRING('.$field.', '.(dol_strlen($reg[1])+1).', '.dol_strlen($reg[2]).') >= '.sprintf("%02d",($yearcomp+1)).' )';
}
else
{
@ -451,7 +451,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
// Define $sqlstring
$posnumstart=strpos($maskwithnocode,$maskcounter); // Pos of counter in final string (from 0 to ...)
if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence';
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.strlen($maskcounter).')';
$sqlstring='SUBSTRING('.$field.', '.($posnumstart+1).', '.dol_strlen($maskcounter).')';
//print "x".$sqlstring;
// Define $maskLike
@ -463,9 +463,9 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$maskLike = preg_replace('/\{y\}/i','_',$maskLike);
$maskLike = preg_replace('/\{mm\}/i','__',$maskLike);
$maskLike = preg_replace('/\{dd\}/i','__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike);
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",strlen($masktype),"_"),$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",dol_strlen($maskrefclient),"_"),$maskLike);
//if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),str_pad("",dol_strlen($masktype),"_"),$maskLike);
if ($masktype) $maskLike = str_replace(dol_string_nospecial('{'.$masktype.'}'),$masktype_value,$maskLike);
// Get counter in database
@ -498,7 +498,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
// Define $sqlstring
$maskrefclient_posnumstart=strpos($maskwithnocode,$maskrefclient_maskcounter,strpos($maskwithnocode,$maskrefclient)); // Pos of counter in final string (from 0 to ...)
if ($maskrefclient_posnumstart <= 0) return 'ErrorBadMask';
$maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.strlen($maskrefclient_maskcounter).')';
$maskrefclient_sqlstring='SUBSTRING('.$field.', '.($maskrefclient_posnumstart+1).', '.dol_strlen($maskrefclient_maskcounter).')';
//print "x".$sqlstring;
// Define $maskrefclient_maskLike
@ -510,8 +510,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskrefclient_maskLike);
$maskrefclient_maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),$maskrefclient_clientcode.str_pad("",dol_strlen($maskrefclient_maskcounter),"_"),$maskrefclient_maskLike);
// Get counter in database
$maskrefclient_counter=0;
@ -522,7 +522,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
$maskrefclient_sql.= " AND entity = ".$conf->entity;
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
dol_syslog("functions2::get_next_value maskrefclient_sql=".$maskrefclient_sql, LOG_DEBUG);
$maskrefclient_resql=$db->query($maskrefclient_sql);
@ -548,7 +548,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
// Now we replace the counter
$maskbefore='{'.$masktri.'}';
$maskafter=str_pad($counter,strlen($maskcounter),"0",STR_PAD_LEFT);
$maskafter=str_pad($counter,dol_strlen($maskcounter),"0",STR_PAD_LEFT);
//print 'x'.$maskbefore.'-'.$maskafter.'y';
$numFinal = str_replace($maskbefore,$maskafter,$numFinal);
@ -557,7 +557,7 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='')
{
//print "maskrefclient=".$maskrefclient." maskwithonlyymcode=".$maskwithonlyymcode." maskwithnocode=".$maskwithnocode."\n<br>";
$maskrefclient_maskbefore='{'.$maskrefclient.'}';
$maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT);
$maskrefclient_maskafter=$maskrefclient_clientcode.str_pad($maskrefclient_counter,dol_strlen($maskrefclient_maskcounter),"0",STR_PAD_LEFT);
$numFinal = str_replace($maskrefclient_maskbefore,$maskrefclient_maskafter,$numFinal);
}
@ -592,7 +592,7 @@ function check_value($mask,$value)
$maskcounter=$reg[1];
$maskraz=-1;
$maskoffset=0;
if (strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
if (dol_strlen($maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
// Extract value for third party mask counter
if (preg_match('/\{(c+)(0*)\}/i',$mask,$regClientRef))
@ -601,10 +601,10 @@ function check_value($mask,$value)
$maskrefclient_maskclientcode=$regClientRef[1];
$maskrefclient_maskcounter=$regClientRef[2];
$maskrefclient_maskoffset=0; //default value of maskrefclient_counter offset
$maskrefclient_clientcode=substr($valueforccc,0,strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=substr($valueforccc,0,dol_strlen($maskrefclient_maskclientcode));//get n first characters of client code to form maskrefclient_clientcode
$maskrefclient_clientcode=str_pad($maskrefclient_clientcode,dol_strlen($maskrefclient_maskclientcode),"#",STR_PAD_RIGHT);//padding maskrefclient_clientcode for having exactly n characters in maskrefclient_clientcode
$maskrefclient_clientcode=dol_string_nospecial($maskrefclient_clientcode);//sanitize maskrefclient_clientcode for sql insert and sql select like
if (strlen($maskrefclient_maskcounter) > 0 && strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'CounterMustHaveMoreThan3Digits';
}
else $maskrefclient='';
@ -641,12 +641,12 @@ function check_value($mask,$value)
}
//print "masktri=".$masktri." maskcounter=".$maskcounter." maskraz=".$maskraz." maskoffset=".$maskoffset."<br>\n";
// Check we have a number in ($posnumstart+1).', '.strlen($maskcounter)
// Check we have a number in ($posnumstart+1).', '.dol_strlen($maskcounter)
//
// Check length
$len=strlen($maskwithnocode);
if (strlen($value) != $len) $result=-1;
$len=dol_strlen($maskwithnocode);
if (dol_strlen($value) != $len) $result=-1;
// Define $maskLike
$maskLike = dol_string_nospecial($mask);
@ -657,7 +657,7 @@ function check_value($mask,$value)
$maskLike = str_replace(dol_string_nospecial('{y}'),'_',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{mm}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{dd}'),'__',$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",strlen($maskcounter),"_"),$maskLike);
$maskLike = str_replace(dol_string_nospecial('{'.$masktri.'}'),str_pad("",dol_strlen($maskcounter),"_"),$maskLike);
if ($maskrefclient) $maskLike = str_replace(dol_string_nospecial('{'.$maskrefclient.'}'),str_pad("",strlen($maskrefclient),"_"),$maskLike);
@ -675,10 +675,10 @@ function check_value($mask,$value)
*/
function binhex($bin, $pad=false, $upper=false)
{
$last = strlen($bin)-1;
$last = dol_strlen($bin)-1;
for($i=0; $i<=$last; $i++){ $x += $bin[$last-$i] * pow(2,$i); }
$x = dechex($x);
if($pad){ while(strlen($x) < intval(strlen($bin))/4){ $x = "0$x"; } }
if($pad){ while(dol_strlen($x) < intval(dol_strlen($bin))/4){ $x = "0$x"; } }
if($upper){ $x = strtoupper($x); }
return $x;
}
@ -692,7 +692,7 @@ function binhex($bin, $pad=false, $upper=false)
function hexbin($hexa)
{
$bin='';
for($i=0;$i<strlen($hexa);$i++)
for($i=0;$i<dol_strlen($hexa);$i++)
{
$bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT);
}

View File

@ -160,7 +160,7 @@ function dol_ch_controle_bvrb ($bvrb)
// Make control
$report=0;
while (strlen($bv)>1)
while (dol_strlen($bv)>1)
{
$match=substr($bv,0,1);
$report=$tableau[$report][$match];

View File

@ -70,7 +70,7 @@ class GoogleAPI
//print $code;
//print "<br>";
$latitude = substr($code, 0, strpos($code, ","));
$longitude = substr($code, strpos($code, ",")+1, strlen(strpos($code, ","))-3);
$longitude = substr($code, strpos($code, ",")+1, dol_strlen(strpos($code, ","))-3);
// Output the coordinates
//echo "Longitude: $longitude ',' Latitude: $latitude";