forked from Wavyzz/dolibarr
Merge pull request #13250 from FHenry/dev_fix_createLineWithCOrrectLink
NEW : special option MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION to store in document line created form other documents lines the id of original lines and origin class line rather than origin object id and origin object type
This commit is contained in:
@@ -1016,6 +1016,14 @@ class Commande extends CommonOrder
|
||||
$vatrate = $line->tva_tx;
|
||||
if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')';
|
||||
|
||||
if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) {
|
||||
$originid=$line->origin_id;
|
||||
$origintype=$line->origin;
|
||||
} else {
|
||||
$originid=$line->id;
|
||||
$origintype=$this->element;
|
||||
}
|
||||
|
||||
$result = $this->addline(
|
||||
$line->desc,
|
||||
$line->subprice,
|
||||
@@ -1040,8 +1048,8 @@ class Commande extends CommonOrder
|
||||
$line->label,
|
||||
$line->array_options,
|
||||
$line->fk_unit,
|
||||
$this->element,
|
||||
$line->id
|
||||
$origintype,
|
||||
$originid
|
||||
);
|
||||
if ($result < 0)
|
||||
{
|
||||
@@ -1444,8 +1452,8 @@ class Commande extends CommonOrder
|
||||
* @param string $label Label
|
||||
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||
* @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
|
||||
* @param string $origin Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be 'orderdet', 'propaldet'..., else 'order','propal,'....
|
||||
* @param int $origin_id Depend on global conf MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION can be Id of origin object (aka line id), else object id
|
||||
* @param double $pu_ht_devise Unit price in currency
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user