Skip to content
Snippets Groups Projects
Commit e5548f75 authored by Regis Houssin's avatar Regis Houssin
Browse files

Fix: ANSI SQL92

Todo: error in pgsql
parent ba15e00b
Branches
Tags
No related merge requests found
...@@ -85,8 +85,9 @@ if ($_GET["action"] == 'create') ...@@ -85,8 +85,9 @@ if ($_GET["action"] == 'create')
// Si numero deja pris (ne devrait pas arriver), on incremente par .num+1 // Si numero deja pris (ne devrait pas arriver), on incremente par .num+1
$sql = "SELECT count(*) as nb"; $sql = "SELECT count(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '$numpr%'"; $sql.= " WHERE ref LIKE '".$numpr."%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
......
...@@ -100,7 +100,8 @@ class mod_propale_marbre extends ModeleNumRefPropales ...@@ -100,7 +100,8 @@ class mod_propale_marbre extends ModeleNumRefPropales
// D'abord on recupere la valeur max (reponse immediate car champ indexe) // D'abord on recupere la valeur max (reponse immediate car champ indexe)
$posindice=8; $posindice=8;
$sql = "SELECT MAX(SUBSTRING(ref,".$posindice.")) as max"; // TODO le 0+ cree une erreur sous pgsql mais est utile sous mysql si utilisation de différent module dans le passé
$sql = "SELECT MAX(0+SUBSTRING(ref FROM ".$posindice.")) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."propal"; $sql.= " FROM ".MAIN_DB_PREFIX."propal";
$sql.= " WHERE ref LIKE '".$this->prefix."%'"; $sql.= " WHERE ref LIKE '".$this->prefix."%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment