From 11021353da7da3d57bd347a9fbc1e539c62934ce Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Jul 2018 11:33:33 +0200 Subject: [PATCH] Fix text in payment area of crabe pdf --- htdocs/compta/facture/card.php | 2 +- htdocs/core/class/commoninvoice.class.php | 2 +- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 10 ++++++---- htdocs/langs/en_US/bills.lang | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e846b47cb4ea8..1d22d21d574fd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4376,7 +4376,7 @@ function js_recalculate_revenuestamp(){ if ($objectidnext) { print '
' . $langs->trans('DoPayment') . '
'; } else { - //if ($resteapayer == 0) { + //if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done) // print '
' . $langs->trans('DoPayment') . '
'; //} else { print '
' . $langs->trans('DoPayment') . '
'; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index ac5d3869a3dec..af9d694e5e6a3 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -173,7 +173,7 @@ function getSumDepositsUsed($multicurrency=0) } /** - * Return amount (with tax) of all credit notes and deposits invoices used by invoice + * Return amount (with tax) of all credit notes invoices + excess received used by invoice * * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 8050abf811b23..8b316e29dca71 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -780,7 +780,7 @@ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) $pdf->SetFont('','', $default_font_size - 4); - // Loop on each deposits and credit notes included + // Loop on each discount available (deposits and credit notes and excess of payment included) $sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,"; $sql.= " re.description, re.fk_facture_source,"; $sql.= " f.type, f.datef"; @@ -799,6 +799,7 @@ function _tableau_versements(&$pdf, $object, $posy, $outputlangs) if ($obj->type == 2) $text=$outputlangs->trans("CreditNote"); elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit"); + elseif ($obj->type == 0) $text=$outputlangs->trans("ExcessReceived"); else $text=$outputlangs->trans("UnknownType"); $invoice->fetch($obj->fk_facture_source); @@ -1289,7 +1290,7 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) $pdf->SetTextColor(0,0,0); - $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); + $creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received $depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); //print "x".$creditnoteamount."-".$depositsamount;exit; $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); @@ -1307,9 +1308,10 @@ function _tableau_tot(&$pdf, $object, $deja_regle, $posy, $outputlangs) // Credit note if ($creditnoteamount) { + $labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes"); $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0); + $pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0); } @@ -1688,7 +1690,7 @@ function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { $top_shift = $pdf->getY() - $current_y; } - + if ($showaddress) { // Sender properties diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 3e5aaca519826..1bcebb8c890c2 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -279,6 +279,7 @@ RelativeDiscount=Relative discount GlobalDiscount=Global discount CreditNote=Credit note CreditNotes=Credit notes +CreditNotesOrExcessReceived=Credit notes or excess received Deposit=Down payment Deposits=Down payments DiscountFromCreditNote=Discount from credit note %s