function &newNotificationForDocument($oDocument, $oUser, $oState, $oActor, $sComments) { $aInfo = array(); $aInfo['sData1'] = $oState->getName(); $aInfo['sData2'] = $sComments; $aInfo['iData1'] = $oDocument->getId(); $aInfo['iData2'] = $oActor->getId(); $aInfo['sType'] = 'ktcore/workflow'; $aInfo['dCreationDate'] = getCurrentDateTime(); $aInfo['iUserId'] = $oUser->getId(); $aInfo['sLabel'] = $oDocument->getName(); $oNotification = KTNotification::createFromArray($aInfo); $handler = new KTWorkflowNotification(); if ($oUser->getEmailNotification() && strlen($oUser->getEmail()) > 0) { $emailContent = $handler->handleNotification($oNotification); $emailSubject = sprintf(_kt('Workflow Notification: %s'), $oDocument->getName()); $oEmail = new EmailAlert($oUser->getEmail(), $emailSubject, $emailContent); $oEmail->send(); } return $oNotification; }