Dolibarr ERP & CRM » Bugs » bug #1855 ODT Templates - conditional substitution failureDernières modifications
Répondre
État Détails |
Last Modified On: | 06/03/2015 10:12 | | Submitted by: | Manuel Pintor (m.pintor) |
Submitted on: | 17/02/2015 18:27 | |
Summary: | ODT Templates - conditional substitution failure |
Description: | Conditional substitution as described in the Wiki (http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template#Conditional_substitution) is not working.
For example, in a invoice template I placed in the header area :
[!-- IF {object_source_invoice_ref} --] Réf. devis : {object_source_invoice_ref} [!-- ENDIF --]
I expect the source invoice reference to be printed in case it exists, or nothing if not.
I see on the generated ODT while no source invoice reference exists :
[!-- IF --]
Réf. devis : [!-- ENDIF --]
I should see nothing, definitely not any code.
This has been described in french 8 month ago here : http://www.dolibarr.fr/forum/527-bugs-sur-la-version-stable-courante/50638-modeles-odt-plusieurs-problemes
A solution has also been proposed to devs in the same thread. |
Step to reproduce bug: | |
Detected in version: | 3.6.2 | | Category: | Other |
Severity: | 5 - Major | | OS Type/Version: | |
PHP version: | | | Database type and version: | |
Etat |
Status: | Need more info | | Assigned to: | Marcos García (marcosgdf) |
Resolution: | Works for me | |
Commentaires- Jurij Acalinovic 06/03/2015 15:22
- Hello Marcos,
First of all, many thanks for your work and answers.
It works fine in 3.6.3 but not when a table is the result.
The purpose is to show a table with a "Discount" column when at least a product has a disount and another table without "Discount" column when all products have not discount.
I used {object_total_discount_ht} variable to test:
[!-- IF {object_total_discount_ht} --]
TABLE with "Discount" column
[!-- ELSE {object_total_discount_ht} --]
TABLE without "Discount" column
[!-- ENDIF {object_total_discount_ht} --]
When at least one product has discount, the right table is used, but only the first line is showed.
When all products have not discount, the right table is used, but it is showed more then one time with this:
[!-- ELSE 0 --]
Complete description (in french) and examples files there: http://www.dolibarr.fr/forum/527-bugs-sur-la-version-stable-courante/50638-modeles-odt-plusieurs-problemes#58243
Example files here: labo.microfly.info/DEVIS-TEST.zip
with files:
DEVIS-TEST-MODELE.odt : model file
DEVIS-TEST-1.odt: product 1 with discount, product 2 without discount
DEVIS-TEST-2.odt: product 1 without discount, product 2 with discount
DEVIS-TEST-3.odt: product 1 and product 2 without discount
DEVIS-TEST-4.odt: product 1 and product 2 with discount
Thanks and regards.
Jurij - Marcos García 06/03/2015 10:12
- Tested in 3.6.3 and it works fine.
Remember to clean the format of IF and ENDIF tags or they won't get recognized |
|
First of all, many thanks for your work and answers.
It works fine in 3.6.3 but not when a table is the result.
The purpose is to show a table with a "Discount" column when at least a product has a disount and another table without "Discount" column when all products have not discount.
I used {object_total_discount_ht} variable to test:
[!-- IF {object_total_discount_ht} --]
TABLE with "Discount" column
[!-- ELSE {object_total_discount_ht} --]
TABLE without "Discount" column
[!-- ENDIF {object_total_discount_ht} --]
When at least one product has discount, the right table is used, but only the first line is showed.
When all products have not discount, the right table is used, but it is showed more then one time with this:
[!-- ELSE 0 --]
Complete description (in french) and examples files there: http://www.dolibarr.fr/forum/527-bugs-sur-la-version-stable-courante/50638-modeles-odt-plusieurs-problemes#58243
Example files here: labo.microfly.info/DEVIS-TEST.zip
with files:
DEVIS-TEST-MODELE.odt : model file
DEVIS-TEST-1.odt: product 1 with discount, product 2 without discount
DEVIS-TEST-2.odt: product 1 without discount, product 2 with discount
DEVIS-TEST-3.odt: product 1 and product 2 without discount
DEVIS-TEST-4.odt: product 1 and product 2 with discount
Thanks and regards.
Jurij