FIX locataxes lost on lines when cloning a vendor invoice
This commit is contained in:
parent
e3126ec999
commit
573feed66f
@ -40,8 +40,8 @@
|
||||
* @param float $pu Unit price (HT or TTC selon price_base_type)
|
||||
* @param float $remise_percent_ligne Discount for line
|
||||
* @param float $txtva 0=do not apply VAT tax, VAT rate=apply (this is VAT rate only without text code, we don't need text code because we alreaydy have all tax info into $localtaxes_array)
|
||||
* @param float $uselocaltax1_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $uselocaltax2_rate 0=do not use this localtax, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $uselocaltax1_rate 0=do not use localtax1, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $uselocaltax2_rate 0=do not use localtax2, >0=apply and get value from localtaxes_array (or database if empty), -1=autodetect according to seller if we must apply, get value from localtaxes_array (or database if empty). Try to always use -1.
|
||||
* @param float $remise_percent_global 0
|
||||
* @param string $price_base_type HT=Unit price parameter is HT, TTC=Unit price parameter is TTC
|
||||
* @param int $info_bits Miscellaneous informations on line
|
||||
|
||||
@ -486,7 +486,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
$idligne,
|
||||
$this->lines[$i]->description,
|
||||
$this->lines[$i]->pu_ht,
|
||||
$this->lines[$i]->tva_tx,
|
||||
$this->lines[$i]->tva_tx.($this->lines[$i]->vat_src_code ? ' ('.$this->lines[$i]->vat_src_code.')' : ''),
|
||||
$this->lines[$i]->localtax1_tx,
|
||||
$this->lines[$i]->localtax2_tx,
|
||||
$this->lines[$i]->qty,
|
||||
@ -1945,6 +1945,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
|
||||
$localtaxes_type = getLocalTaxesFromRate($vatrate, 0, $mysoc, $this->thirdparty);
|
||||
|
||||
$reg = array();
|
||||
|
||||
// Clean vat code
|
||||
$vat_src_code = '';
|
||||
if (preg_match('/\((.*)\)/', $vatrate, $reg))
|
||||
@ -2648,6 +2650,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
$object->id = 0;
|
||||
$object->statut = self::STATUS_DRAFT;
|
||||
|
||||
$object->fetch_thirdparty(); // We need it to recalculate VAT localtaxes according to main sale taxes and vendor
|
||||
|
||||
// Clear fields
|
||||
$object->ref_supplier = (empty($this->ref_supplier) ? $langs->trans("CopyOf").' '.$object->ref_supplier : $this->ref_supplier);
|
||||
$object->author = $user->id;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2020 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005 Marc Barilley <marc@ocebo.fr>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@inodbox.com>
|
||||
|
||||
@ -2044,7 +2044,7 @@ else
|
||||
print '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
if ($conf->browser->layout == 'phone') print '</tr><tr>';
|
||||
print '</tr><tr>';
|
||||
print '<td>'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).'</td><td>';
|
||||
print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1);
|
||||
if (!isOnlyOneLocalTax(2))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user