Hello All,
I've been smashing my head against my desk trying to troubleshoot my code in a scheduled email task. All it has to do is check the value of one element, then in a rather large IF statement test a series of five or six dates to see if they're within a specific time frame from today. Here's my code as it exists now:
I only recently added the "date" function to the variables at the beginning as I wondered if the way my dates are stored in the DB with dashes was messing up the strtotime function. With the "date" functions added I always get zero records regardless if any fall within the time frames specified. If I remove the "date" functions (I only have one record currently) I always get the one record returned, even if none of the dates fall within the specified time frame.
Since it doesn't spit out any diagnostic information I'm having a hell of a time figuring out what's going on. Are the dates not getting assigned to the variables properly??? If anyone can give my code a gander and see if I'm missing something glaring that would be great. Or if there's a way I can get more info from Fabrik on why the code isn't resulting in the expected results.
Thank you in advance!
I've been smashing my head against my desk trying to troubleshoot my code in a scheduled email task. All it has to do is check the value of one element, then in a rather large IF statement test a series of five or six dates to see if they're within a specific time frame from today. Here's my code as it exists now:
PHP:
// Map row data to shortened variables
$center = "{staff_certifications___center_raw}";
$cpr = date('m/d/Y', "{staff_certifications___cpr}");
$fa = date('m/d/Y', "{staff_certifications___first_aid}");
$tb = date('m/d/Y', "{staff_certifications___tb}");
$cda = date('m/d/Y', "{staff_certifications___cda}");
$can = date('m/d/Y', "{staff_certifications___child_abuse_neglect}");
$ss = date('m/d/Y', "{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'))
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
I only recently added the "date" function to the variables at the beginning as I wondered if the way my dates are stored in the DB with dashes was messing up the strtotime function. With the "date" functions added I always get zero records regardless if any fall within the time frames specified. If I remove the "date" functions (I only have one record currently) I always get the one record returned, even if none of the dates fall within the specified time frame.
Since it doesn't spit out any diagnostic information I'm having a hell of a time figuring out what's going on. Are the dates not getting assigned to the variables properly??? If anyone can give my code a gander and see if I'm missing something glaring that would be great. Or if there's a way I can get more info from Fabrik on why the code isn't resulting in the expected results.
Thank you in advance!