Merge pull request #3907 from olsesacl/develop-fix
Maintain origin_id and origin for copy document
This commit is contained in:
commit
75c0331b38
@ -375,13 +375,15 @@ class Propal extends CommonObject
|
||||
* @param int $date_end End date of the line
|
||||
* @param array $array_options extrafields array
|
||||
* @param string $fk_unit Code of the unit to use. Null to use the default one
|
||||
* @param string $origin 'order', ...
|
||||
* @param int $origin_id Id of origin object
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
* @see add_product
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0)
|
||||
{
|
||||
global $mysoc;
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
dol_syslog(get_class($this)."::addline propalid=$this->id, desc=$desc, pu_ht=$pu_ht, qty=$qty, txtva=$txtva, fk_product=$fk_product, remise_except=$remise_percent, price_base_type=$price_base_type, pu_ttc=$pu_ttc, info_bits=$info_bits, type=$type");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
@ -499,6 +501,9 @@ class Propal extends CommonObject
|
||||
$this->line->fk_fournprice = $fk_fournprice;
|
||||
$this->line->pa_ht = $pa_ht;
|
||||
|
||||
$this->line->origin_id = $origin_id;
|
||||
$this->line->origin = $origin;
|
||||
|
||||
// Mise en option de la ligne
|
||||
if (empty($qty) && empty($special_code)) $this->line->special_code=3;
|
||||
|
||||
@ -570,7 +575,8 @@ class Propal extends CommonObject
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent, txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$a_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||
dol_syslog(get_class($this)."::updateLine rowid=$rowid, pu=$pu, qty=$qty, remise_percent=$remise_percent,
|
||||
txtva=$txtva, desc=$desc, price_base_type=$price_base_type, info_bits=$info_bits, special_code=$special_code, fk_parent_line=$fk_parent_line, pa_ht=$pa_ht, type=$type, date_start=$date_start, date_end=$date_end");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||
|
||||
// Clean parameters
|
||||
@ -894,7 +900,9 @@ class Propal extends CommonObject
|
||||
$this->lines[$i]->date_start,
|
||||
$this->lines[$i]->date_end,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->fk_unit
|
||||
$this->lines[$i]->fk_unit,
|
||||
$this->element,
|
||||
$this->lines[$i]->id
|
||||
);
|
||||
|
||||
if ($result < 0)
|
||||
@ -1384,7 +1392,10 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function update_extrafields($user)
|
||||
{
|
||||
global $conf, $hookmanager;
|
||||
|
||||
$action='update';
|
||||
$error = 0;
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
@ -2717,7 +2728,7 @@ class Propal extends CommonObject
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='', $get_params='')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
$result='';
|
||||
$label = '<u>' . $langs->trans("ShowPropal") . '</u>';
|
||||
|
||||
@ -777,7 +777,9 @@ class Commande extends CommonOrder
|
||||
$this->lines[$i]->pa_ht,
|
||||
$this->lines[$i]->label,
|
||||
$this->lines[$i]->array_options,
|
||||
$this->lines[$i]->fk_unit
|
||||
$this->lines[$i]->fk_unit,
|
||||
$this->element,
|
||||
$this->lines[$i]->id
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
@ -2322,6 +2324,7 @@ class Commande extends CommonOrder
|
||||
function classifyBilled()
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
$error = 0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
@ -2636,6 +2639,7 @@ class Commande extends CommonOrder
|
||||
global $hookmanager, $conf;
|
||||
|
||||
$action='create';
|
||||
$error = 0;
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
// TODO le hook fait double emploi avec le trigger !!
|
||||
@ -2872,7 +2876,7 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
function LibStatut($statut,$billed,$mode)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
//print 'x'.$statut.'-'.$billed;
|
||||
if ($mode == 0)
|
||||
{
|
||||
|
||||
@ -385,6 +385,8 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
$newinvoiceline=$this->lines[$i];
|
||||
$newinvoiceline->fk_facture=$this->id;
|
||||
$newinvoiceline->origin = $this->element;
|
||||
$newinvoiceline->origin_id = $this->lines[$i]->id;
|
||||
if ($result >= 0 && ($newinvoiceline->info_bits & 0x01) == 0) // We keep only lines with first bit = 0
|
||||
{
|
||||
// Reset fk_parent_line for no child products and special product
|
||||
@ -441,8 +443,8 @@ class Facture extends CommonInvoice
|
||||
$this->lines[$i]->product_type,
|
||||
$this->lines[$i]->rang,
|
||||
$this->lines[$i]->special_code,
|
||||
'',
|
||||
0,
|
||||
$this->element,
|
||||
$this->lines[$i]->id,
|
||||
$fk_parent_line,
|
||||
$this->lines[$i]->fk_fournprice,
|
||||
$this->lines[$i]->pa_ht,
|
||||
@ -873,7 +875,7 @@ class Facture extends CommonInvoice
|
||||
*/
|
||||
function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
|
||||
$result='';
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user