FIX Locatax were not propagated when cloning order or proposal

This commit is contained in:
Laurent Destailleur 2017-11-13 13:07:31 +01:00
parent 05683bbf61
commit 1a5bbef266
3 changed files with 26 additions and 15 deletions

View File

@ -371,12 +371,12 @@ class Propal extends CommonObject
* by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product) * by whose calling the method get_default_tva (societe_vendeuse, societe_acheteuse, '' product)
* and desc must already have the right value (it's up to the caller to manage multilanguage) * and desc must already have the right value (it's up to the caller to manage multilanguage)
* *
* @param string $desc Description de la ligne * @param string $desc Description of line
* @param float $pu_ht Prix unitaire * @param float $pu_ht Unit price
* @param float $qty Quantite * @param float $qty Quantity
* @param float $txtva Taux de tva * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id du produit/service predefini * @param int $fk_product Id du produit/service predefini
* @param float $remise_percent Pourcentage de remise de la ligne * @param float $remise_percent Pourcentage de remise de la ligne
* @param string $price_base_type HT or TTC * @param string $price_base_type HT or TTC
@ -1018,11 +1018,15 @@ class Propal extends CommonObject
$fk_parent_line = 0; $fk_parent_line = 0;
} }
// Complete vat rate with code
$vatrate = $this->lines[$i]->tva_tx;
if ($this->lines[$i]->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$this->lines[$i]->vat_src_code.')';
$result = $this->addline( $result = $this->addline(
$this->lines[$i]->desc, $this->lines[$i]->desc,
$this->lines[$i]->subprice, $this->lines[$i]->subprice,
$this->lines[$i]->qty, $this->lines[$i]->qty,
$this->lines[$i]->tva_tx, $vatrate,
$this->lines[$i]->localtax1_tx, $this->lines[$i]->localtax1_tx,
$this->lines[$i]->localtax2_tx, $this->lines[$i]->localtax2_tx,
$this->lines[$i]->fk_product, $this->lines[$i]->fk_product,
@ -1227,7 +1231,6 @@ class Propal extends CommonObject
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = ''; if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';
// Create clone // Create clone
$result=$clonedObj->create($user); $result=$clonedObj->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;
else else

View File

@ -821,11 +821,15 @@ class Commande extends CommonOrder
$fk_parent_line = 0; $fk_parent_line = 0;
} }
// Complete vat rate with code
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
$result = $this->addline( $result = $this->addline(
$line->desc, $line->desc,
$line->subprice, $line->subprice,
$line->qty, $line->qty,
$line->tva_tx, $vatrate,
$line->localtax1_tx, $line->localtax1_tx,
$line->localtax2_tx, $line->localtax2_tx,
$line->fk_product, $line->fk_product,
@ -1211,9 +1215,9 @@ class Commande extends CommonOrder
* @param string $desc Description of line * @param string $desc Description of line
* @param float $pu_ht Unit price (without tax) * @param float $pu_ht Unit price (without tax)
* @param float $qty Quantite * @param float $qty Quantite
* @param float $txtva Taux de tva force, sinon -1 * @param float $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param float $txlocaltax1 Local tax 1 rate * @param float $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param float $txlocaltax2 Local tax 2 rate * @param float $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id of product * @param int $fk_product Id of product
* @param float $remise_percent Pourcentage de remise de la ligne * @param float $remise_percent Pourcentage de remise de la ligne
* @param int $info_bits Bits de type de lignes * @param int $info_bits Bits de type de lignes

View File

@ -575,11 +575,15 @@ class Facture extends CommonInvoice
$fk_parent_line = 0; $fk_parent_line = 0;
} }
// Complete vat rate with code
$vatrate = $line->tva_tx;
if ($line->vat_src_code && ! preg_match('/\(.*\)/', $vatrate)) $vatrate.=' ('.$line->vat_src_code.')';
$result = $this->addline( $result = $this->addline(
$line->desc, $line->desc,
$line->subprice, $line->subprice,
$line->qty, $line->qty,
$line->tva_tx, $vatrate,
$line->localtax1_tx, $line->localtax1_tx,
$line->localtax2_tx, $line->localtax2_tx,
$line->fk_product, $line->fk_product,
@ -2427,8 +2431,8 @@ class Facture extends CommonInvoice
* @param double $pu_ht Unit price without tax (> 0 even for credit note) * @param double $pu_ht Unit price without tax (> 0 even for credit note)
* @param double $qty Quantity * @param double $qty Quantity
* @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)') * @param double $txtva Force Vat rate, -1 for auto (Can contain the vat_src_code too with syntax '9.9 (CODE)')
* @param double $txlocaltax1 Local tax 1 rate (deprecated) * @param double $txlocaltax1 Local tax 1 rate (deprecated, use instead txtva with code inside)
* @param double $txlocaltax2 Local tax 2 rate (deprecated) * @param double $txlocaltax2 Local tax 2 rate (deprecated, use instead txtva with code inside)
* @param int $fk_product Id of predefined product/service * @param int $fk_product Id of predefined product/service
* @param double $remise_percent Percent of discount on line * @param double $remise_percent Percent of discount on line
* @param int $date_start Date start of service * @param int $date_start Date start of service