SOLVED - Email Schedule Eval Troubles

nclaypool

Member
Need a little bit of help. This is likely an issue of me not fully understanding the instructions for the Scheduled email task.

I have a single list comprised of individual's names along with the expiration dates of their assorted certifications and the site that they work at. What I need the email task to do is find all the names of a particular site that have certifications expiring within 30 days of the current date (90 for one of them). The task is set to run daily and it definitely as I'm getting an email but it doesn't contain any of the expected data. It just has a literal output of the query it tried to run and says "0 records." I have data in my list that should result in at least one record coming out.

Here's the EVAL code.
PHP:
// Map row data to shortened variables
$center = {staff_certifications___center_raw};
$cpr = {staff_certifications___cpr};
$fa = {staff_certifications___first_aid};
$tb = {staff_certifications___tb};
$cda = {staff_certifications___cda};
$can = {staff_certifications___child_abuse_neglect};
$ss = {staff_certifications___safe_sleep};

// Checks conditions to see if name should be included on email
if ($center == 2)
{
  if (strtotime($cda) > strtotime('-90 day') || strtotime($cpr) > strtotime('-30 day') || strtotime($fa) > strtotime('-30 day') || strtotime($tb) > strtotime('-30 day') || strtotime($can) > strtotime('-30 day') || strtotime($ss) > strtotime('-30 day'))
  {
    $name = {staff_certifications___name};
    return name;
  }
  else
  {
    return false;
  }
}
else
{
  return false;
}

Your help is greatly appreciated. Thank you.
 
Extra details. Was playing around on my web app in another area and got an error to show up from the task.

Parse error: syntax error, unexpected '<' in /home/ecallia1/public_html/data/plugins/fabrik_cron/email/email.php(75) : eval()'d code on line 15

Problem is I don't have any < in my EVAL code???
 
I suspect you do, you just don't know it ...

Code:
$name={staff_certifications___name};

... has no quotes around the placeholder ... and I suspect you are using that as a details link, so it has embedded markup, so the code being executed winds up as ...

Code:
$name = <a href="something">some text</a>

So put quotes around the placeholder ...

Code:
$name= '{staff_certifications___name}';

-- hugh
 
In fact, put quotes around ALL your placeholders. That's just something you have to do with placeholders, as they aren't PHP variables, rather we substitute the values in the text before handing the code to PHP to evaluate. So anything other than integer values will cause syntax errors if you don't have quotes round them.

-- hugh
 
In fact, put quotes around ALL your placeholders. That's just something you have to do with placeholders, as they aren't PHP variables, rather we substitute the values in the text before handing the code to PHP to evaluate. So anything other than integer values will cause syntax errors if you don't have quotes round them.

-- hugh

Ah, that seemed to make something happen.

When I manually ran the task after adding in single quotes it says "1 record updated" but also says "Message Body Empty." I'm guessing that means it didn't find a match from my query but then why would it say that one record was updated?
 
Ah, that seemed to make something happen.

When I manually ran the task after adding in single quotes it says "1 record updated" but also says "Message Body Empty." I'm guessing that means it didn't find a match from my query but then why would it say that one record was updated?

I finally got it! Had to tweak a few things, also didn't realize that what condition was looking for when the conditions were TRUE was a "return true;" for some reason I had it in my head that it was looking for a return of what text should appear in the email.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top