Dolibarr: Deposit invoice line description does not use third-party language

Created on 9 Mar 2017  Â·  7Comments  Â·  Source: Dolibarr/dolibarr

Bug

After setting a proposal 'Signed (needs billing)', I generate a deposit invoice.

The Description used for the deposit invoice is in the language of the Dolibarr user, not in the language of the third-party.

Environment

  • Version: (4.0.4 and) 5.0.0 (online demo)
  • OS, Web server, PHP, Database: online demo
  • URL(s): comm/propal/card.php -> compta/facture.php?action=create&origin=propal&originid=...&socid=...

Expected and actual behaviour

When a deposit invoice is generated, the invoice line description is in the language of the Dolibarr user display, not in the language of the third-party.

I would expect that the invoice line description uses the translated string (bills.lang "Deposit") according to the language preference set for the third-party.

Steps to reproduce the behaviour

  • Generate a commercial proposal for a customer.
  • The customer accepts the proposal and the proposal is set 'Signed (needs billing)' (Set accepted/refused, comm/propal/card.php?id=...&action=statut).
  • Create invoice, using the 'Create invoice or credit note' button (compta/facture.php?action=create&origin=propal&originid=...&socid=...).
  • Select Type: Deposit invoice, fill required fields and click 'Create draft'.
  • Notice that the draft deposit invoice line description is not in the language of the third-party.
Bug

Most helpful comment

You're right, I thought has been done but it's not.
The right way would be to store (DEPOSIT) in the databe and to translate it on the screen and in the PDF according to the language needed (user language on interface or selected PDF language during generation).

All 7 comments

It is necessary to define the output language before adding the line to the deposit invoice and changing two occurrances of $langs to $outputlangs. I have made changes locally to compta/facture.php around line 1061, which fixes this issue for me – diff attached.

Dolibarr-4.0.4_facture.php_deposit-translate.diff.txt

I don't know if this is a robust solution, but it works for me.

This is still a problem in 6.0.2, but my local fix is broken.

compta/facture/card.php (lines 1131 & 1154) uses the display language for a Deposit Invoice line, instead of the Third-party output language.

Too old version, please upgrade and reopen if needed.
Now the deposit line contains "(DEPOSIT)" which should be correctly translated. Can you check ?

Please reopen this issue - it is still evident in v9.0.3 (and v10.x I think, but I cannot test).

htdocs/compta/facture/card.php, line 1322 still uses $langs->trans('Deposit'), which gives the Display language. It is necessary to define the output language according to the Third-party setting and then use $outputlangs->trans('Deposit').

You're right, I thought has been done but it's not.
The right way would be to store (DEPOSIT) in the databe and to translate it on the screen and in the PDF according to the language needed (user language on interface or selected PDF language during generation).

Thanks.

For the purposes of the deposit invoice document, if the deposit line is treated as a normal invoice line, where Label = (Deposit) and Description = (the other text – deposit amount or %, Proposal reference), it could be handled the same as any other invoice line and the existing translation mechanism would work. (Document generation only translates descriptions that have not been changed from the Product or Service card.)

Hi. I pushed a fix, waiting to be merged. Note that this fix will only apply for future deposits, past ones already in database won't be translatable

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sam-anam1 picture sam-anam1  Â·  4Comments

low5 picture low5  Â·  4Comments

jsbrassard picture jsbrassard  Â·  4Comments

OrenSavichWS picture OrenSavichWS  Â·  3Comments

asolslk picture asolslk  Â·  4Comments