When you create an "commande" from a "propal" lost $object->origin and $object->origin_id in hook
This commit is contained in:
parent
a7795f25fc
commit
eba0fa1b96
@ -354,7 +354,7 @@ if (empty($reshook))
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit);
|
||||
$result = $object->addline($desc, $lines[$i]->subprice, $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, $lines[$i]->fk_product, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code,$object->origin, $lines[$i]->rowid, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options, $lines[$i]->fk_unit);
|
||||
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
@ -834,8 +834,8 @@ if (empty($reshook))
|
||||
|
||||
// Add buying price
|
||||
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
|
||||
|
||||
// Extrafields Lines
|
||||
$extrafieldsline = new ExtraFields($db);
|
||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||
@ -1166,9 +1166,9 @@ if (empty($reshook))
|
||||
|
||||
|
||||
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
if (! $error && ! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->commande->creer)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
|
||||
@ -1189,7 +1189,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// bascule du statut d'un contact
|
||||
else if ($action == 'swapstatut')
|
||||
else if ($action == 'swapstatut')
|
||||
{
|
||||
if ($object->id > 0) {
|
||||
$result = $object->swapContactStatus(GETPOST('ligne'));
|
||||
@ -1199,7 +1199,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Efface un contact
|
||||
else if ($action == 'deletecontact')
|
||||
else if ($action == 'deletecontact')
|
||||
{
|
||||
$result = $object->delete_contact($lineid);
|
||||
|
||||
@ -1433,7 +1433,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
@ -1996,7 +1996,7 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
|
||||
// TODO How record was recorded OrderMode (llx_c_input_method)
|
||||
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled))
|
||||
{
|
||||
|
||||
@ -953,7 +953,7 @@ class Commande extends CommonOrder
|
||||
$this->date_creation = '';
|
||||
$this->date_validation = '';
|
||||
$this->ref_client = '';
|
||||
|
||||
|
||||
// Create clone
|
||||
$result=$this->create($user);
|
||||
if ($result < 0) $error++;
|
||||
@ -1005,7 +1005,7 @@ class Commande extends CommonOrder
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
|
||||
$this->date_commande = dol_now();
|
||||
$this->source = 0;
|
||||
|
||||
@ -1150,7 +1150,7 @@ class Commande extends CommonOrder
|
||||
* par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit)
|
||||
* et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue)
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null)
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null)
|
||||
{
|
||||
global $mysoc, $conf, $langs;
|
||||
|
||||
@ -1269,6 +1269,8 @@ class Commande extends CommonOrder
|
||||
$this->line->total_ttc=$total_ttc;
|
||||
$this->line->product_type=$type;
|
||||
$this->line->special_code=$special_code;
|
||||
$this->line->origin=$origin;
|
||||
$this->line->origin_id=$origin_id;
|
||||
$this->line->fk_parent_line=$fk_parent_line;
|
||||
$this->line->fk_unit=$fk_unit;
|
||||
|
||||
@ -3508,7 +3510,7 @@ class OrderLine extends CommonOrderLine
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::insert rang=".$this->rang);
|
||||
|
||||
// Clean parameters
|
||||
@ -3528,7 +3530,7 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
@ -3643,7 +3645,7 @@ class OrderLine extends CommonOrderLine
|
||||
$error=0;
|
||||
|
||||
$pa_ht_isemptystring = (empty($this->pa_ht) && $this->pa_ht == ''); // If true, we can use a default value. If this->pa_ht = '0', we must use '0'.
|
||||
|
||||
|
||||
// Clean parameters
|
||||
if (empty($this->tva_tx)) $this->tva_tx=0;
|
||||
if (empty($this->localtax1_tx)) $this->localtax1_tx=0;
|
||||
@ -3664,7 +3666,7 @@ class OrderLine extends CommonOrderLine
|
||||
if (empty($this->pa_ht)) $this->pa_ht=0;
|
||||
|
||||
// if buy price not defined, define buyprice as configured in margin admin
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
if ($this->pa_ht == 0 && $pa_ht_isemptystring)
|
||||
{
|
||||
if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user