From ba2ac301073a16edada6c19e3c73c8bfe7541b89 Mon Sep 17 00:00:00 2001 From: dono <81382225+donowr@users.noreply.github.com> Date: Sat, 1 Jun 2024 01:25:44 +0200 Subject: [PATCH] Fix remise all lines all doc (#29770) * concatenation of the VAT CODE with the VAT using the $object->updateline function * added a condition to concatenate the VAT CODE with the VAT using the command ->update * added a condition to concatenate the VAT CODE with the VAT using the command ->update * added a condition to concatenate the VAT CODE with the VAT using the command ->update --- htdocs/comm/propal/card.php | 6 +++++- htdocs/commande/card.php | 6 +++++- htdocs/compta/facture/card.php | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d2c4eefb228..d4e8f7d494d 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -968,7 +968,11 @@ if (empty($reshook)) { $remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); $remise_percent = str_replace('*', '', $remise_percent); foreach ($object->lines as $line) { - $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $tvatx= $line->tva_tx; + if (!empty($line->vat_src_code)) { + $tvatx .= ' ('.$line->vat_src_code.')'; + } + $result = $object->updateline($line->id, $line->subprice, $line->qty, $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } } elseif ($action == 'addline' && GETPOST('submitforallmargins', 'alpha') && GETPOST('marginforalllines') !== '' && $usercancreate) { // Define margin diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 566d3e4cddb..d26f484d7b3 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -682,7 +682,11 @@ if (empty($reshook)) { $remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); $remise_percent = str_replace('*', '', $remise_percent); foreach ($object->lines as $line) { - $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); + $tvatx= $line->tva_tx; + if (!empty($line->vat_src_code)) { + $tvatx .= ' ('.$line->vat_src_code.')'; + } + $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $tvatx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->date_start, $line->date_end, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); } } elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && $usercancreate) { // Add a new line $langs->load('errors'); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c1f5d857ecb..42c6d3bea40 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2107,7 +2107,11 @@ if (empty($reshook)) { $remise_percent = (GETPOST('remiseforalllines') ? GETPOST('remiseforalllines') : 0); $remise_percent = str_replace('*', '', $remise_percent); foreach ($object->lines as $line) { - $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice); + $tvatx= $line->tva_tx; + if (!empty($line->vat_src_code)) { + $tvatx .= ' ('.$line->vat_src_code.')'; + } + $result = $object->updateline($line->id, $line->desc, $line->subprice, $line->qty, $remise_percent, $line->date_start, $line->date_end, $tvatx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit, $line->multicurrency_subprice); } } elseif ($action == 'addline' && !GETPOST('submitforalllines', 'alpha') && !GETPOST('submitforallmargins', 'alpha') && $usercancreate) { // Add a new line $langs->load('errors');