Fix: do not uptate total with special product line

This commit is contained in:
Regis Houssin 2011-04-07 12:32:29 +00:00
parent 72b863fb88
commit 8267dbd084
2 changed files with 8 additions and 6 deletions

View File

@ -400,7 +400,7 @@ class Propal extends CommonObject
if ($result > 0)
{
// Mise a jour informations denormalisees au niveau de la propale meme
$result=$this->update_price();
$result=$this->update_price(1);
if ($result > 0)
{
$this->db->commit();
@ -500,7 +500,7 @@ class Propal extends CommonObject
$result=$this->db->query($sql);
if ($result > 0)
{
$this->update_price();
$this->update_price(1);
$this->fk_propal = $this->id;
$this->rowid = $rowid;
@ -546,7 +546,7 @@ class Propal extends CommonObject
if ($line->delete($lineid))
{
$this->update_price();
$this->update_price(1);
return 1;
}

View File

@ -978,10 +978,11 @@ class CommonObject
}
/**
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
* @return int <0 if KO, >0 if OK
* Update total_ht, total_ttc and total_vat for an object (sum of lines)
* @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');
@ -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.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line;
$sql.= ' WHERE '.$this->fk_element.' = '.$this->id;
if ($exclspec) $sql.= ' AND product_type <> 9';
dol_syslog("CommonObject::update_price sql=".$sql);
$resql = $this->db->query($sql);