Merge pull request #3920 from marcosgdf/fr-3768
NEW Deprecated Product::setPriceExpression. Use Product::update instead
This commit is contained in:
commit
b723ca7d16
@ -717,6 +717,7 @@ class Product extends CommonObject
|
|||||||
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
|
$sql.= ", desiredstock = " . ((isset($this->desiredstock) && $this->desiredstock != '') ? $this->desiredstock : "null");
|
||||||
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
$sql.= ", fk_unit= " . (!$this->fk_unit ? 'NULL' : $this->fk_unit);
|
||||||
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);
|
$sql.= ", price_autogen = " . (!$this->price_autogen ? 0 : 1);
|
||||||
|
$sql.= ", fk_price_expression = ".($this->fk_price_expression != 0 ? $this->fk_price_expression : 'NULL');
|
||||||
$sql.= " WHERE rowid = " . $id;
|
$sql.= " WHERE rowid = " . $id;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||||
@ -1495,33 +1496,15 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param int $expression_id Expression
|
* @param int $expression_id Expression
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
|
* @deprecated Use Product::update instead
|
||||||
*/
|
*/
|
||||||
function setPriceExpression($expression_id)
|
function setPriceExpression($expression_id)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $user;
|
||||||
|
|
||||||
// Clean parameters
|
$this->fk_price_expression = $expression_id;
|
||||||
$this->db->begin();
|
|
||||||
$expression_id = $expression_id != 0 ? $expression_id : 'NULL';
|
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product";
|
return $this->update($this->id, $user);
|
||||||
$sql.= " SET fk_price_expression = ".$expression_id;
|
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::setPriceExpression", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error()." sql=".$sql;
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user