Fix: do not uptate total with special product line
This commit is contained in:
parent
72b863fb88
commit
8267dbd084
@ -400,7 +400,7 @@ class Propal extends CommonObject
|
|||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Mise a jour informations denormalisees au niveau de la propale meme
|
// Mise a jour informations denormalisees au niveau de la propale meme
|
||||||
$result=$this->update_price();
|
$result=$this->update_price(1);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -500,7 +500,7 @@ class Propal extends CommonObject
|
|||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$this->update_price();
|
$this->update_price(1);
|
||||||
|
|
||||||
$this->fk_propal = $this->id;
|
$this->fk_propal = $this->id;
|
||||||
$this->rowid = $rowid;
|
$this->rowid = $rowid;
|
||||||
@ -546,7 +546,7 @@ class Propal extends CommonObject
|
|||||||
|
|
||||||
if ($line->delete($lineid))
|
if ($line->delete($lineid))
|
||||||
{
|
{
|
||||||
$this->update_price();
|
$this->update_price(1);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -978,10 +978,11 @@ class CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
|
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
|
||||||
* @return int <0 if KO, >0 if OK
|
* @param exclspec Exclude special product (product_type=9)
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function update_price()
|
function update_price($exclspec=0)
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||||
|
|
||||||
@ -1000,6 +1001,7 @@ class CommonObject
|
|||||||
$sql = 'SELECT qty, total_ht, '.$fieldtva.' as total_tva, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2, total_ttc';
|
$sql = 'SELECT qty, total_ht, '.$fieldtva.' as total_tva, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2, total_ttc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
$sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
|
||||||
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
|
||||||
|
if ($exclspec) $sql.= ' AND product_type <> 9';
|
||||||
|
|
||||||
dol_syslog("CommonObject::update_price sql=".$sql);
|
dol_syslog("CommonObject::update_price sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user