Fix: possibility to skip update total of special lines with no qty and unit price
This commit is contained in:
parent
bd8e0e88a5
commit
7b73576731
@ -442,7 +442,7 @@ class Propal extends CommonObject
|
|||||||
* \param info_bits Miscellanous informations
|
* \param info_bits Miscellanous informations
|
||||||
* \return int 0 en cas de succes
|
* \return int 0 en cas de succes
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0)
|
function updateline($rowid, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0, $txlocaltax2=0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0)
|
||||||
{
|
{
|
||||||
global $conf,$user,$langs;
|
global $conf,$user,$langs;
|
||||||
|
|
||||||
@ -504,6 +504,7 @@ class Propal extends CommonObject
|
|||||||
$this->line->total_ttc=$total_ttc;
|
$this->line->total_ttc=$total_ttc;
|
||||||
$this->line->special_code=$special_code;
|
$this->line->special_code=$special_code;
|
||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
|
$this->line->skip_update_total=$skip_update_total;
|
||||||
|
|
||||||
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
|
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
|
||||||
|
|
||||||
@ -2329,7 +2330,7 @@ class PropaleLigne
|
|||||||
var $total_localtax1;
|
var $total_localtax1;
|
||||||
var $total_localtax2;
|
var $total_localtax2;
|
||||||
|
|
||||||
|
var $skip_update_total; // Skip update price total for special lines
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur d'objets ligne de propal
|
* \brief Constructeur d'objets ligne de propal
|
||||||
@ -2552,9 +2553,12 @@ class PropaleLigne
|
|||||||
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
||||||
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
||||||
$sql.= " , info_bits='".$this->info_bits."'";
|
$sql.= " , info_bits='".$this->info_bits."'";
|
||||||
|
if (empty($this->skip_update_total))
|
||||||
|
{
|
||||||
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
||||||
$sql.= " , total_tva=".price2num($this->total_tva)."";
|
$sql.= " , total_tva=".price2num($this->total_tva)."";
|
||||||
$sql.= " , total_ttc=".price2num($this->total_ttc)."";
|
$sql.= " , total_ttc=".price2num($this->total_ttc)."";
|
||||||
|
}
|
||||||
$sql.= " , marge_tx='".$this->marge_tx."'";
|
$sql.= " , marge_tx='".$this->marge_tx."'";
|
||||||
$sql.= " , marque_tx='".$this->marque_tx."'";
|
$sql.= " , marque_tx='".$this->marque_tx."'";
|
||||||
$sql.= " , info_bits=".$this->info_bits;
|
$sql.= " , info_bits=".$this->info_bits;
|
||||||
|
|||||||
@ -1943,7 +1943,7 @@ class Commande extends CommonObject
|
|||||||
* \param type Type of line (0=product, 1=service)
|
* \param type Type of line (0=product, 1=service)
|
||||||
* \return int < 0 si erreur, > 0 si ok
|
* \return int < 0 si erreur, > 0 si ok
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $txlocaltax1=0,$txlocaltax2=0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -2016,6 +2016,7 @@ class Commande extends CommonObject
|
|||||||
$this->line->date_end=$date_end;
|
$this->line->date_end=$date_end;
|
||||||
$this->line->product_type=$type;
|
$this->line->product_type=$type;
|
||||||
$this->line->fk_parent_line=$fk_parent_line;
|
$this->line->fk_parent_line=$fk_parent_line;
|
||||||
|
$this->line->skip_update_total=$skip_update_total;
|
||||||
|
|
||||||
// TODO deprecated
|
// TODO deprecated
|
||||||
$this->line->price=$price;
|
$this->line->price=$price;
|
||||||
@ -2592,6 +2593,8 @@ class OrderLine
|
|||||||
var $date_start;
|
var $date_start;
|
||||||
var $date_end;
|
var $date_end;
|
||||||
|
|
||||||
|
var $skip_update_total; // Skip update price total for special lines
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur d'objets ligne de commande
|
* \brief Constructeur d'objets ligne de commande
|
||||||
@ -2825,9 +2828,12 @@ class OrderLine
|
|||||||
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
$sql.= " , price=".price2num($this->price).""; // TODO A virer
|
||||||
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
$sql.= " , remise=".price2num($this->remise).""; // TODO A virer
|
||||||
$sql.= " , info_bits='".$this->info_bits."'";
|
$sql.= " , info_bits='".$this->info_bits."'";
|
||||||
|
if (empty($this->skip_update_total))
|
||||||
|
{
|
||||||
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
$sql.= " , total_ht=".price2num($this->total_ht)."";
|
||||||
$sql.= " , total_tva=".price2num($this->total_tva)."";
|
$sql.= " , total_tva=".price2num($this->total_tva)."";
|
||||||
$sql.= " , total_ttc=".price2num($this->total_ttc)."";
|
$sql.= " , total_ttc=".price2num($this->total_ttc)."";
|
||||||
|
}
|
||||||
$sql.= " , total_localtax1='".price2num($this->total_localtax1)."'";
|
$sql.= " , total_localtax1='".price2num($this->total_localtax1)."'";
|
||||||
$sql.= " , total_localtax2='".price2num($this->total_localtax2)."'";
|
$sql.= " , total_localtax2='".price2num($this->total_localtax2)."'";
|
||||||
$sql.= " , info_bits=".$this->info_bits;
|
$sql.= " , info_bits=".$this->info_bits;
|
||||||
|
|||||||
@ -1861,7 +1861,7 @@ class Facture extends CommonObject
|
|||||||
* @param type Type of line (0=product, 1=service)
|
* @param type Type of line (0=product, 1=service)
|
||||||
* @return int < 0 if KO, > 0 if OK
|
* @return int < 0 if KO, > 0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0,$price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0)
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0,$price_base_type='HT', $info_bits=0, $type=0, $fk_parent_line=0, $skip_update_total=0)
|
||||||
{
|
{
|
||||||
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
|
||||||
|
|
||||||
@ -1927,6 +1927,7 @@ class Facture extends CommonObject
|
|||||||
$this->line->info_bits = $info_bits;
|
$this->line->info_bits = $info_bits;
|
||||||
$this->line->product_type = $type;
|
$this->line->product_type = $type;
|
||||||
$this->line->fk_parent_line = $fk_parent_line;
|
$this->line->fk_parent_line = $fk_parent_line;
|
||||||
|
$this->line->skip_update_total = $skip_update_total;
|
||||||
|
|
||||||
// A ne plus utiliser
|
// A ne plus utiliser
|
||||||
$this->line->price=$price;
|
$this->line->price=$price;
|
||||||
@ -3143,6 +3144,8 @@ class FactureLigne
|
|||||||
var $product_label; // Product label
|
var $product_label; // Product label
|
||||||
var $product_desc; // Description produit
|
var $product_desc; // Description produit
|
||||||
|
|
||||||
|
var $skip_update_total; // Skip update price total for special lines
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Constructeur d'objets ligne de facture
|
* \brief Constructeur d'objets ligne de facture
|
||||||
@ -3281,11 +3284,14 @@ class FactureLigne
|
|||||||
$sql.= ' '.$this->rang.',';
|
$sql.= ' '.$this->rang.',';
|
||||||
$sql.= ' '.$this->special_code.',';
|
$sql.= ' '.$this->special_code.',';
|
||||||
$sql.= " '".$this->info_bits."',";
|
$sql.= " '".$this->info_bits."',";
|
||||||
|
if (empty($this->skip_update_total))
|
||||||
|
{
|
||||||
$sql.= " ".price2num($this->total_ht).",";
|
$sql.= " ".price2num($this->total_ht).",";
|
||||||
$sql.= " ".price2num($this->total_tva).",";
|
$sql.= " ".price2num($this->total_tva).",";
|
||||||
|
$sql.= " ".price2num($this->total_ttc);
|
||||||
|
}
|
||||||
$sql.= " ".price2num($this->total_localtax1).",";
|
$sql.= " ".price2num($this->total_localtax1).",";
|
||||||
$sql.= " ".price2num($this->total_localtax2).",";
|
$sql.= " ".price2num($this->total_localtax2).",";
|
||||||
$sql.= " ".price2num($this->total_ttc);
|
|
||||||
$sql.= ')';
|
$sql.= ')';
|
||||||
|
|
||||||
dol_syslog("FactureLigne::insert sql=".$sql);
|
dol_syslog("FactureLigne::insert sql=".$sql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user