Jump to content

WBTeamPro Conditional Statements


Recommended Posts

I'm trying to use conditional statements in email templates for WBTeamPro but it breaks the email  and I don't even receive an email notification after adding the code below to the email template. not sure why??

 

{if $action.action_complete eq $oldaction.action_complete}
no progress change
{else}
progress changed
{/if}

 

Link to comment
Share on other sites

6 hours ago, energylevels said:

I'm trying to use conditional statements in email templates for WBTeamPro but it breaks the email  and I don't even receive an email notification after adding the code below to the email template. not sure why??

there's nothing obviously wrong with the Smarty code, but what I suspect you're doing is just adding it to the template directly, and unfortunately WHMCS can add additional coding to the template to make these statements fail.. e.g if I just quickly type it in to a template, the actual code added to it is..

{if $action.action_required eq $oldaction.action_complete}<br />no progress change<br />{else}<br />progress changed<br />{/if}

in your case, it might have added <span> or other html in there too... the work around is usually to use the HTML button and enter your code in there...

Z0jk2tu.png

on rare occasions, i've had to enter code directly into the tblemailtemplates database table to bypass WHMCS adding anything to it, but hopefully just using the HTML button will resolve your issue. :idea:

Link to comment
Share on other sites

Here's the full source code to do a test, still doesn't work:

 

<p><span style="font-size: small; font-family: arial, helvetica, sans-serif;"><strong><br />
  The following task has been {if $oldaction.action_id}updated <strong>{else}added <strong>{/if}</strong></strong>by<strong>{if $admin}</strong> {$admin.firstname} {$admin.lastname} (admin) {else if $client}{$client.firstname} {$client.lastname}{/if}<br />
  <br />
  </strong></span></p>
{if $action.action_complete eq $oldaction.action_complete}no change{else}progress changed
 {/if}
<strong><span style="font-size: small; font-family: arial, helvetica, sans-serif;">New Task Details:</span></strong>
<p><span style="font-size: small; font-family: arial, helvetica, sans-serif;">Project Name: {$project.project_name}</span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Name: {$action.action_name} </span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Progress : {$action.action_complete}%<br />
  </span><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Task Status: {$action.action_status} <br />
  </span><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Task Manager: {$action.manager_adminid} <br />
  </span><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Task Assigned To: {$action.assigned_adminid}<br />
  </span><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Task Contact: {$action.client_contactid}<br />
  </span><span style="font-family: arial, helvetica, sans-serif; font-size: small;">Timelog Elapsed: {$action.timelog_elapsed}</span></p>
<p>{if $oldaction.action_id}</p>
<strong><span style="font-size: small; font-family: arial, helvetica, sans-serif;">Previous Task Details:</span></strong>
<p><span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Name: {$oldaction.action_name} </span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task ID: {$oldaction.action_id}</span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Complete %: {$oldaction.action_complete}</span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Status: {$oldaction.action_status}</span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Manager: {$oldaction.manager_adminid} </span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Assigned: {$oldaction.assigned_adminid}</span><br />
  <span style="font-size: small; font-family: arial, helvetica, sans-serif;">Task Contact: {$action.client_contactid}</span></p>
<p>{/if}</p>

 

Link to comment
Share on other sites

50 minutes ago, energylevels said:

Here's the full source code to do a test, still doesn't work:

I still don't think there's anything fundamentally wrong with the code (weird placing of some of the strong tags though!) - if I copy&paste it into the "Invoice Created" email template, and send an invoice email, then the email is sent without issue... obviously with no data as I don't have the addon, but if there was anything wrong with the Smarty, it wouldn't send and would throw an error.

JcgxwUT.png

to cause an error, if I intentionally remove the final {/if} and try to resend - it tells me that there's an error on-screen and in the activity logs..

Quote

Email Sending Failed - Email message rendered empty - please check the email message Smarty markup syntax

WNHSrKw.png

perhaps reading your activity logs might give you a clue exactly where the issue is... alternatively, contact WBTeamPro as it might be something to do with their addon. :?:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated