From fe62808595d69b91720bad80404e1c834f755b90 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Tue, 5 Oct 2021 12:37:29 +0200 Subject: [PATCH] NEW: deposit payment terms: hidden conf to detail lines imported from origin --- htdocs/compta/facture/class/facture.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index a0c0b8288da..9c40ca4107f 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1516,6 +1516,7 @@ class Facture extends CommonInvoice $amount_ttc_diff = 0; $amountdeposit = array(); + $descriptions = array(); if (! empty($conf->global->MAIN_DEPOSIT_MULTI_TVA)) { $amount = $origin->total_ttc * ($origin->deposit_percent / 100); @@ -1526,6 +1527,10 @@ class Facture extends CommonInvoice continue; } $TTotalByTva[$line->tva_tx] += $line->total_ttc; + $descriptions[$line->tva_tx] .= '
  • ' . (! empty($line->product_ref) ? $line->product_ref . ' - ' : ''); + $descriptions[$line->tva_tx] .= (! empty($line->product_label) ? $line->product_label . ' - ' : ''); + $descriptions[$line->tva_tx] .= $langs->trans('Qty') . ' : ' . $line->qty; + $descriptions[$line->tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($line->total_ht) . '
  • '; } foreach ($TTotalByTva as $tva => &$total) { @@ -1549,6 +1554,10 @@ class Facture extends CommonInvoice $totalamount += $lines[$i]->total_ht; // Fixme : is it not for the customer ? Shouldn't we take total_ttc ? $tva_tx = $lines[$i]->tva_tx; $amountdeposit[$tva_tx] += ($lines[$i]->total_ht * $origin->deposit_percent) / 100; + $descriptions[$tva_tx] .= '
  • ' . (! empty($lines[$i]->product_ref) ? $lines[$i]->product_ref . ' - ' : ''); + $descriptions[$tva_tx] .= (! empty($lines[$i]->product_label) ? $lines[$i]->product_label . ' - ' : ''); + $descriptions[$tva_tx] .= $langs->trans('Qty') . ' : ' . $lines[$i]->qty; + $descriptions[$tva_tx] .= ' - ' . $langs->trans('TotalHT') . ' : ' . price($lines[$i]->total_ht) . '
  • '; } if ($totalamount == 0) { @@ -1565,6 +1574,11 @@ class Facture extends CommonInvoice $descline = '(DEPOSIT) ('. $origin->deposit_percent .'%) - '.$origin->ref; + // Hidden conf + if (! empty($conf->global->INVOICE_DEPOSIT_DETAIL_LINES_IN_DESCRIPTION) && ! empty($descriptions[$tva])) { + $descline .= ''; + } + $addlineResult = $deposit->addline( $descline, $amount, // subprice