There is a misplaced ' in the array in your trigger code that caused an error. Also need to instantiate G() in recent versions of PHP to avoid warnings.
Try this:
Code: Select all//find the task ID by running a case in Task_2 and look at the TASK system variable:
$taskId = '3333725465a8afa8e9523d6091948077';
//set to the same email address used in Admin > Settings > Email Servers:
$emailFrom = 'process.manager@valuement-group.com';
$g = new G();
$now = date('Y-m-d H:i:s');
$query= "SELECT * FROM APP_CACHE_VIEW WHERE TAS_UID='$taskId' AND
(APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN' AND
DEL_TASK_DUE_DATE < '$now' ";
$aCases = executeQuery($query);
if (!is_array($aCases)) {
die("Error: Bad Query: $query\n");
}
foreach ($aCases as $aCase) {
$c = new Cases();
$aCaseInfo = $c->loadCase($aCase['APP_UID'], $aCase['DEL_INDEX']);
$aData = array(
'caseNo' => $aCase['APP_NUMBER'],
'caseTitle' => $aCase['APP_TITLE'],
'caseStatus' => $aCase['APP_STATUS'],
'taskName' => $aCase['APP_TASK_TITLE'],
'taskAssignedDate' => $aCase['DEL_DELEGATE_DATE'],
'taskDueDate' => $aCase['DEL_TASK_DUE_DATE'],
'caseCreatedBy' => $aCaseInfo['CREATOR'],
'caseStartDate' => $aCaseInfo['CREATE_DATE'],
'caseUpdatedDate'=> $aCaseInfo['UPDATE_DATE'],
'caseLink' => ($g->is_https() ? "https://" : "http://") . $_SERVER['SERVER_NAME'] .
':' . $_SERVER['SERVER_PORT'] . //comment out if no port number
'/sys'.@@SYS_SYS.'/'.@@SYS_LANG.'/'.@@SYS_SKIN.'/cases/open?APP_UID=' .
$aCase['APP_UID'] . '&DEL_INDEX=' . $aCase['DEL_INDEX'] . '&action=draft'
);
$aUser = userInfo($aCase['USR_UID']);
PMFSendMessage($emailFrom, $aUser['mail'], '', '', 'Overdue case ' . $aCase['APP_TITLE'],
'overdueCase.html', $aData);
}
If you turn on Debug Mode you will see errors listed in the __ERROR__ variable.