Fix: pgsql compatibility

This commit is contained in:
Regis Houssin
2010-04-16 09:50:33 +00:00
parent 138b3dfef2
commit faef96823f
9 changed files with 20 additions and 18 deletions

View File

@@ -105,9 +105,9 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
if ($type == 0) $prefix=$this->prefixcustomer;
if ($type == 1) $prefix=$this->prefixsupplier;
// D'abord on r<EFBFBD>cup<EFBFBD>re la valeur max (r<EFBFBD>ponse imm<EFBFBD>diate car champ ind<EFBFBD>x<EFBFBD>)
// D'abord on recupere la valeur max (reponse immediate car champ indexe)
$posindice=8;
$sql = "SELECT MAX(0+SUBSTRING(".$field.",".$posindice.")) as max";
$sql = "SELECT MAX(SUBSTRING(".$field.",".$posindice.")) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
$sql.= " WHERE ".$field." LIKE '".$prefix."%'";
@@ -115,7 +115,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode
if ($resql)
{
$obj = $db->fetch_object($resql);
if ($obj) $max = $obj->max;
if ($obj) $max = intval($obj->max);
else $max=0;
}
else