Fix: Correction pour compatibilite mysql/pgsql.
This commit is contained in:
parent
9ecc04dafa
commit
74519c6f30
@ -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)
|
||||||
{
|
{
|
||||||
@ -206,9 +206,9 @@ class Product
|
|||||||
* \param user utilisateur qui modifie le prix
|
* \param user utilisateur qui modifie le prix
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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,24 +219,20 @@ 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);
|
if ($this->db->query($sql) )
|
||||||
$sql .= " ,envente = ".$this->envente;
|
{
|
||||||
$sql .= " ,tva_tx = ".$this->tva_tx;
|
return 1;
|
||||||
|
}
|
||||||
if ($this->db->query($sql) )
|
else
|
||||||
{
|
{
|
||||||
return 1;
|
dolibarr_print_error($this->db);
|
||||||
}
|
return 0;
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Modifie le prix d'achat pour un fournisseur
|
* \brief Modifie le prix d'achat pour un fournisseur
|
||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user