-->
Welcome, Guest
Username: Password: Remember me
You can also tweak your setup of Dolibarr by setting hidden configurations found in Dolibarr Setup Other

TOPIC: IF condition ODT tags.

IF condition ODT tags. 7 months 4 weeks ago #36559

  • nazeer
  • nazeer's Avatar
  • OFFLINE
  • Expert
  • admin@cynergy.solutions
  • Posts: 147
  • Thank you received: 16
  • Karma: 5
Hi,
I would like to put conditional on payment terms to be displayed on invoice.

Scene :
In invoice if Bank reference = "xyz"
then print "pay to xyz bank"
else if bank refernce = "abc"
then print "pay to abc bank"
endif

Example: Wiki ODT document doesn't have clear picture.


Print this text if {my_var} is true (can be any value but null/0/empty string)

Or print this if it's false (null/0/empty string)


where does my_var comes from?
How to construct the if statement using my scene.
Thanks.
The administrator has disabled public write access.

IF condition ODT tags. 7 months 4 days ago #36850

  • nazeer
  • nazeer's Avatar
  • OFFLINE
  • Expert
  • admin@cynergy.solutions
  • Posts: 147
  • Thank you received: 16
  • Karma: 5
any update ?
The administrator has disabled public write access.

IF condition ODT tags. 7 months 4 days ago #36855

  • ksar
  • ksar's Avatar
  • OFFLINE
  • Moderator
  • Posts: 383
  • Thank you received: 99
  • Karma: 18
Hi,

my_var is usually and extrafields that you can add in each document.
The administrator has disabled public write access.

IF condition ODT tags. 7 months 3 days ago #36867

  • h6585
  • h6585's Avatar
  • OFFLINE
  • Senior
  • Posts: 50
  • Thank you received: 1
  • Karma: 2
What are the xyz and abc condition is it a reference to an object extrafield or a line extrafield.

The syntax in your case should be

[! - - IF {xyz} - - ]
{object_options_xyz}
[! - - ELSE {xyz} - - -]
{object_options_abc}
[! - - ENDIF {xyz} - - ]

Hope this helps
The administrator has disabled public write access.

IF condition ODT tags. 7 months 2 days ago #36871

  • nazeer
  • nazeer's Avatar
  • OFFLINE
  • Expert
  • admin@cynergy.solutions
  • Posts: 147
  • Thank you received: 16
  • Karma: 5
@h6585,

In my above quest,
xyz and abc are bank reference on invoice card.

we deal with multiple banks, so if user select bank reference as xyz, then bank details of xyz should be printed or if bank reference is abc, print abc bank details. this is the quest.

Please check the attached photo.


invoice.png


I want to use if statement to check bank account and display bank details according to the each selection.
thanks.
Last Edit: 7 months 2 days ago by nazeer.
The administrator has disabled public write access.

IF condition ODT tags. 7 months 2 days ago #36893

  • ksar
  • ksar's Avatar
  • OFFLINE
  • Moderator
  • Posts: 383
  • Thank you received: 99
  • Karma: 18
Hi,

You create a list that, as far as I know, it is incompatible with IF statement.
In IF statement of OTD you need fals or true information.
So better to create two check boxes and use the IF statement of h6585
The administrator has disabled public write access.

SOLVED - IF condition ODT tags. 7 months 1 day ago #36907

  • nazeer
  • nazeer's Avatar
  • OFFLINE
  • Expert
  • admin@cynergy.solutions
  • Posts: 147
  • Thank you received: 16
  • Karma: 5
This is what I did and solve on testing environment.. need to test on production environment.

I created 2 complimentary fields in Invoice -
invoice.jpg


and then in odt template i added this -
[!-- IF {object_options_bbank} --] 
Bank - 1
[!-- ELSE {object_options_bbank} --]
[!-- IF {object_options_cash} --]
Cash
[!-- ELSE {object_options_cash} --]
Credit Card
[!-- ENDIF {object_options_cash} --]
[!-- ENDIF {object_options_bbank} --]
Last Edit: 6 months 2 weeks ago by nazeer. Reason: SOLVED
The administrator has disabled public write access.
The following user(s) said Thank You: ksar
Time to create page: 0.073 seconds