Skip to content
Snippets Groups Projects
Commit 74519c6f authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Correction pour compatibilite mysql/pgsql.

parent 9ecc04da
No related branches found
No related tags found
No related merge requests found
...@@ -120,7 +120,7 @@ class Product ...@@ -120,7 +120,7 @@ class Product
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ( $result ) if ( $result )
{ {
$id = $this->db->last_insert_id(); $id = $this->db->last_insert_id(MAIN_DB_PREFIX."product");
if ($id > 0) if ($id > 0)
{ {
...@@ -208,7 +208,7 @@ class Product ...@@ -208,7 +208,7 @@ class Product
function _log_price($user) function _log_price($user)
{ {
// On supprimme ligne existante au cas ou
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price "; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price ";
$sql .= "WHERE date_price = now()"; $sql .= "WHERE date_price = now()";
$sql .= " and fk_product = ".$this->id; $sql .= " and fk_product = ".$this->id;
...@@ -219,14 +219,10 @@ class Product ...@@ -219,14 +219,10 @@ class Product
$this->db->query($sql); $this->db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price "; // On ajoute nouveau tarif
$sql .= " SET date_price = now()"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_price(date_price,fk_product,fk_user_author,price,envente,tva_tx) ";
$sql .= " ,fk_product = ".$this->id; $sql .= " VALUES(now(),".$this->id.",".$user->id.",".ereg_replace(",",".",$this->price).",".$this->envente.",".$this->tva_tx;
$sql .= " ,fk_user_author = ".$user->id; $sql .= ")";
$sql .= " ,price = ".ereg_replace(",",".",$this->price);
$sql .= " ,envente = ".$this->envente;
$sql .= " ,tva_tx = ".$this->tva_tx;
if ($this->db->query($sql) ) if ($this->db->query($sql) )
{ {
return 1; return 1;
...@@ -272,14 +268,12 @@ class Product ...@@ -272,14 +268,12 @@ class Product
} }
else else
{ {
print $sql . " ". $this->db->error();
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return 2; return 2;
} }
} }
else else
{ {
print $sql . " ". $this->db->error();
dolibarr_print_error($this->db); dolibarr_print_error($this->db);
return 2; return 2;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment