Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In the reservation manager of MXTS, we have functionality to send an email to the customer with selected accommodation types. The email send to the customer is based on a template. This document describes how to create such a report and template.  

The new default example template can be find in

Jira Legacy
serverSystem JIRA
serverId3e9d84be-d308-3701-9d75-3db2b11b799f
keyMXTS-14990
 




  1. Create a new template with type "email" and context "custom"
  2. Add a translation, and don't forget to fill in subject. 
  3. Create a report of type "Reservation specific"

  4. Create a new report url with links to the email template you created earlier.

There are a lot of parameters added to the context. In the next example is shown how to use those parameters in a template. On the top of the template the most important ones are shown, below the other options. Each parameter is categorized by their respective (nested) category. Note that when a parameter contains a Null value, it will return its parameter name instead of a Null value. 

Code Block
## SEARCHRESULTS ##
#foreach($result in $searchResults)
	## RESULT ##
	$result.name 
	$result.resort.name
	$result.basePrice 
	$result.custom.remark

	#foreach($amenity in $result.amenties)
		$amenity.name
	#end
	 
	$result.resourceId 
	$result.description 
	$result.code
	$result.numberOfPersons
	$result.nrOfBedrooms
	$result.nrOfBathrooms
	$result.checkinTime 
	$result.checkoutTime 
	$result.address 
	$result.accotypeKindId
	$result.amenityManagerId;
	$result.accotypeAddressManagerId
	$result.imageManagerId
	$result.basePrice 
	$result.resortId
    $result.shortDescription
    $result.totalPrice
	$result.numberOfNights

	#foreach($infoText in $result.infoTexts)
		$infoText.name
		$infoText.code
		$infoText.description
	#end

	## RESULT CUSTOM ##
	$result.custom.remark

	## RESULT RESORT ##
	$result.resort.amenityManagerId
	$result.resort.resortId
	$result.resort.code
	$result.resort.name
	$result.resort.shortDescription 
	$result.resort.description 
	$result.resort.parentId
	$result.resort.visitAddressManagerId
	$result.resort.mailAddressManagerId
	$result.resort.mailAddress
	$result.resort.amenityManagerId
	$result.resort.adminOrganisationId
	$result.resort.inheritTc

	## RESULT RESORT VISITADDRESS ##
	$result.resort.visitAddress.addressId
	$result.resort.visitAddress.managerId
	$result.resort.visitAddress.address1
	$result.resort.visitAddress.address2 
	$result.resort.visitAddress.address3 
	$result.resort.visitAddress.boxNumber 
	$result.resort.visitAddress.houseNumberSuffix 
	$result.resort.visitAddress.zipCode
	$result.resort.visitAddress.poBox 
	$result.resort.visitAddress.poBoxZipcode 
	$result.resort.visitAddress.poBoxCity 
	$result.resort.visitAddress.city
	$result.resort.visitAddress.countryId
	$result.resort.visitAddress.mobilePhone2 
	$result.resort.visitAddress.latitude
	$result.resort.visitAddress.longitude
	$result.resort.visitAddress.email
	$result.resort.visitAddress.stateId 
	$result.resort.visitAddress.mobilePhone 
	$result.resort.visitAddress.houseNumber 
	$result.resort.visitAddress.district 
	$result.resort.visitAddress.privatePhone
	$result.resort.visitAddress.workPhone 
	$result.resort.visitAddress.exposeLocation
	$result.resort.visitAddress.dateEnd 
	$result.resort.visitAddress.dateBegin
	$result.resort.visitAddress.fax 
	$result.resort.visitAddress.altContactPerson
	$result.resort.visitAddress.country 
	$result.resort.visitAddress.state 

	## RESULT AMENITIES ##
	#foreach($amenity in $result.amenities)
		$amenity.name
		$amenity.amenityLinkId
		$amenity.amenityId
		$amenity.type
		$amenity.visible
		$amenity.numberValue 
		$amenity.startDate 
		$amenity.endDate 
		$amenity.description 
		$amenity.metric 
	#end

	## RESULT FILTERED AMENITIES ##
	#foreach($filteredAmenity in $result.filteredAmenities)
		$filteredAmenity.name
	#end

    ## RESULT SUBJECTS ##
    #foreach($subject in $result.subjects)
        $subject.name
		$subject.subjectId
		$subject.quantity
    #end

	## RESULT IMAGES ##
	#foreach($image in $result.images)
		$image.fileName
		$image.imageId
		$image.startDate 
		$image.endDate 
		$image.mimeType
		$image.version 
		$image.url 
		$image.urls.large
		$image.urls.original
		$image.urls.medium
		$image.urls.small
		$image.imageType
		$image.name
		$image.description
	#end

    ## RESULT ACCOMMODATION KIND ##
    $result.accommodationKind.name

	## RESULT INFOTEXTS ##
	#foreach($infoText in $result.infoTexts)
		$infoText.infoTextId
		$infoText.name
		$infoText.code
		$infoText.description
		$infoText.categoryId
		$infoText.memoManagerId
		$infoText.priority
	#end 

#end

## SEARCHCRITERIA ##
$searchCriteria.arrivalDate
$searchCriteria.departureDate
 
## CUSTOM COMMENT ##
$comment

## CURRENCY CODE ##
$currencyCode


It is also possible to use tools in templates, which are listed under Tools at the right panel on the template editor. In the next example we show how the two most commonly used tools (dateTool and numberTool) can be used.

Code Block
## LOCALE ##
## In order to define a Locale (e.g. "nl_NL" or use the customer language through $customer.language), loop on all java.util.Locale.availableLocales() and try to find a match with the supplied Locale code.
#foreach ($locale in $date.getLocale().getAvailableLocales())
	#if ($locale == $customer.language)
		#set ($currentLocale = $locale)
	    #break($foreach)
	#end
#end

## If there is no matching Locale, use the default Locale of the template (en_US).
#if (!$currentLocale)
	#set ($currentLocale = $date.getLocale())
#end


## DATETOOL ##   

## To format a date, provide a format, parsed data object, and a Locale.
## The parsed date format should always be "yyyy-MM-dd" as this corresponds with the provided Json date.  
$date.format("dd-MM-yyyy", $date.toDate("yyyy-MM-dd", $searchCriteria.arrivalDate), $currentLocale)

## NUMBERTOOL ##

## To format a number, provide "number" as format type, a number object, and a Locale.
$number.format("number", $result.basePrice, $currentLocale)

## To format on 2 decimals change "number" to "#0.00". 
$number.format("#0.00", $result.basePrice, $currentLocale)