2
0
forked from Wavyzz/dolibarr

Fix: remplacement de LIKE dans la requete sql par REGEXP afin de palier au diffrent format de numrotation

This commit is contained in:
Regis Houssin
2007-07-19 17:32:06 +00:00
parent 7d5b36c3d9
commit 85a549e2b2
5 changed files with 25 additions and 25 deletions

View File

@@ -175,7 +175,7 @@ function info()
$searchyy='';
$sql = "SELECT MAX(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
if ($conf->global->COMMANDE_NUM_RESTART_BEGIN_YEAR) $sql.= " WHERE ref like '".$this->searchLast."%'";
if ($conf->global->COMMANDE_NUM_RESTART_BEGIN_YEAR) $sql.= " WHERE ref REGEXP '^".$this->searchLast."'";
$resql=$db->query($sql);
if ($resql)
{
@@ -189,7 +189,7 @@ function info()
$previousyy='';
$sql = "SELECT MAX(ref)";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref like '".$this->searchLastWithPreviousYear."%'";
$sql.= " WHERE ref REGEXP '^".$this->searchLastWithPreviousYear."'";
$resql=$db->query($sql);
if ($resql)
{
@@ -204,7 +204,7 @@ function info()
// Recherche rapide car restreint par un like sur champ index<65>
$sql = "SELECT MAX(0+SUBSTRING(ref,-".$posindice."))";
$sql.= " FROM ".MAIN_DB_PREFIX."commande";
$sql.= " WHERE ref like '${searchyy}%'";
$sql.= " WHERE ref REGEXP '^".$searchyy."'";
$resql=$db->query($sql);
if ($resql)
{
@@ -377,9 +377,9 @@ function info()
// On r<>cup<75>re le mois si besoin
$this->mm = strftime("%m",time());
$this->numMatrice[$k] = '$mm';
$this->searchLast .= $this->mm;
$this->searchLast .= '[0-9][0-9]';
$this->searchLastWithNoYear .= '[0-9][0-9]';
$this->searchLastWithPreviousYear .= $this->mm;
$this->searchLastWithPreviousYear .= '[0-9][0-9]';
$k++;
}
else if ($idMatrice == 'counter')