Hello,
I have a template with some logical conditions, to display some custom fields values, if the conditions are true. But, my problem is that I get the syntax error
when I try to save the template. I know that everything inside the {}
is parsed as perl code, and I have some table rows inside that code. How can I create the template with this conditions to display some table rows ?
{
if ($Ticket->FirstCustomFieldValue('ProjectId Asis') eq 'Fara ID ASIS'){
<tr>
<td align="right"><b>Marca Asis: </b></td>
<td>{$Ticket->FirstCustomFieldValue('MarcaAsis Requestor')}</td>
</tr>
} else {
<tr>
<td align="right"><b>Project ID: </b></td>
<td>{$Ticket->FirstCustomFieldValue('ProjectId Asis')}</td>
</tr>
}
}
This is all the code that I have in that template, if you want to see
RT-Attach-Message: yes
Content-Type: text/html
<table border="0">
<tr>
<td align="right"><b>Subject:</b></td>
<td>{$Transaction->Subject || $Ticket->Subject || "(No subject given)"} </td>
</tr>
# ========== DATE FACTURARE ==========
<tr>
<td align="right"><b>Department: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Requestor Department')}</td>
</tr>
{
if ($Ticket->FirstCustomFieldValue('ProjectId Asis') eq 'Fara ID ASIS'){
<tr>
<td align="right"><b>Marca Asis: </b></td>
<td>{$Ticket->FirstCustomFieldValue('MarcaAsis Requestor')}</td>
</tr>
} else {
<tr>
<td align="right"><b>Project ID: </b></td>
<td>{$Ticket->FirstCustomFieldValue('ProjectId Asis')}</td>
</tr>
}
}
# ========== DATE DELEGATIE ==========
<tr>
<td align="right"><b>Period of travel - From: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Period of travel - From ')}</td>
</tr>
<tr>
<td align="right"><b>Period of travel - To: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Period of travel - To')}</td>
</tr>
# ========== DATE LOCATIE ==========
<tr>
<td align="right"><b>Itinerary - Departure From: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Itinerary - Departure From')}</td>
</tr>
<tr>
<td align="right"><b>Itinerary - To: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Itinerary - To')}</td>
</tr>
# ========== DATE AVION ==========
{
if($Ticket->FirstCustomFieldValue('Travel Method') eq 'Airplane'){
<tr>
<td align="right"><b>Flexible on dates for departure: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Flexible on dates for departure')}</td>
</tr>
<tr>
<td align="right"><b>Flight Hour - Departure: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Flight Hour - Departure')}</td>
</tr>
<tr>
<td align="right"><b>Filght Hour - Return: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Filght Hour - Return')}</td>
</tr>
<tr>
<td align="right"><b>Preferred airlines: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Preferred airlines')}</td>
</tr>
<tr>
<td align="right"><b>Special Requirements: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Special Requirements')}</td>
</tr>
}
}
# ========== DATE CAZARE ==========
{
if($Ticket->FirstCustomFieldValue('Acomodation Reservation') eq 'AROBS'){
<tr>
<td align="right"><b>Hotel - Check In Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Hotel - Check In Date')}</td>
</tr>
<tr>
<td align="right"><b>Hotel - Check Out Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Hotel - Check Out Date')}</td>
</tr>
<tr>
<td align="right"><b>Options for hotel: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Options for hotel')}</td>
</tr>
}
}
# ========== DATE ASIGURARE ==========
{
if($Ticket->FirstCustomFieldValue('Travel Insurance') eq 'Yes'){
if($Ticket->FirstCustomFieldValue('Period of the travel insurance') eq 'Select dates'){
<tr>
<td align="right"><b>Travel Insurance - Start Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Travel Insurance - Start Date')}</td>
</tr>
<tr>
<td align="right"><b>Travel Insurance - End Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Travel Insurance - End Date')}</td>
</tr>
} else {
<tr>
<td align="right"><b>Travel insurance period: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Period of the travel insurance')}</td>
</tr>
}
}
}
<br>
<br>
# ========== DATE LOCATIE 2 ==========
{
if($Ticket->FirstCustomFieldValue('Location 2') eq 'Yes'){
# ========== DATE DELEGATIE ==========
<tr>
<td align="right"><b>Period of travel Location 2 - From: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Period of travel - From 2')}</td>
</tr>
<tr>
<td align="right"><b>Period of travel Location 2 - To: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Period of travel - To 2')}</td>
</tr>
# ========== DATE LOCATIE ==========
<tr>
<td align="right"><b>Itinerary Location 2 - Departure From: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Itinerary - Departure From 2')}</td>
</tr>
<tr>
<td align="right"><b>Itinerary Location 2 - To: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Itinerary - To 2')}</td>
</tr>
# ========== DATE AVION ==========
if($Ticket->FirstCustomFieldValue('Travel Method 2') eq 'Airplane'){
<tr>
<td align="right"><b>Flexible on dates for departure Location 2: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Flexible on dates for departure 2')}</td>
</tr>
<tr>
<td align="right"><b>Flight Hour Location 2 - Departure: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Flight Hour - Departure 2')}</td>
</tr>
<tr>
<td align="right"><b>Filght Hour Location 2 - Return: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Filght Hour - Return 2')}</td>
</tr>
<tr>
<td align="right"><b>Preferred airlines Location 2: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Preferred airlines 2')}</td>
</tr>
<tr>
<td align="right"><b>Special Requirements Location 2: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Special Requirements 2')}</td>
</tr>
}
# ========== DATE CAZARE ==========
if($Ticket->FirstCustomFieldValue('Acomodation Reservation 2') eq 'AROBS'){
<tr>
<td align="right"><b>Hotel Location 2 - Check In Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Hotel - Check In Date 2')}</td>
</tr>
<tr>
<td align="right"><b>Hotel Location 2 - Check Out Date: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Hotel - Check Out Date 2')}</td>
</tr>
<tr>
<td align="right"><b>Options for hotel Location 2: </b></td>
<td>{$Ticket->FirstCustomFieldValue('Options for hotel 2')}</td>
</tr>
}
}
}
</table>
<br />
<br />
{$Transaction->Content( Type => "text/html")}