You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2022-12-09 03:01:34

Wickeret
Member
Registered: 2022-11-17
Posts: 5

Notification Template ELSEIF?

I'm making changes to my ticket notification template and don't see any way to do a proper ELSEIF and the syntax doesn't seem very well documented. I'm trying to do something like:

##IFticket.action=New Ticket##
Blurb for only new tickets
##ENDIFticket.action####ELSEIFticket.action=New Task##
Blurb for only new tasks
##ENDELSEIFticket.action####ELSEticket.action##
Blurb for all other ticket actions, but not for new tickets or tasks
##ENDELSEticket.action##

This doesn't work as elseif doesn't appear to by in the syntax. After a lot of trial and error the closest I could get was doing:

##IFticket.action=New Ticket##
Blurb for only new tickets
##ENDIFticket.action####ELSEticket.action####IFticket.action=New Task##
Blurb for only new tasks
##ENDIFticket.action####ELSEticket.action##
Blurb for all other ticket actions, but not for new tickets or tasks
##ENDELSEticket.action####ENDELSEticket.action##

This seems to work fine for new tasks and everything else but includes the text "##ENDELSEticket.action##" in the notification for New Tickets.

Is there a way to nest an IF and ELSE inside an ELSE without running into this kind of problem. Or is there another way to get an ELSEIF kind of behavior so you can have multiple specific IFs followed by an ELSE. I suppose if I really need to I could just create an IF for every single possible ticket action with most of them having duplicate contents, but I'd like to avoid that if I can.

Any thoughts or documentation I'm missing?

Thanks, Wickeret

Offline

#2 2022-12-13 14:33:18

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: Notification Template ELSEIF?

The syntax for this is just "ELSE" and "ENDELSE". "ELSE" does accept a condition.

##IFticket.action=New Ticket##
Blurb for only new tickets
##ENDIFticket.action####ELSEticket.action=New Task##
Blurb for only new tasks
##ENDELSEticket.action####ELSEticket.action##
Blurb for all other ticket actions, but not for new tickets or tasks
##ENDELSEticket.action##


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2022-12-16 01:53:32

Wickeret
Member
Registered: 2022-11-17
Posts: 5

Re: Notification Template ELSEIF?

Thank you so much. This is exactly what I needed.

Offline

Board footer

Powered by FluxBB