Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 219257

Re: The lease and cost in email are garbled

$
0
0

Sorry I didn't respond to your request on the other thread - I was working out a solution.  I assume the problem is in the formatting passed as part of the values to the template.  I think the system is trying to take the unit "Days" and localize it to Simplified Chinese, and it gets garbled.  So the best I could come up with was to pull the raw value (number) and then you add some decoration (words) to it in hte #renderRow lines below - change " --Days" to whatever makes sense.

 

I modified the /vcac/templates/email/html/extensions/defaults/request_catalogItem.vm file with the following.   Everything in bold red are things I changed.

 

#set( $nothing = '')

#set( $reqLeaseCost = $formData.get('requestLeaseCost').getCost().getAmount() )

#set( $leaseCostFormatted = $nothing.format("%.2f", $reqLeaseCost) )

#set( $rPeriod = $formData.get('requestLeasePeriod').getAmount() )

#set( $request_leasePeriod = "#valueOf('requestLeasePeriod')" )

  #if( "$!request_leasePeriod" == "" || "$!request_leasePeriod.trim()" == "" )

    #set( $requestIsQuoteProvided = $formData.get("${keyPrefix}requestIsQuoteProvided") )

    #if( "$!requestIsQuoteProvided" != "" && $requestIsQuoteProvided )

      #set( $request_leasePeriod = "#msg('notification.email.extensions.request.unlimited')" )

    #end

  #end

#if( "$!request_leasePeriod" == "#msg('notification.email.extensions.request.unlimited')" )

  #set( $rPeriod = $request_leasePeriod )

#end

 

<h2>#msg("notification.email.extensions.request.info") </h2>

<br/>

 

<table class="sectionGrid">

  #renderRow("notification.email.extensions.deployment", "#valueOf('catalogItem-Name')")

  #renderRow("notification.email.extensions.request.requestedBy", "#valueOf('requestedBy')")

  #renderRow("notification.email.extensions.request.requestDate", "#valueOf('requestedDate')")

  #renderRow("notification.email.extensions.description", "#valueOf('description')")

  #renderRow("notification.email.extensions.request.reason", "#valueOf('reasons')")

  #renderRow("notification.email.extensions.request.numberOfInstances", "#valueOf('_number_of_instances')")

  #renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

  #renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")

  #renderRow("notification.email.extensions.request.totalCost", "#valueOf('requestTotalLeaseCost')")

</table><br/>

 

## Show Request Components

#set( $component_size = "#valueOf('component-ComponentNos') " )

#set( $Integer = 0 )

 

#if( "$!component_size" != "" && "$!component_size.trim()" != "" )

  #set( $componentSize = $Integer.parseInt($component_size.trim()) )

 

  #if( $componentSize != 0 )

 

    <h2>#msg("notification.email.extensions.component.componentInfo")</h2><br/>

 

    #foreach($index in [1..$componentSize] )

 

      ## Component general info

      #set( $curKey = "component${index}-Name" )

      #set( $component_componentName = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-Type" )

      #set( $component_componentType = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-Parent" )

      #set( $component_parentComponent = "#valueOf($curKey)" )

 

      ## Software specified

      #set( $curKey = "component${index}-Software-Install-Path" )

      #set( $component_installPath = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-Software-Group-License" )

      #set( $component_groupLicense = "#valueOf($curKey)" )

 

      ## VM specified

      #set( $curKey = "component${index}-cpu" )

      #set( $component_cpu = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-memory" )

      #set( $component_memory = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-storage" )

      #set( $component_storage = "#valueOf($curKey)" )

 

      #set( $curKey = "component${index}-DestructionDate" )

      #set( $component_destructionDate = "#valueOf($curKey)" )

 

      <table class="sectionGrid">

 

          #renderRow("notification.email.extensions.component.name", "$component_componentName")

          #renderRow("notification.email.extensions.component.type", "$component_componentType")

          #renderRow("notification.email.extensions.component.parentComponent", "$component_parentComponent")

 

          ## Software fields

          #renderRow("notification.email.extensions.component.installPath", "$component_installPath")

          #renderRow("notification.email.extensions.component.groupLicense", "$component_groupLicense")

 

          ## VM fields

          #renderRow("notification.email.extensions.cpus", "$component_cpu")

          #renderRow("notification.email.extensions.memory", "$component_memory", "MB")

          #renderRow("notification.email.extensions.storage", "$component_storage", "GB")

          #renderRow("notification.email.extensions.destruction.date", "$component_destructionDate")

 

      </table>

      <br/>

 

    ##For loop

    #end

 

  ##end for if ($componentSize != 0)

  #end

## end for #if( "$!component_size" != "" )

#end

 

 

An example of this is below:

 

I made the text decoration conspicuous, but you could change it to a currency symbol or whatever makes sense in your locale by changing these lines:

#renderRow("notification.email.extensions.request.leaseCost", "${leaseCostFormatted} -Dollars/Day")

#renderRow("notification.email.extensions.request.leasePeriod", "${rPeriod} --Days")


Viewing all articles
Browse latest Browse all 219257

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>