Merged in bugfix/HOR-4396 (pull request #6436)

HOR-4396

Approved-by: David Callizaya <david.callizaya@processmaker.com>
Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2018-05-04 15:30:48 +00:00
committed by Julio Cesar Laura Avendaño
29 changed files with 1239 additions and 772 deletions

View File

@@ -86,28 +86,13 @@ class ActionsByEmailCoreClass extends PMPlugin
if (!empty($emailSetup)) {
$cases = new Cases();
$caseFields = $cases->loadCase($data->APP_UID);
$criteria = new Criteria();
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TYPE);
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_DYN_TYPE);
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_SUBJECT_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_CUSTOM_GRID);
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
$criteria->addJoin( AbeConfigurationPeer::DYN_UID, DynaformPeer::DYN_UID, Criteria::LEFT_JOIN );
$criteria->add(AbeConfigurationPeer::PRO_UID, $caseFields['PRO_UID']);
$criteria->add(AbeConfigurationPeer::TAS_UID, $data->TAS_UID);
$result = AbeConfigurationPeer::doSelectRS($criteria);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
if ($configuration = $result->getRow()) {
$caseFields = $cases->loadCase($data->APP_UID, $data->DEL_INDEX);
$actionEmailTable = new AbeConfiguration();
$configuration = $actionEmailTable->getTaskConfiguration($caseFields['PRO_UID'], $data->TAS_UID);
$caseFields['APP_DATA']['PRO_ID'] = $configuration['PRO_ID'];
$caseFields['APP_DATA']['TAS_ID'] = $configuration['TAS_ID'];
if (!empty($configuration)) {
$configuration['ABE_EMAIL_FIELD'] = str_replace('@@', '', $configuration['ABE_EMAIL_FIELD']);
if ($configuration['ABE_EMAIL_FIELD'] != '' && isset($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']])) {
$email = trim($caseFields['APP_DATA'][$configuration['ABE_EMAIL_FIELD']]);
@@ -303,7 +288,7 @@ class ActionsByEmailCoreClass extends PMPlugin
$caseFields['APP_DATA'],
null,
true,
0,
$data->DEL_INDEX,
$emailSetup,
0
);

View File

@@ -489,6 +489,7 @@ class Cases
//Update the global variables
$aFields['TASK'] = $aAppDel['TAS_UID'];
$aFields['INDEX'] = $aAppDel['DEL_INDEX'];
$aFields['TAS_ID'] = $aAppDel['TAS_ID'];
$aFields['PRO_ID'] = $aAppDel['PRO_ID'];
try {
$oCurUser = new Users();
@@ -5418,13 +5419,13 @@ class Cases
} else {
$arrayData2 = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($arrayData2);
}
$sBody2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false);
$sTo = null;
$sCc = '';
$body2 = G::replaceDataGridField($dataLastEmail['body'], $arrayData2, false);
$to = null;
$cc = '';
if ($aTask['TAS_UID'] != '-1') {
$respTo = $this->getTo($aTask['TAS_UID'], $aTask['USR_UID'], $arrayData);
$sTo = $respTo['to'];
$sCc = $respTo['cc'];
$to = $respTo['to'];
$cc = $respTo['cc'];
}
if ($aTask ["TAS_ASSIGN_TYPE"] === "SELF_SERVICE") {
@@ -5437,12 +5438,12 @@ class Cases
) {
@copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
}
$sBody2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
$body2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
}
}
if ($sTo != null) {
$oSpool = new SpoolRun();
if ($to != null) {
$spool = new SpoolRun();
//Load the TAS_ID
if (!isset($arrayData['TAS_ID'])) {
@@ -5451,32 +5452,43 @@ class Cases
} else {
$taskId = $arrayData['TAS_ID'];
}
//Load the PRO_ID
if (!isset($arrayData['PRO_ID'])) {
$process = new Process();
$proId = $process->load($arrayData['PROCESS'])['PRO_ID'];
} else {
$proId = $arrayData['PRO_ID'];
}
$oSpool->setConfig($dataLastEmail['configuration']);
$oSpool->create(array(
"msg_uid" => "",
'app_uid' => $dataLastEmail['applicationUid'],
'del_index' => $dataLastEmail['delIndex'],
"app_msg_type" => "DERIVATION",
"app_msg_subject" => $dataLastEmail['subject'],
'app_msg_from' => $dataLastEmail['from'],
"app_msg_to" => $sTo,
'app_msg_body' => $sBody2,
"app_msg_cc" => $sCc,
"app_msg_bcc" => "",
"app_msg_attach" => "",
"app_msg_template" => "",
"app_msg_status" => "pending",
"app_msg_error" => $dataLastEmail['msgError'],
"tas_id" => $taskId,
"app_number" => isset($arrayData['APP_NUMBER']) ? $arrayData['APP_NUMBER'] : ''
));
$spool->setConfig($dataLastEmail['configuration']);
$messageArray = AppMessage::buildMessageRow(
'',
$dataLastEmail['applicationUid'],
$dataLastEmail['delIndex'],
'DERIVATION',
$dataLastEmail['subject'],
$dataLastEmail['from'],
$to,
$body2,
$cc,
'',
'',
'',
'pending',
'',
$dataLastEmail['msgError'],
true,
isset($arrayData['APP_NUMBER']) ? $arrayData['APP_NUMBER'] : 0,
$proId,
$taskId
);
$spool->create($messageArray);
if ($dataLastEmail['msgError'] == '') {
if (($dataLastEmail['configuration']["MESS_BACKGROUND"] == "") ||
($dataLastEmail['configuration']["MESS_TRY_SEND_INMEDIATLY"] == "1")
) {
$oSpool->sendMail();
$spool->sendMail();
}
}
}
@@ -5525,8 +5537,8 @@ class Cases
public function getTo($taskUid, $userUid, $arrayData)
{
$sTo = null;
$sCc = null;
$to = null;
$cc = null;
$arrayResp = array();
$tasks = new Tasks();
$group = new Groups();
@@ -5670,9 +5682,9 @@ class Cases
if (isset($userUid) && !empty($userUid)) {
$aUser = $oUser->load($userUid);
$sTo = ((($aUser ["USR_FIRSTNAME"] != "") || ($aUser ["USR_LASTNAME"] != "")) ? $aUser ["USR_FIRSTNAME"] . " " . $aUser ["USR_LASTNAME"] . " " : "") . "<" . $aUser ["USR_EMAIL"] . ">";
$to = ((($aUser ["USR_FIRSTNAME"] != "") || ($aUser ["USR_LASTNAME"] != "")) ? $aUser ["USR_FIRSTNAME"] . " " . $aUser ["USR_LASTNAME"] . " " : "") . "<" . $aUser ["USR_EMAIL"] . ">";
}
$arrayResp ['to'] = $sTo;
$arrayResp ['to'] = $to;
$arrayResp ['cc'] = '';
break;
}
@@ -6308,62 +6320,6 @@ class Cases
return $oCriteria;
}
/**
* funcion History messages for case tracker ExtJS
* @name getHistoryMessagesTrackerExt
* @param string sApplicationUID
* @param string Msg_UID
* @return array
*/
public function getHistoryMessagesTrackerExt($sApplicationUID, $onlyVisibles = false, $start = null, $limit = null)
{
global $_DBArray;
$oAppDocument = new AppDocument();
$oCriteria = new Criteria('workflow');
$oCriteria->add(AppMessagePeer::APP_UID, $sApplicationUID);
if ($onlyVisibles) {
$oCriteria->add(AppMessagePeer::APP_MSG_SHOW_MESSAGE, 1);
}
$oCriteria->addAscendingOrderByColumn(AppMessagePeer::APP_MSG_DATE);
$oDataset = AppMessagePeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
$aMessages = array();
while ($aRow = $oDataset->getRow()) {
//Head for IE quirks mode
$sBody = '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />' . $aRow['APP_MSG_BODY'];
$aMessages[] = array('APP_MSG_UID' => $aRow['APP_MSG_UID'],
'APP_UID' => $aRow['APP_UID'],
'DEL_INDEX' => $aRow['DEL_INDEX'],
'APP_MSG_TYPE' => $aRow['APP_MSG_TYPE'],
'APP_MSG_SUBJECT' => $aRow['APP_MSG_SUBJECT'],
'APP_MSG_FROM' => $aRow['APP_MSG_FROM'],
'APP_MSG_TO' => $aRow['APP_MSG_TO'],
'APP_MSG_BODY' => $sBody,
'APP_MSG_DATE' => $aRow['APP_MSG_DATE'],
'APP_MSG_CC' => $aRow['APP_MSG_CC'],
'APP_MSG_BCC' => $aRow['APP_MSG_BCC'],
'APP_MSG_TEMPLATE' => $aRow['APP_MSG_TEMPLATE'],
'APP_MSG_STATUS' => $aRow['APP_MSG_STATUS'],
'APP_MSG_ATTACH' => $aRow['APP_MSG_ATTACH'],
'APP_MSG_SHOW_MESSAGE' => $aRow['APP_MSG_SHOW_MESSAGE']
);
$oDataset->next();
}
$_DBArray['messages'] = $aMessages;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('messages');
usort($aMessages, array($this, "ordProcess"));
return $aMessages;
}
/**
* funcion History messages for case tracker
* by Everth The Answer
@@ -7154,30 +7110,6 @@ class Cases
}
}
public function ordProcess($a, $b)
{
if ($this->sort == '') {
$this->sort = 'APP_MSG_DATE';
}
if ($this->dir == 'ASC') {
if ($a[$this->sort] > $b[$this->sort]) {
return 1;
} elseif ($a[$this->sort] < $b[$this->sort]) {
return - 1;
} else {
return 0;
}
} else {
if ($a[$this->sort] > $b[$this->sort]) {
return - 1;
} elseif ($a[$this->sort] < $b[$this->sort]) {
return 1;
} else {
return 0;
}
}
}
public function unserializeData($data)
{
$unserializedData = @unserialize($data);

View File

@@ -1803,6 +1803,10 @@ class Derivation
if (isset($nextDel['TAS_ID'])) {
$appFields['APP_DATA']['TAS_ID'] = $nextDel['TAS_ID'];
}
//Load the PRO_ID
if (isset($nextDel['PRO_ID'])) {
$appFields['APP_DATA']['PRO_ID'] = $nextDel['PRO_ID'];
}
$this->case->sendMessage($dataEmail, $appFields['APP_DATA'], $taskData);
}
return true;

View File

@@ -239,7 +239,8 @@ class SpoolRun
$attachment = implode(",", $this->fileData['attachments']);
$oAppMessage->setappMsgAttach($attachment);
}
$oAppMessage->setappMsgstatus($this->status);
$oAppMessage->setAppMsgStatus($this->status);
$oAppMessage->setAppMsgStatusId(isset(AppMessage::$app_msg_status_values[$this->status]) ? AppMessage::$app_msg_status_values[$this->status] : 0);
$oAppMessage->setappMsgsenddate(date('Y-m-d H:i:s'));
$oAppMessage->save();
}
@@ -543,26 +544,28 @@ class SpoolRun
}
/**
* try resend the emails from spool
* Try to resend the emails from spool
*
* @param string $dateResend
* @param integer $cron
*
* @return none or exception
*/
public function resendEmails($dateResend = null, $cron = 0)
{
$aConfiguration = System::getEmailConfiguration();
$configuration = System::getEmailConfiguration();
if (!isset($aConfiguration["MESS_ENABLED"])) {
$aConfiguration["MESS_ENABLED"] = '0';
if (!isset($configuration["MESS_ENABLED"])) {
$configuration["MESS_ENABLED"] = '0';
}
if ($aConfiguration["MESS_ENABLED"] == "1") {
if ($configuration["MESS_ENABLED"] == "1") {
require_once("classes/model/AppMessage.php");
$this->setConfig($aConfiguration);
$this->setConfig($configuration);
$criteria = new Criteria("workflow");
$criteria->add(AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL);
$criteria->add(AppMessagePeer::APP_MSG_STATUS_ID, AppMessage::MESSAGE_STATUS_PENDING, Criteria::EQUAL);
if ($dateResend != null) {
$criteria->add(AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL);
@@ -581,13 +584,24 @@ class SpoolRun
$row = $rsCriteria->getRow();
try {
$sFrom = G::buildFrom($aConfiguration, $row["APP_MSG_FROM"]);
$from = G::buildFrom($configuration, $row["APP_MSG_FROM"]);
$this->setData($row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date("Y-m-d H:i:s"), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"]);
$this->setData(
$row["APP_MSG_UID"],
$row["APP_MSG_SUBJECT"],
$from,
$row["APP_MSG_TO"],
$row["APP_MSG_BODY"],
date("Y-m-d H:i:s"),
$row["APP_MSG_CC"],
$row["APP_MSG_BCC"],
$row["APP_MSG_TEMPLATE"],
$row["APP_MSG_ATTACH"]
);
$this->sendMail();
} catch (Exception $e) {
$strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage();
$strAux = "Spool::resendEmails(): Using " . $configuration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage();
if ($e->getCode() == $this->ExceptionCode["WARNING"]) {
array_push($this->aWarnings, $strAux);
@@ -631,6 +645,7 @@ class SpoolRun
$spool->setAppUid($db_spool['app_uid']);
$spool->setDelIndex($db_spool['del_index']);
$spool->setAppMsgType($db_spool['app_msg_type']);
$spool->setAppMsgTypeId(isset(AppMessage::$app_msg_type_values[$db_spool['app_msg_type']]) ? AppMessage::$app_msg_type_values[$db_spool['app_msg_type']] : 0);
$spool->setAppMsgSubject($db_spool['app_msg_subject']);
$spool->setAppMsgFrom($db_spool['app_msg_from']);
$spool->setAppMsgTo($db_spool['app_msg_to']);
@@ -641,12 +656,13 @@ class SpoolRun
$spool->setappMsgAttach($db_spool['app_msg_attach']);
$spool->setAppMsgTemplate($db_spool['app_msg_template']);
$spool->setAppMsgStatus($db_spool['app_msg_status']);
$spool->setAppMsgSendDate(date('Y-m-d H:i:s')); // Add by Ankit
$spool->setAppMsgShowMessage($db_spool['app_msg_show_message']); // Add by Ankit
$spool->setAppMsgStatusId(isset(AppMessage::$app_msg_status_values[$db_spool['app_msg_status']]) ? AppMessage::$app_msg_status_values[$db_spool['app_msg_status']] : 0);
$spool->setAppMsgSendDate(date('Y-m-d H:i:s'));
$spool->setAppMsgShowMessage($db_spool['app_msg_show_message']);
$spool->setAppMsgError($db_spool['app_msg_error']);
if (empty($db_spool['app_number'])) {
$appDelegation = new AppDelegation();
if (empty($db_spool['app_number'])) {
$delegationIds = $appDelegation->getColumnIds($db_spool['app_uid'], $db_spool['del_index']);
if (is_array($delegationIds) && count($delegationIds) > 0) {
$delegationIds = array_change_key_case($delegationIds);
@@ -665,8 +681,15 @@ class SpoolRun
$tasId = $db_spool['tas_id'];
}
if (empty($db_spool['pro_id'])) {
$proId = isset($delegationIds['pro_id']) ? $delegationIds['pro_id'] : $appDelegation->getProcessId($appNumber);
} else {
$proId = $db_spool['pro_id'];
}
$spool->setAppNumber($appNumber);
$spool->setTasId($tasId);
$spool->setProId($proId);
if (!$spool->validate()) {
$errors = $spool->getValidationFailures();

View File

@@ -3869,18 +3869,65 @@ class WorkspaceTools
WHERE AD.APP_NUMBER = 0");
$con->commit();
// Populating APP_MESSAGE.TAS_ID
CLI::logging("-> Populating APP_MESSAGE.TAS_ID \n");
// Populating APP_MESSAGE.TAS_ID AND APP_MESSAGE.PRO_ID
CLI::logging("-> Populating APP_MESSAGE.TAS_ID and APP_MESSAGE.PRO_ID \n");
$con->begin();
$stmt = $con->createStatement();
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE AS AD
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE AS AM
INNER JOIN (
SELECT APP_DELEGATION.TAS_ID, APP_DELEGATION.APP_NUMBER, APP_DELEGATION.TAS_UID, APP_DELEGATION.DEL_INDEX
SELECT APP_DELEGATION.TAS_ID,
APP_DELEGATION.APP_NUMBER,
APP_DELEGATION.TAS_UID,
APP_DELEGATION.DEL_INDEX,
APP_DELEGATION.PRO_ID
FROM APP_DELEGATION
) AS DEL
ON (AD.APP_NUMBER = DEL.APP_NUMBER AND AD.DEL_INDEX = DEL.DEL_INDEX)
SET AD.TAS_ID = DEL.TAS_ID
WHERE AD.TAS_ID = 0 AND AD.APP_NUMBER != 0 AND AD.DEL_INDEX != 0");
ON (AM.APP_NUMBER = DEL.APP_NUMBER AND AM.DEL_INDEX = DEL.DEL_INDEX)
SET AM.TAS_ID = DEL.TAS_ID, AM.PRO_ID = DEL.PRO_ID
WHERE AM.TAS_ID = 0 AND AM.PRO_ID = 0 AND AM.APP_NUMBER != 0 AND AM.DEL_INDEX != 0");
$con->commit();
// Populating APP_MESSAGE.PRO_ID when does not exits DEL_INDEX
CLI::logging("-> Populating APP_MESSAGE.PRO_ID\n");
$con->begin();
$stmt = $con->createStatement();
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE AS AM
INNER JOIN (
SELECT APP_DELEGATION.APP_NUMBER,
APP_DELEGATION.DEL_INDEX,
APP_DELEGATION.PRO_ID
FROM APP_DELEGATION
) AS DEL
ON (AM.APP_NUMBER = DEL.APP_NUMBER)
SET AM.PRO_ID = DEL.PRO_ID
WHERE AM.PRO_ID = 0 AND AM.APP_NUMBER != 0");
$con->commit();
// Populating APP_MESSAGE.PRO_ID
CLI::logging("-> Populating APP_MESSAGE.APP_MSG_STATUS_ID \n");
$con->begin();
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE
SET APP_MSG_STATUS_ID = (case
when APP_MSG_STATUS = 'sent' then 1
when APP_MSG_STATUS = 'pending' then 2
when APP_MSG_STATUS = 'failed' then 3
end)
WHERE APP_MSG_STATUS in ('sent', 'pending', 'failed') AND
APP_MSG_STATUS_ID = 0");
$con->commit();
// Populating APP_MESSAGE.PRO_ID
CLI::logging("-> Populating APP_MESSAGE.APP_MSG_STATUS_ID \n");
$con->begin();
$rs = $stmt->executeQuery("UPDATE APP_MESSAGE
SET APP_MSG_TYPE_ID = (case
when APP_MSG_TYPE = 'TEST' then 1
when APP_MSG_TYPE = 'TRIGGER' then 2
when APP_MSG_TYPE = 'DERIVATION' then 3
when APP_MSG_TYPE = 'EXTERNAL_REGISTRATION' then 4
end)
WHERE APP_MSG_TYPE in ('TEST', 'TRIGGER', 'DERIVATION', 'EXTERNAL_REGISTRATION') AND
APP_MSG_TYPE_ID = 0");
$con->commit();
CLI::logging("-> Migrating And Populating Indexing for avoiding the use of table APP_CACHE_VIEW Done \n");

View File

@@ -2,6 +2,7 @@
//It works with the table CONFIGURATION in a WF dataBase
use ProcessMaker\Core\System;
use ProcessMaker\BusinessModel\EmailServer;
/**
* Copyright (C) 2009 COLOSA
@@ -776,22 +777,34 @@ class WsBase
/**
* send message
*
* @param string $caseId
* @param string $sFrom
* @param string $sTo
* @param string $sCc
* @param string $sBcc
* @param string $sSubject
* @param string $sTemplate
* @param string $appUid
* @param string $from
* @param string $to
* @param string $cc
* @param string $bcc
* @param string $subject
* @param string $template
* @param $appFields = null
* @param $aAttachment = null
* @param $attachment = null
* @param boolean $showMessage = true
* @param int $delIndex = 0
* @param $config = array
* @return $result will return an object
*/
public function sendMessage(
$caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true, $delIndex = 0, $config = [], $gmail = 0
$appUid,
$from,
$to,
$cc,
$bcc,
$subject,
$template,
$appFields = null,
$attachment = null,
$showMessage = true,
$delIndex = 0,
$config = [],
$gmail = 0
) {
try {
@@ -805,56 +818,50 @@ class WsBase
}
} else {
if (PMLicensedFeatures::getSingleton()->verifyfeature("zIKRGpDM3pjcHFsWGplNDN0dTl5bGN3UTNiOWdQU0E5Q05QTksrU1ladWQ0VT0=")) {
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
$emailServer = new EmailServer();
$criteria = $emailServer->getEmailServerCriteria();
$criteria->add(EmailServerPeer::MESS_UID, $config, Criteria::EQUAL);
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayConfigAux = $row;
$arrayConfigAux["SMTPSecure"] = $row["SMTPSECURE"];
}
}
}
$aSetup = (!empty($arrayConfigAux)) ? $arrayConfigAux : System::getEmailConfiguration();
$setup = (!empty($arrayConfigAux)) ? $arrayConfigAux : System::getEmailConfiguration();
if (!isset($aSetup['MESS_ENABLED'])) {
$aSetup['MESS_ENABLED'] = 1;
$aSetup['SMTPSecure'] = $aSetup['SMTPSECURE'];
unset($aSetup['SMTPSECURE']);
if (!isset($setup['MESS_ENABLED'])) {
$setup['MESS_ENABLED'] = 1;
$setup['SMTPSecure'] = $setup['SMTPSECURE'];
unset($setup['SMTPSECURE']);
}
} else {
/*----------------------------------********---------------------------------*/
$aSetup = System::getEmailConfiguration();
$setup = System::getEmailConfiguration();
/*----------------------------------********---------------------------------*/
}
/*----------------------------------********---------------------------------*/
$msgError = "";
if (sizeof($aSetup) == 0) {
if (sizeof($setup) == 0) {
$msgError = "The default configuration wasn't defined";
}
$oSpool = new SpoolRun();
$spool = new SpoolRun();
$spool->setConfig($setup);
$oSpool->setConfig($aSetup);
$oCase = new Cases();
$oldFields = $oCase->loadCase($caseId);
$case = new Cases();
$oldFields = $case->loadCase($appUid);
if ($gmail == 1) {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
} else {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP . $oldFields['PRO_UID'] . PATH_SEP;
}
$fileTemplate = $pathEmail . $sTemplate;
$fileTemplate = $pathEmail . $template;
G::mk_dir($pathEmail, 0777, true);
if (!file_exists($fileTemplate)) {
@@ -865,48 +872,45 @@ class WsBase
}
if ($appFields == null) {
$Fields = $oldFields['APP_DATA'];
$fieldsCase = $oldFields['APP_DATA'];
} else {
$Fields = array_merge($oldFields['APP_DATA'], $appFields);
$fieldsCase = array_merge($oldFields['APP_DATA'], $appFields);
}
$sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $Fields, false);
$sFrom = G::buildFrom($aSetup, $sFrom);
$showMessage = ($showMessage) ? 1 : 0;
$messageArray = array(
"msg_uid" => "",
"app_uid" => $caseId,
"del_index" => $delIndex,
"app_msg_type" => "TRIGGER",
"app_msg_subject" => $sSubject,
"app_msg_from" => $sFrom,
"app_msg_to" => $sTo,
"app_msg_body" => $sBody,
"app_msg_cc" => $sCc,
"app_msg_bcc" => $sBcc,
"app_msg_attach" => $aAttachment,
"app_msg_template" => "",
"app_msg_status" => "pending",
"app_msg_show_message" => $showMessage,
"app_msg_error" => $msgError,
"contentTypeIsHtml" => (preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false
$messageArray = AppMessage::buildMessageRow(
'',
$appUid,
$delIndex,
'TRIGGER',
$subject,
G::buildFrom($setup, $from),
$to,
G::replaceDataGridField(file_get_contents($fileTemplate), $fieldsCase, false),
$cc,
$bcc,
'',
'',
'pending',
($showMessage) ? 1 : 0,
$msgError,
(preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false,
isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0,
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
isset($fieldsCase['TAS_ID']) ? $fieldsCase['TAS_ID'] : 0
);
$spool->create($messageArray);
$oSpool->create($messageArray);
if ($gmail != 1) {
$oSpool->sendMail();
if ($oSpool->status == 'sent') {
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $sTo);
} else {
$result = new WsResponse(29, $oSpool->status . ' ' . $oSpool->error . print_r($aSetup, 1));
}
} else {
$result = "";
if ($gmail != 1) {
$spool->sendMail();
if ($spool->status == 'sent') {
$result = new WsResponse(0, G::loadTranslation('ID_MESSAGE_SENT') . ": " . $to);
} else {
$result = new WsResponse(29, $spool->status . ' ' . $spool->error . print_r($setup, 1));
}
}
return $result;
} catch (Exception $e) {
return new WsResponse(100, $e->getMessage());
@@ -2315,19 +2319,26 @@ class WsBase
$sFromName = "\"" . $arrayUserData["USR_FIRSTNAME"] . " " . $arrayUserData["USR_LASTNAME"] . "\" <" . $arrayUserData["USR_EMAIL"] . ">";
}
$oCase->sendNotifications($appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName);
$process = new Process();
$processFieds = $process->Load($appFields['PRO_UID']);
$appFields['APP_DATA']['PRO_ID'] = $processFieds['PRO_ID'];
$oCase->sendNotifications(
$appdel['TAS_UID'],
$nextDelegations,
$appFields['APP_DATA'],
$caseId,
$delIndex,
$sFromName
);
$oProcess = new Process();
$oProcessFieds = $oProcess->Load($appFields['PRO_UID']);
//here debug mode in web entry
if (isset($oProcessFieds['PRO_DEBUG']) && $oProcessFieds['PRO_DEBUG']) {
if (isset($processFieds['PRO_DEBUG']) && $processFieds['PRO_DEBUG']) {
$result = new WsResponse(0, $varResponse . "
<br><br><table width='100%' cellpadding='0' cellspacing='0'><tr><td class='FormTitle'>
" . G::LoadTranslation('ID_DEBUG_MESSAGE') . "</td></tr></table>" . $varTriggers);
} else {
$result = new WsResponse(0, $varResponse . " --- " . $oProcessFieds['PRO_DEBUG']);
$result = new WsResponse(0, $varResponse . " --- " . $processFieds['PRO_DEBUG']);
}
$res = $result->getPayloadArray();

View File

@@ -113,6 +113,46 @@ class AbeConfiguration extends BaseAbeConfiguration
throw $error;
}
}
/**
* Get configuration from ABE related to the task
*
* @param string $proUid
* @param string $tasUid
*
* @return array
*/
public function getTaskConfiguration ($proUid, $tasUid)
{
$criteria = new Criteria();
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TYPE);
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
$criteria->addSelectColumn(TaskPeer::TAS_ID);
$criteria->addSelectColumn(ProcessPeer::PRO_ID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_DYN_TYPE);
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_EMAIL_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_SUBJECT_FIELD);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_MAILSERVER_OR_MAILCURRENT);
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_CUSTOM_GRID);
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
$criteria->addJoin( AbeConfigurationPeer::DYN_UID, DynaformPeer::DYN_UID, Criteria::LEFT_JOIN );
$criteria->addJoin(AbeConfigurationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AbeConfigurationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->add(AbeConfigurationPeer::PRO_UID, $proUid);
$criteria->add(AbeConfigurationPeer::TAS_UID, $tasUid);
$criteria->setLimit(1);
$result = AbeConfigurationPeer::doSelectRS($criteria);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
$configuration = $result->getRow();
return $configuration;
}
}
// AbeConfiguration

View File

@@ -81,6 +81,48 @@ class AbeRequests extends BaseAbeRequests
throw $error;
}
}
/**
* Get information about the notification sent
*
* @param string $abeRequestUid
*
* @return array
*/
public function getAbeRequest ($abeRequestUid)
{
$criteria = new Criteria();
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
$criteria->addSelectColumn(TaskPeer::TAS_ID);
$criteria->addSelectColumn(ProcessPeer::PRO_ID);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
$criteria->addSelectColumn(AppDelegationPeer::APP_NUMBER);
$criteria->addJoin(AbeConfigurationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AbeConfigurationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID, Criteria::LEFT_JOIN);
$conditions[] = [AbeRequestsPeer::APP_UID, AppDelegationPeer::APP_UID];
$conditions[] = [AbeRequestsPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX];
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $abeRequestUid);
$criteria->setLimit(1);
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$resultRes->next();
$infoRequest = $resultRes->getRow();
return $infoRequest;
}
}
// AbeRequests

View File

@@ -305,21 +305,26 @@ class AppDelegation extends BaseAppDelegation
/**
* Load the Application Delegation row specified in [app_id] column value.
*
* @param string $AppUid the uid of the application
* @param string $appUid the uid of the application
* @param integer $delIndex
*
* @return array $Fields the fields
*
* @throws Exception
*/
public function Load ($AppUid, $sDelIndex)
public function Load ($appUid, $delIndex)
{
$con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME);
try {
$oAppDel = AppDelegationPeer::retrieveByPk( $AppUid, $sDelIndex );
$oAppDel = AppDelegationPeer::retrieveByPk($appUid, $delIndex);
if (is_object($oAppDel) && get_class($oAppDel) == 'AppDelegation') {
$aFields = $oAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$this->fromArray( $aFields, BasePeer::TYPE_FIELDNAME );
return $aFields;
$fields = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
return $fields;
} else {
throw (new Exception( "The row '$AppUid, $sDelIndex' in table AppDelegation doesn't exist!" ));
throw (new Exception("The row '$appUid, $delIndex' in table AppDelegation doesn't exist!"));
}
} catch (Exception $oError) {
throw ($oError);
@@ -955,4 +960,44 @@ class AppDelegation extends BaseAppDelegation
}
}
/**
* Get the user assigned in the index
*
* @param string $appUid
* @param string $delIndex
*
* @return string|null
*/
public function getUserAssignedInThread($appUid, $delIndex)
{
$currentUserUid = null;
$result = $this->Load($appUid, $delIndex);
if (isset($result["USR_UID"])) {
$currentUserUid = $result["USR_UID"];
}
return $currentUserUid;
}
/**
* Get column PRO_ID related to the APP_NUMBER
*
* @param integer $appNumber
*
* @return integer
*/
public function getProcessId($appNumber)
{
$proId = 0;
$criteria = new Criteria("workflow");
$criteria->add(AppDelegationPeer::APP_NUMBER, $appNumber);
$dataset = AppDelegationPeer::doSelectOne($criteria);
if (!is_null($dataset)) {
$proId = $dataset->getProId();
}
return $proId;
}
}

View File

@@ -1,29 +1,4 @@
<?php
/**
* AppMessage.php
* * @package workflow.engine.classes.model
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
//require_once 'classes/model/om/BaseAppMessage.php';
/**
* Skeleton subclass for representing a row from the 'APP_MESSAGE' table.
@@ -39,9 +14,18 @@
class AppMessage extends BaseAppMessage
{
const TYPE_TEST = 1;
const TYPE_TRIGGER = 2;
const TYPE_DERIVATION = 3;
const TYPE_EXTERNAL_REGISTRATION = 4;
const MESSAGE_STATUS_SENT = 1;
const MESSAGE_STATUS_PENDING = 2;
const MESSAGE_STATUS_FAILED = 3;
private $data_spool;
private $status_spool;
private $error_spool;
public static $app_msg_status_values = ['sent' => 1, 'pending' => 2, 'failed' => 3];
public static $app_msg_type_values = ['TEST' => 1, 'TRIGGER' => 2, 'DERIVATION' => 3, 'EXTERNAL_REGISTRATION' => 4];
public function getSpoolStatus ()
{
@@ -54,13 +38,10 @@ class AppMessage extends BaseAppMessage
}
/**
* AppMessgae quick Save method
* @deprecated version 3.2.4
*
* @param Array(msg_uid, app_uid, del_index, app_msg_type, app_msg_subject, app_msg_from, app_msg_to,
* app_msg_body, app_msg_cc, app_msg_bcc, app_msg_attach, app_msg_template, app_msg_status )
* This function is not used in the core
*
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmai.com>
* Date Aug 31th, 2009
*/
public function quickSave2 ($data_spool)
{
@@ -104,6 +85,12 @@ class AppMessage extends BaseAppMessage
return $sUID;
}
/**
* @deprecated version 3.2.4
*
* This function is not used in the core
*
*/
public function quickSave ($aData)
{
if (isset( $aData['app_msg_uid'] )) {
@@ -122,12 +109,196 @@ class AppMessage extends BaseAppMessage
}
}
public function updateStatus($msgUid, $msgStatus)
/**
* Update the column APP_MSG_STATUS
*
* @param string $msgUid
* @param integer $msgStatusId
*
* @return void
*
*/
public function updateStatus($msgUid, $msgStatusId)
{
$message = AppMessagePeer::retrieveByPk($msgUid);
$message->fromArray($message, BasePeer::TYPE_FIELDNAME);
$message->setAppMsgStatusId($msgStatusId);
$msgStatus = array_search($msgStatusId, self::$app_msg_status_values);
$message->setAppMsgStatus($msgStatus);
$message->save();
}
/**
* Get all status and labels
*
* @return array
*/
public static function getAllStatus()
{
$status = [];
$status[] = ['', G::LoadTranslation('ID_ALL')];
foreach (AppMessage::$app_msg_status_values as $key => $value) {
$status[] = [$value, G::LoadTranslation('ID_' . strtoupper($key))];
}
return $status;
}
/**
* Build the row for the message to be inserted
*
* @param string $msgUid,
* @param string $appUid,
* @param integer $delIndex,
* @param string $appMsgType,
* @param string $appMsgSubject,
* @param string $appMsgFrom,
* @param string $appMsgTo,
* @param string $appMsgBody,
* @param string $appMsgCc,
* @param string $appMsgBcc,
* @param string $appMsgTemplate,
* @param string $appMsgAttach,
* @param string $appMsgStatus,
* @param string $appMsgShowMsg,
* @param string $appMsgError,
* @param boolean $contentTypeIsHtml
* @param integer $appNumber,
* @param integer $proId,
* @param integer $tasId,
*
* @return array
*/
public static function buildMessageRow(
$msgUid = '',
$appUid = '',
$delIndex = 0,
$appMsgType = '',
$appMsgSubject = '',
$appMsgFrom = '',
$appMsgTo = '',
$appMsgBody = '',
$appMsgCc = '',
$appMsgBcc = '',
$appMsgTemplate = '',
$appMsgAttach = '',
$appMsgStatus = 'pending',
$appMsgShowMsg = '',
$appMsgError = '',
$contentTypeIsHtml = true,
$appNumber = 0,
$proId = 0,
$tasId = 0
)
{
$message = [
"msg_uid" => $msgUid,
"app_uid" => $appUid,
"del_index" => $delIndex,
"app_msg_type" => $appMsgType,
"app_msg_type_id" => isset(AppMessage::$app_msg_type_values[$appMsgType]) ? AppMessage::$app_msg_type_values[$appMsgType] : 0,
"app_msg_subject" => $appMsgSubject,
"app_msg_from" => $appMsgFrom,
"app_msg_to" => $appMsgTo,
"app_msg_body" => $appMsgBody,
"app_msg_date" => '',
"app_msg_cc" => $appMsgCc,
"app_msg_bcc" => $appMsgBcc,
"app_msg_template" => $appMsgTemplate,
"app_msg_status" => $appMsgStatus,
"app_msg_status_id" => isset(AppMessage::$app_msg_status_values[$appMsgStatus]) ? AppMessage::$app_msg_status_values[$appMsgStatus] : 0,
"app_msg_attach" => $appMsgAttach,
"app_msg_send_date" => '',
"app_msg_show_message" => $appMsgShowMsg,
"app_msg_error" => $appMsgError,
"contentTypeIsHtml" => $contentTypeIsHtml,
"app_number" => $appNumber,
"pro_id" => $proId,
"tas_id" => $tasId
];
return $message;
}
/**
* Get the initial criteria for the appMessage
*
* @param int $appNumber
* @param boolean $onlyVisible
*
* @return Criteria
*/
public function getInitialCriteria($appNumber, $onlyVisible = true)
{
$criteria = new Criteria('workflow');
//Search by appNumber
$criteria->add(AppMessagePeer::APP_NUMBER, $appNumber);
//Visible: if the user can be resend the email
if ($onlyVisible) {
$criteria->add(AppMessagePeer::APP_MSG_SHOW_MESSAGE, 1);
}
return $criteria;
}
/**
* Returns the number of cases of a user
*
* @param int $appNumber
* @param boolean $onlyVisible
*
* @return int
*/
public function getCountMessage($appNumber, $onlyVisible = true)
{
$criteria = $this->getInitialCriteria($appNumber, $onlyVisible);
return AppMessagePeer::doCount($criteria);
}
/**
* Get the data by appNumber
*
* @param int $appNumber
* @param boolean $onlyVisible
* @param integer $start
* @param integer $limit
* @param string $sort
* @param string $dir
*
* @return array
*/
public function getDataMessage($appNumber, $onlyVisible = true, $start = null, $limit = null, $sort = null, $dir = 'DESC')
{
$criteria = $this->getInitialCriteria($appNumber, $onlyVisible);
if (empty($sort)) {
$sort = AppMessagePeer::APP_MSG_DATE;
}
if ($dir == 'DESC') {
$criteria->addDescendingOrderByColumn($sort);
} else {
$criteria->addAscendingOrderByColumn($sort);
}
if (!is_null($limit) && !is_null($start)) {
$criteria->setLimit($limit);
$criteria->setOffset($start);
}
$dataset = AppMessagePeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$messages = [];
while ($row = $dataset->getRow()) {
//Head for IE quirks mode
$row['APP_MSG_BODY'] = '<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />' . $row['APP_MSG_BODY'];
$messages[] = $row;
$dataset->next();
}
return $messages;
}
}

View File

@@ -145,73 +145,83 @@ class AppNotes extends BaseAppNotes
return $response;
}
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
/**
* Case note notification
*
* @param string $appUid
* @param string $usrUid
* @param string $noteContent
* @param string $noteRecipients
* @param string $from
* @param integer $delIndex
*
* @throws Exception
*/
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $from = '', $delIndex = 0)
{
try {
$aConfiguration = System::getEmailConfiguration();
$configuration = System::getEmailConfiguration();
$msgError = "";
if (! isset( $aConfiguration['MESS_ENABLED'] ) || $aConfiguration['MESS_ENABLED'] != '1') {
if (! isset( $configuration['MESS_ENABLED'] ) || $configuration['MESS_ENABLED'] != '1') {
$msgError = "The default configuration wasn't defined";
$aConfiguration['MESS_ENGINE'] = '';
$configuration['MESS_ENGINE'] = '';
}
$oUser = new Users();
$aUser = $oUser->load( $usrUid );
$authorName = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
$users = new Users();
$userInfo = $users->load($usrUid);
$authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
$oCase = new Cases();
$aFields = $oCase->loadCase( $appUid );
$cases = new Cases();
$fieldCase = $cases->loadCase($appUid, $delIndex);
$configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE ";
//Define the body for the notification
$body = G::LoadTranslation('ID_CASE_TITLE') . ": @#APP_TITLE<br />";
$body .= G::LoadTranslation('ID_CASE_NUMBER') . ": @#APP_NUMBER<br />";
$body .= G::LoadTranslation('ID_AUTHOR') . ": $authorName<br /><br />$noteContent";
$configNoteNotification['body'] = $body;
$configNoteNotification['body'] = $this->getBodyCaseNote($authorName, $noteContent);
$body = nl2br(G::replaceDataField($configNoteNotification['body'], $fieldCase));
$sFrom = G::buildFrom($aConfiguration, $sFrom);
$sSubject = G::replaceDataField( $configNoteNotification['subject'], $aFields );
$sBody = nl2br( G::replaceDataField( $configNoteNotification['body'], $aFields ) );
$oUser = new Users();
$users = new Users();
$recipientsArray = explode(",", $noteRecipients);
foreach ($recipientsArray as $recipientUid) {
$userInfo = $users->load($recipientUid);
$to = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>';
$aUser = $oUser->load( $recipientUid );
$sTo = ((($aUser['USR_FIRSTNAME'] != '') || ($aUser['USR_LASTNAME'] != '')) ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
$oSpool = new SpoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(
array ('msg_uid' => '',
'app_uid' => $appUid,
'del_index' => 0,
'app_msg_type' => 'DERIVATION',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $sTo,
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_error' => $msgError
)
$spool = new SpoolRun();
$spool->setConfig($configuration);
$messageArray = AppMessage::buildMessageRow(
'',
$appUid,
$delIndex,
'DERIVATION',
G::replaceDataField($configNoteNotification['subject'], $fieldCase),
G::buildFrom($configuration, $from),
$to,
$body,
'',
'',
'',
'',
'pending',
'',
$msgError,
true,
(isset($fieldCase['APP_NUMBER'])) ? $fieldCase['APP_NUMBER'] : 0,
(isset($fieldCase['PRO_ID'])) ? $fieldCase['PRO_ID'] : 0,
(isset($fieldCase['TAS_ID'])) ? $fieldCase['TAS_ID'] : 0
);
$spool->create($messageArray);
if ($msgError == '') {
if (($aConfiguration['MESS_BACKGROUND'] == '') || ($aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
$oSpool->sendMail();
if (($configuration['MESS_BACKGROUND'] == '') || ($configuration['MESS_TRY_SEND_INMEDIATLY'] == '1')) {
$spool->sendMail();
}
}
}
//Send derivation notification - End
} catch (Exception $oException) {
throw $oException;
} catch (Exception $exception) {
throw $exception;
}
}
@@ -256,5 +266,22 @@ class AppNotes extends BaseAppNotes
return $notes;
}
/**
* Define the body for the case note notification
*
* @param string $authorName
* @param string $noteContent
*
* @return string
*/
private function getBodyCaseNote($authorName = '', $noteContent = '')
{
$body = G::LoadTranslation('ID_CASE_TITLE') . ': @#APP_TITLE<br />';
$body .= G::LoadTranslation('ID_CASE_NUMBER') . ': @#APP_NUMBER<br />';
$body .= G::LoadTranslation('ID_AUTHOR') . ': ' . $authorName . '<br /><br />' . $noteContent;
return $body;
}
}

View File

@@ -75,6 +75,8 @@ class AppMessageMapBuilder
$tMap->addColumn('APP_MSG_TYPE', 'AppMsgType', 'string', CreoleTypes::VARCHAR, true, 100);
$tMap->addColumn('APP_MSG_TYPE_ID', 'AppMsgTypeId', 'int', CreoleTypes::TINYINT, false, null);
$tMap->addColumn('APP_MSG_SUBJECT', 'AppMsgSubject', 'string', CreoleTypes::VARCHAR, true, 150);
$tMap->addColumn('APP_MSG_FROM', 'AppMsgFrom', 'string', CreoleTypes::VARCHAR, true, 100);
@@ -93,6 +95,8 @@ class AppMessageMapBuilder
$tMap->addColumn('APP_MSG_STATUS', 'AppMsgStatus', 'string', CreoleTypes::VARCHAR, false, 20);
$tMap->addColumn('APP_MSG_STATUS_ID', 'AppMsgStatusId', 'int', CreoleTypes::TINYINT, false, null);
$tMap->addColumn('APP_MSG_ATTACH', 'AppMsgAttach', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('APP_MSG_SEND_DATE', 'AppMsgSendDate', 'int', CreoleTypes::TIMESTAMP, true, null);
@@ -101,6 +105,8 @@ class AppMessageMapBuilder
$tMap->addColumn('APP_MSG_ERROR', 'AppMsgError', 'string', CreoleTypes::LONGVARCHAR, false, null);
$tMap->addColumn('PRO_ID', 'ProId', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('TAS_ID', 'TasId', 'int', CreoleTypes::INTEGER, false, null);
$tMap->addColumn('APP_NUMBER', 'AppNumber', 'int', CreoleTypes::INTEGER, false, null);

View File

@@ -57,6 +57,12 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
*/
protected $app_msg_type = '';
/**
* The value for the app_msg_type_id field.
* @var int
*/
protected $app_msg_type_id = 0;
/**
* The value for the app_msg_subject field.
* @var string
@@ -111,6 +117,12 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
*/
protected $app_msg_status;
/**
* The value for the app_msg_status_id field.
* @var int
*/
protected $app_msg_status_id = 0;
/**
* The value for the app_msg_attach field.
* @var string
@@ -135,6 +147,12 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
*/
protected $app_msg_error;
/**
* The value for the pro_id field.
* @var int
*/
protected $pro_id = 0;
/**
* The value for the tas_id field.
* @var int
@@ -216,6 +234,17 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
return $this->app_msg_type;
}
/**
* Get the [app_msg_type_id] column value.
*
* @return int
*/
public function getAppMsgTypeId()
{
return $this->app_msg_type_id;
}
/**
* Get the [app_msg_subject] column value.
*
@@ -336,6 +365,17 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
return $this->app_msg_status;
}
/**
* Get the [app_msg_status_id] column value.
*
* @return int
*/
public function getAppMsgStatusId()
{
return $this->app_msg_status_id;
}
/**
* Get the [app_msg_attach] column value.
*
@@ -401,6 +441,17 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
return $this->app_msg_error;
}
/**
* Get the [pro_id] column value.
*
* @return int
*/
public function getProId()
{
return $this->pro_id;
}
/**
* Get the [tas_id] column value.
*
@@ -533,6 +584,28 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
} // setAppMsgType()
/**
* Set the value of [app_msg_type_id] column.
*
* @param int $v new value
* @return void
*/
public function setAppMsgTypeId($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->app_msg_type_id !== $v || $v === 0) {
$this->app_msg_type_id = $v;
$this->modifiedColumns[] = AppMessagePeer::APP_MSG_TYPE_ID;
}
} // setAppMsgTypeId()
/**
* Set the value of [app_msg_subject] column.
*
@@ -738,6 +811,28 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
} // setAppMsgStatus()
/**
* Set the value of [app_msg_status_id] column.
*
* @param int $v new value
* @return void
*/
public function setAppMsgStatusId($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->app_msg_status_id !== $v || $v === 0) {
$this->app_msg_status_id = $v;
$this->modifiedColumns[] = AppMessagePeer::APP_MSG_STATUS_ID;
}
} // setAppMsgStatusId()
/**
* Set the value of [app_msg_attach] column.
*
@@ -833,6 +928,28 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
} // setAppMsgError()
/**
* Set the value of [pro_id] column.
*
* @param int $v new value
* @return void
*/
public function setProId($v)
{
// Since the native PHP type for this column is integer,
// we will cast the input value to an int (if it is not).
if ($v !== null && !is_int($v) && is_numeric($v)) {
$v = (int) $v;
}
if ($this->pro_id !== $v || $v === 0) {
$this->pro_id = $v;
$this->modifiedColumns[] = AppMessagePeer::PRO_ID;
}
} // setProId()
/**
* Set the value of [tas_id] column.
*
@@ -904,42 +1021,48 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$this->app_msg_type = $rs->getString($startcol + 4);
$this->app_msg_subject = $rs->getString($startcol + 5);
$this->app_msg_type_id = $rs->getInt($startcol + 5);
$this->app_msg_from = $rs->getString($startcol + 6);
$this->app_msg_subject = $rs->getString($startcol + 6);
$this->app_msg_to = $rs->getString($startcol + 7);
$this->app_msg_from = $rs->getString($startcol + 7);
$this->app_msg_body = $rs->getString($startcol + 8);
$this->app_msg_to = $rs->getString($startcol + 8);
$this->app_msg_date = $rs->getTimestamp($startcol + 9, null);
$this->app_msg_body = $rs->getString($startcol + 9);
$this->app_msg_cc = $rs->getString($startcol + 10);
$this->app_msg_date = $rs->getTimestamp($startcol + 10, null);
$this->app_msg_bcc = $rs->getString($startcol + 11);
$this->app_msg_cc = $rs->getString($startcol + 11);
$this->app_msg_template = $rs->getString($startcol + 12);
$this->app_msg_bcc = $rs->getString($startcol + 12);
$this->app_msg_status = $rs->getString($startcol + 13);
$this->app_msg_template = $rs->getString($startcol + 13);
$this->app_msg_attach = $rs->getString($startcol + 14);
$this->app_msg_status = $rs->getString($startcol + 14);
$this->app_msg_send_date = $rs->getTimestamp($startcol + 15, null);
$this->app_msg_status_id = $rs->getInt($startcol + 15);
$this->app_msg_show_message = $rs->getInt($startcol + 16);
$this->app_msg_attach = $rs->getString($startcol + 16);
$this->app_msg_error = $rs->getString($startcol + 17);
$this->app_msg_send_date = $rs->getTimestamp($startcol + 17, null);
$this->tas_id = $rs->getInt($startcol + 18);
$this->app_msg_show_message = $rs->getInt($startcol + 18);
$this->app_number = $rs->getInt($startcol + 19);
$this->app_msg_error = $rs->getString($startcol + 19);
$this->pro_id = $rs->getInt($startcol + 20);
$this->tas_id = $rs->getInt($startcol + 21);
$this->app_number = $rs->getInt($startcol + 22);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 20; // 20 = AppMessagePeer::NUM_COLUMNS - AppMessagePeer::NUM_LAZY_LOAD_COLUMNS).
return $startcol + 23; // 23 = AppMessagePeer::NUM_COLUMNS - AppMessagePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating AppMessage object", $e);
@@ -1159,48 +1282,57 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
return $this->getAppMsgType();
break;
case 5:
return $this->getAppMsgSubject();
return $this->getAppMsgTypeId();
break;
case 6:
return $this->getAppMsgFrom();
return $this->getAppMsgSubject();
break;
case 7:
return $this->getAppMsgTo();
return $this->getAppMsgFrom();
break;
case 8:
return $this->getAppMsgBody();
return $this->getAppMsgTo();
break;
case 9:
return $this->getAppMsgDate();
return $this->getAppMsgBody();
break;
case 10:
return $this->getAppMsgCc();
return $this->getAppMsgDate();
break;
case 11:
return $this->getAppMsgBcc();
return $this->getAppMsgCc();
break;
case 12:
return $this->getAppMsgTemplate();
return $this->getAppMsgBcc();
break;
case 13:
return $this->getAppMsgStatus();
return $this->getAppMsgTemplate();
break;
case 14:
return $this->getAppMsgAttach();
return $this->getAppMsgStatus();
break;
case 15:
return $this->getAppMsgSendDate();
return $this->getAppMsgStatusId();
break;
case 16:
return $this->getAppMsgShowMessage();
return $this->getAppMsgAttach();
break;
case 17:
return $this->getAppMsgError();
return $this->getAppMsgSendDate();
break;
case 18:
return $this->getTasId();
return $this->getAppMsgShowMessage();
break;
case 19:
return $this->getAppMsgError();
break;
case 20:
return $this->getProId();
break;
case 21:
return $this->getTasId();
break;
case 22:
return $this->getAppNumber();
break;
default:
@@ -1228,21 +1360,24 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$keys[2] => $this->getAppUid(),
$keys[3] => $this->getDelIndex(),
$keys[4] => $this->getAppMsgType(),
$keys[5] => $this->getAppMsgSubject(),
$keys[6] => $this->getAppMsgFrom(),
$keys[7] => $this->getAppMsgTo(),
$keys[8] => $this->getAppMsgBody(),
$keys[9] => $this->getAppMsgDate(),
$keys[10] => $this->getAppMsgCc(),
$keys[11] => $this->getAppMsgBcc(),
$keys[12] => $this->getAppMsgTemplate(),
$keys[13] => $this->getAppMsgStatus(),
$keys[14] => $this->getAppMsgAttach(),
$keys[15] => $this->getAppMsgSendDate(),
$keys[16] => $this->getAppMsgShowMessage(),
$keys[17] => $this->getAppMsgError(),
$keys[18] => $this->getTasId(),
$keys[19] => $this->getAppNumber(),
$keys[5] => $this->getAppMsgTypeId(),
$keys[6] => $this->getAppMsgSubject(),
$keys[7] => $this->getAppMsgFrom(),
$keys[8] => $this->getAppMsgTo(),
$keys[9] => $this->getAppMsgBody(),
$keys[10] => $this->getAppMsgDate(),
$keys[11] => $this->getAppMsgCc(),
$keys[12] => $this->getAppMsgBcc(),
$keys[13] => $this->getAppMsgTemplate(),
$keys[14] => $this->getAppMsgStatus(),
$keys[15] => $this->getAppMsgStatusId(),
$keys[16] => $this->getAppMsgAttach(),
$keys[17] => $this->getAppMsgSendDate(),
$keys[18] => $this->getAppMsgShowMessage(),
$keys[19] => $this->getAppMsgError(),
$keys[20] => $this->getProId(),
$keys[21] => $this->getTasId(),
$keys[22] => $this->getAppNumber(),
);
return $result;
}
@@ -1290,48 +1425,57 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$this->setAppMsgType($value);
break;
case 5:
$this->setAppMsgSubject($value);
$this->setAppMsgTypeId($value);
break;
case 6:
$this->setAppMsgFrom($value);
$this->setAppMsgSubject($value);
break;
case 7:
$this->setAppMsgTo($value);
$this->setAppMsgFrom($value);
break;
case 8:
$this->setAppMsgBody($value);
$this->setAppMsgTo($value);
break;
case 9:
$this->setAppMsgDate($value);
$this->setAppMsgBody($value);
break;
case 10:
$this->setAppMsgCc($value);
$this->setAppMsgDate($value);
break;
case 11:
$this->setAppMsgBcc($value);
$this->setAppMsgCc($value);
break;
case 12:
$this->setAppMsgTemplate($value);
$this->setAppMsgBcc($value);
break;
case 13:
$this->setAppMsgStatus($value);
$this->setAppMsgTemplate($value);
break;
case 14:
$this->setAppMsgAttach($value);
$this->setAppMsgStatus($value);
break;
case 15:
$this->setAppMsgSendDate($value);
$this->setAppMsgStatusId($value);
break;
case 16:
$this->setAppMsgShowMessage($value);
$this->setAppMsgAttach($value);
break;
case 17:
$this->setAppMsgError($value);
$this->setAppMsgSendDate($value);
break;
case 18:
$this->setTasId($value);
$this->setAppMsgShowMessage($value);
break;
case 19:
$this->setAppMsgError($value);
break;
case 20:
$this->setProId($value);
break;
case 21:
$this->setTasId($value);
break;
case 22:
$this->setAppNumber($value);
break;
} // switch()
@@ -1378,63 +1522,75 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
}
if (array_key_exists($keys[5], $arr)) {
$this->setAppMsgSubject($arr[$keys[5]]);
$this->setAppMsgTypeId($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setAppMsgFrom($arr[$keys[6]]);
$this->setAppMsgSubject($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setAppMsgTo($arr[$keys[7]]);
$this->setAppMsgFrom($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setAppMsgBody($arr[$keys[8]]);
$this->setAppMsgTo($arr[$keys[8]]);
}
if (array_key_exists($keys[9], $arr)) {
$this->setAppMsgDate($arr[$keys[9]]);
$this->setAppMsgBody($arr[$keys[9]]);
}
if (array_key_exists($keys[10], $arr)) {
$this->setAppMsgCc($arr[$keys[10]]);
$this->setAppMsgDate($arr[$keys[10]]);
}
if (array_key_exists($keys[11], $arr)) {
$this->setAppMsgBcc($arr[$keys[11]]);
$this->setAppMsgCc($arr[$keys[11]]);
}
if (array_key_exists($keys[12], $arr)) {
$this->setAppMsgTemplate($arr[$keys[12]]);
$this->setAppMsgBcc($arr[$keys[12]]);
}
if (array_key_exists($keys[13], $arr)) {
$this->setAppMsgStatus($arr[$keys[13]]);
$this->setAppMsgTemplate($arr[$keys[13]]);
}
if (array_key_exists($keys[14], $arr)) {
$this->setAppMsgAttach($arr[$keys[14]]);
$this->setAppMsgStatus($arr[$keys[14]]);
}
if (array_key_exists($keys[15], $arr)) {
$this->setAppMsgSendDate($arr[$keys[15]]);
$this->setAppMsgStatusId($arr[$keys[15]]);
}
if (array_key_exists($keys[16], $arr)) {
$this->setAppMsgShowMessage($arr[$keys[16]]);
$this->setAppMsgAttach($arr[$keys[16]]);
}
if (array_key_exists($keys[17], $arr)) {
$this->setAppMsgError($arr[$keys[17]]);
$this->setAppMsgSendDate($arr[$keys[17]]);
}
if (array_key_exists($keys[18], $arr)) {
$this->setTasId($arr[$keys[18]]);
$this->setAppMsgShowMessage($arr[$keys[18]]);
}
if (array_key_exists($keys[19], $arr)) {
$this->setAppNumber($arr[$keys[19]]);
$this->setAppMsgError($arr[$keys[19]]);
}
if (array_key_exists($keys[20], $arr)) {
$this->setProId($arr[$keys[20]]);
}
if (array_key_exists($keys[21], $arr)) {
$this->setTasId($arr[$keys[21]]);
}
if (array_key_exists($keys[22], $arr)) {
$this->setAppNumber($arr[$keys[22]]);
}
}
@@ -1468,6 +1624,10 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$criteria->add(AppMessagePeer::APP_MSG_TYPE, $this->app_msg_type);
}
if ($this->isColumnModified(AppMessagePeer::APP_MSG_TYPE_ID)) {
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, $this->app_msg_type_id);
}
if ($this->isColumnModified(AppMessagePeer::APP_MSG_SUBJECT)) {
$criteria->add(AppMessagePeer::APP_MSG_SUBJECT, $this->app_msg_subject);
}
@@ -1504,6 +1664,10 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$criteria->add(AppMessagePeer::APP_MSG_STATUS, $this->app_msg_status);
}
if ($this->isColumnModified(AppMessagePeer::APP_MSG_STATUS_ID)) {
$criteria->add(AppMessagePeer::APP_MSG_STATUS_ID, $this->app_msg_status_id);
}
if ($this->isColumnModified(AppMessagePeer::APP_MSG_ATTACH)) {
$criteria->add(AppMessagePeer::APP_MSG_ATTACH, $this->app_msg_attach);
}
@@ -1520,6 +1684,10 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$criteria->add(AppMessagePeer::APP_MSG_ERROR, $this->app_msg_error);
}
if ($this->isColumnModified(AppMessagePeer::PRO_ID)) {
$criteria->add(AppMessagePeer::PRO_ID, $this->pro_id);
}
if ($this->isColumnModified(AppMessagePeer::TAS_ID)) {
$criteria->add(AppMessagePeer::TAS_ID, $this->tas_id);
}
@@ -1590,6 +1758,8 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$copyObj->setAppMsgType($this->app_msg_type);
$copyObj->setAppMsgTypeId($this->app_msg_type_id);
$copyObj->setAppMsgSubject($this->app_msg_subject);
$copyObj->setAppMsgFrom($this->app_msg_from);
@@ -1608,6 +1778,8 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$copyObj->setAppMsgStatus($this->app_msg_status);
$copyObj->setAppMsgStatusId($this->app_msg_status_id);
$copyObj->setAppMsgAttach($this->app_msg_attach);
$copyObj->setAppMsgSendDate($this->app_msg_send_date);
@@ -1616,6 +1788,8 @@ abstract class BaseAppMessage extends BaseObject implements Persistent
$copyObj->setAppMsgError($this->app_msg_error);
$copyObj->setProId($this->pro_id);
$copyObj->setTasId($this->tas_id);
$copyObj->setAppNumber($this->app_number);

View File

@@ -25,7 +25,7 @@ abstract class BaseAppMessagePeer
const CLASS_DEFAULT = 'classes.model.AppMessage';
/** The total number of columns. */
const NUM_COLUMNS = 20;
const NUM_COLUMNS = 23;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
@@ -46,6 +46,9 @@ abstract class BaseAppMessagePeer
/** the column name for the APP_MSG_TYPE field */
const APP_MSG_TYPE = 'APP_MESSAGE.APP_MSG_TYPE';
/** the column name for the APP_MSG_TYPE_ID field */
const APP_MSG_TYPE_ID = 'APP_MESSAGE.APP_MSG_TYPE_ID';
/** the column name for the APP_MSG_SUBJECT field */
const APP_MSG_SUBJECT = 'APP_MESSAGE.APP_MSG_SUBJECT';
@@ -73,6 +76,9 @@ abstract class BaseAppMessagePeer
/** the column name for the APP_MSG_STATUS field */
const APP_MSG_STATUS = 'APP_MESSAGE.APP_MSG_STATUS';
/** the column name for the APP_MSG_STATUS_ID field */
const APP_MSG_STATUS_ID = 'APP_MESSAGE.APP_MSG_STATUS_ID';
/** the column name for the APP_MSG_ATTACH field */
const APP_MSG_ATTACH = 'APP_MESSAGE.APP_MSG_ATTACH';
@@ -85,6 +91,9 @@ abstract class BaseAppMessagePeer
/** the column name for the APP_MSG_ERROR field */
const APP_MSG_ERROR = 'APP_MESSAGE.APP_MSG_ERROR';
/** the column name for the PRO_ID field */
const PRO_ID = 'APP_MESSAGE.PRO_ID';
/** the column name for the TAS_ID field */
const TAS_ID = 'APP_MESSAGE.TAS_ID';
@@ -102,10 +111,10 @@ abstract class BaseAppMessagePeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('AppMsgUid', 'MsgUid', 'AppUid', 'DelIndex', 'AppMsgType', 'AppMsgSubject', 'AppMsgFrom', 'AppMsgTo', 'AppMsgBody', 'AppMsgDate', 'AppMsgCc', 'AppMsgBcc', 'AppMsgTemplate', 'AppMsgStatus', 'AppMsgAttach', 'AppMsgSendDate', 'AppMsgShowMessage', 'AppMsgError', 'TasId', 'AppNumber', ),
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID, AppMessagePeer::MSG_UID, AppMessagePeer::APP_UID, AppMessagePeer::DEL_INDEX, AppMessagePeer::APP_MSG_TYPE, AppMessagePeer::APP_MSG_SUBJECT, AppMessagePeer::APP_MSG_FROM, AppMessagePeer::APP_MSG_TO, AppMessagePeer::APP_MSG_BODY, AppMessagePeer::APP_MSG_DATE, AppMessagePeer::APP_MSG_CC, AppMessagePeer::APP_MSG_BCC, AppMessagePeer::APP_MSG_TEMPLATE, AppMessagePeer::APP_MSG_STATUS, AppMessagePeer::APP_MSG_ATTACH, AppMessagePeer::APP_MSG_SEND_DATE, AppMessagePeer::APP_MSG_SHOW_MESSAGE, AppMessagePeer::APP_MSG_ERROR, AppMessagePeer::TAS_ID, AppMessagePeer::APP_NUMBER, ),
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID', 'MSG_UID', 'APP_UID', 'DEL_INDEX', 'APP_MSG_TYPE', 'APP_MSG_SUBJECT', 'APP_MSG_FROM', 'APP_MSG_TO', 'APP_MSG_BODY', 'APP_MSG_DATE', 'APP_MSG_CC', 'APP_MSG_BCC', 'APP_MSG_TEMPLATE', 'APP_MSG_STATUS', 'APP_MSG_ATTACH', 'APP_MSG_SEND_DATE', 'APP_MSG_SHOW_MESSAGE', 'APP_MSG_ERROR', 'TAS_ID', 'APP_NUMBER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
BasePeer::TYPE_PHPNAME => array ('AppMsgUid', 'MsgUid', 'AppUid', 'DelIndex', 'AppMsgType', 'AppMsgTypeId', 'AppMsgSubject', 'AppMsgFrom', 'AppMsgTo', 'AppMsgBody', 'AppMsgDate', 'AppMsgCc', 'AppMsgBcc', 'AppMsgTemplate', 'AppMsgStatus', 'AppMsgStatusId', 'AppMsgAttach', 'AppMsgSendDate', 'AppMsgShowMessage', 'AppMsgError', 'ProId', 'TasId', 'AppNumber', ),
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID, AppMessagePeer::MSG_UID, AppMessagePeer::APP_UID, AppMessagePeer::DEL_INDEX, AppMessagePeer::APP_MSG_TYPE, AppMessagePeer::APP_MSG_TYPE_ID, AppMessagePeer::APP_MSG_SUBJECT, AppMessagePeer::APP_MSG_FROM, AppMessagePeer::APP_MSG_TO, AppMessagePeer::APP_MSG_BODY, AppMessagePeer::APP_MSG_DATE, AppMessagePeer::APP_MSG_CC, AppMessagePeer::APP_MSG_BCC, AppMessagePeer::APP_MSG_TEMPLATE, AppMessagePeer::APP_MSG_STATUS, AppMessagePeer::APP_MSG_STATUS_ID, AppMessagePeer::APP_MSG_ATTACH, AppMessagePeer::APP_MSG_SEND_DATE, AppMessagePeer::APP_MSG_SHOW_MESSAGE, AppMessagePeer::APP_MSG_ERROR, AppMessagePeer::PRO_ID, AppMessagePeer::TAS_ID, AppMessagePeer::APP_NUMBER, ),
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID', 'MSG_UID', 'APP_UID', 'DEL_INDEX', 'APP_MSG_TYPE', 'APP_MSG_TYPE_ID', 'APP_MSG_SUBJECT', 'APP_MSG_FROM', 'APP_MSG_TO', 'APP_MSG_BODY', 'APP_MSG_DATE', 'APP_MSG_CC', 'APP_MSG_BCC', 'APP_MSG_TEMPLATE', 'APP_MSG_STATUS', 'APP_MSG_STATUS_ID', 'APP_MSG_ATTACH', 'APP_MSG_SEND_DATE', 'APP_MSG_SHOW_MESSAGE', 'APP_MSG_ERROR', 'PRO_ID', 'TAS_ID', 'APP_NUMBER', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, )
);
/**
@@ -115,10 +124,10 @@ abstract class BaseAppMessagePeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('AppMsgUid' => 0, 'MsgUid' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'AppMsgType' => 4, 'AppMsgSubject' => 5, 'AppMsgFrom' => 6, 'AppMsgTo' => 7, 'AppMsgBody' => 8, 'AppMsgDate' => 9, 'AppMsgCc' => 10, 'AppMsgBcc' => 11, 'AppMsgTemplate' => 12, 'AppMsgStatus' => 13, 'AppMsgAttach' => 14, 'AppMsgSendDate' => 15, 'AppMsgShowMessage' => 16, 'AppMsgError' => 17, 'TasId' => 18, 'AppNumber' => 19, ),
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID => 0, AppMessagePeer::MSG_UID => 1, AppMessagePeer::APP_UID => 2, AppMessagePeer::DEL_INDEX => 3, AppMessagePeer::APP_MSG_TYPE => 4, AppMessagePeer::APP_MSG_SUBJECT => 5, AppMessagePeer::APP_MSG_FROM => 6, AppMessagePeer::APP_MSG_TO => 7, AppMessagePeer::APP_MSG_BODY => 8, AppMessagePeer::APP_MSG_DATE => 9, AppMessagePeer::APP_MSG_CC => 10, AppMessagePeer::APP_MSG_BCC => 11, AppMessagePeer::APP_MSG_TEMPLATE => 12, AppMessagePeer::APP_MSG_STATUS => 13, AppMessagePeer::APP_MSG_ATTACH => 14, AppMessagePeer::APP_MSG_SEND_DATE => 15, AppMessagePeer::APP_MSG_SHOW_MESSAGE => 16, AppMessagePeer::APP_MSG_ERROR => 17, AppMessagePeer::TAS_ID => 18, AppMessagePeer::APP_NUMBER => 19, ),
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID' => 0, 'MSG_UID' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'APP_MSG_TYPE' => 4, 'APP_MSG_SUBJECT' => 5, 'APP_MSG_FROM' => 6, 'APP_MSG_TO' => 7, 'APP_MSG_BODY' => 8, 'APP_MSG_DATE' => 9, 'APP_MSG_CC' => 10, 'APP_MSG_BCC' => 11, 'APP_MSG_TEMPLATE' => 12, 'APP_MSG_STATUS' => 13, 'APP_MSG_ATTACH' => 14, 'APP_MSG_SEND_DATE' => 15, 'APP_MSG_SHOW_MESSAGE' => 16, 'APP_MSG_ERROR' => 17, 'TAS_ID' => 18, 'APP_NUMBER' => 19, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, )
BasePeer::TYPE_PHPNAME => array ('AppMsgUid' => 0, 'MsgUid' => 1, 'AppUid' => 2, 'DelIndex' => 3, 'AppMsgType' => 4, 'AppMsgTypeId' => 5, 'AppMsgSubject' => 6, 'AppMsgFrom' => 7, 'AppMsgTo' => 8, 'AppMsgBody' => 9, 'AppMsgDate' => 10, 'AppMsgCc' => 11, 'AppMsgBcc' => 12, 'AppMsgTemplate' => 13, 'AppMsgStatus' => 14, 'AppMsgStatusId' => 15, 'AppMsgAttach' => 16, 'AppMsgSendDate' => 17, 'AppMsgShowMessage' => 18, 'AppMsgError' => 19, 'ProId' => 20, 'TasId' => 21, 'AppNumber' => 22, ),
BasePeer::TYPE_COLNAME => array (AppMessagePeer::APP_MSG_UID => 0, AppMessagePeer::MSG_UID => 1, AppMessagePeer::APP_UID => 2, AppMessagePeer::DEL_INDEX => 3, AppMessagePeer::APP_MSG_TYPE => 4, AppMessagePeer::APP_MSG_TYPE_ID => 5, AppMessagePeer::APP_MSG_SUBJECT => 6, AppMessagePeer::APP_MSG_FROM => 7, AppMessagePeer::APP_MSG_TO => 8, AppMessagePeer::APP_MSG_BODY => 9, AppMessagePeer::APP_MSG_DATE => 10, AppMessagePeer::APP_MSG_CC => 11, AppMessagePeer::APP_MSG_BCC => 12, AppMessagePeer::APP_MSG_TEMPLATE => 13, AppMessagePeer::APP_MSG_STATUS => 14, AppMessagePeer::APP_MSG_STATUS_ID => 15, AppMessagePeer::APP_MSG_ATTACH => 16, AppMessagePeer::APP_MSG_SEND_DATE => 17, AppMessagePeer::APP_MSG_SHOW_MESSAGE => 18, AppMessagePeer::APP_MSG_ERROR => 19, AppMessagePeer::PRO_ID => 20, AppMessagePeer::TAS_ID => 21, AppMessagePeer::APP_NUMBER => 22, ),
BasePeer::TYPE_FIELDNAME => array ('APP_MSG_UID' => 0, 'MSG_UID' => 1, 'APP_UID' => 2, 'DEL_INDEX' => 3, 'APP_MSG_TYPE' => 4, 'APP_MSG_TYPE_ID' => 5, 'APP_MSG_SUBJECT' => 6, 'APP_MSG_FROM' => 7, 'APP_MSG_TO' => 8, 'APP_MSG_BODY' => 9, 'APP_MSG_DATE' => 10, 'APP_MSG_CC' => 11, 'APP_MSG_BCC' => 12, 'APP_MSG_TEMPLATE' => 13, 'APP_MSG_STATUS' => 14, 'APP_MSG_STATUS_ID' => 15, 'APP_MSG_ATTACH' => 16, 'APP_MSG_SEND_DATE' => 17, 'APP_MSG_SHOW_MESSAGE' => 18, 'APP_MSG_ERROR' => 19, 'PRO_ID' => 20, 'TAS_ID' => 21, 'APP_NUMBER' => 22, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, )
);
/**
@@ -229,6 +238,8 @@ abstract class BaseAppMessagePeer
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TYPE);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TYPE_ID);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SUBJECT);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_FROM);
@@ -247,6 +258,8 @@ abstract class BaseAppMessagePeer
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_STATUS);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_STATUS_ID);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_ATTACH);
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SEND_DATE);
@@ -255,6 +268,8 @@ abstract class BaseAppMessagePeer
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_ERROR);
$criteria->addSelectColumn(AppMessagePeer::PRO_ID);
$criteria->addSelectColumn(AppMessagePeer::TAS_ID);
$criteria->addSelectColumn(AppMessagePeer::APP_NUMBER);

View File

@@ -337,6 +337,7 @@
<column name="APP_UID" type="VARCHAR" size="32" required="true" default=""/>
<column name="DEL_INDEX" type="INTEGER" required="true" default="0"/>
<column name="APP_MSG_TYPE" type="VARCHAR" size="100" required="true" default=""/>
<column name="APP_MSG_TYPE_ID" type="TINYINT" required="false" default="0"/>
<column name="APP_MSG_SUBJECT" type="VARCHAR" size="150" required="true" default=""/>
<column name="APP_MSG_FROM" type="VARCHAR" size="100" required="true" default=""/>
<column name="APP_MSG_TO" type="LONGVARCHAR" required="true"/>
@@ -346,10 +347,12 @@
<column name="APP_MSG_BCC" type="LONGVARCHAR" required="false"/>
<column name="APP_MSG_TEMPLATE" type="LONGVARCHAR" required="false"/>
<column name="APP_MSG_STATUS" type="VARCHAR" size="20"/>
<column name="APP_MSG_STATUS_ID" type="TINYINT" required="false" default="0"/>
<column name="APP_MSG_ATTACH" type="LONGVARCHAR" required="false"/>
<column name="APP_MSG_SEND_DATE" type="TIMESTAMP" required="true"/>
<column name="APP_MSG_SHOW_MESSAGE" type="TINYINT" required="true" default="1"/>
<column name="APP_MSG_ERROR" type="LONGVARCHAR" required="false"/>
<column name="PRO_ID" type="INTEGER" required="false" default="0"/>
<column name="TAS_ID" type="INTEGER" required="false" default="0"/>
<column name="APP_NUMBER" type="INTEGER" required="false" default="0"/>
<index name="indexForAppUid">
@@ -358,12 +361,21 @@
<index name="indexForMsgStatus">
<index-column name="APP_MSG_STATUS"/>
</index>
<index name="INDEX_PRO_ID">
<index-column name="PRO_ID"/>
</index>
<index name="INDEX_TAS_ID">
<index-column name="TAS_ID"/>
</index>
<index name="INDEX_APP_NUMBER">
<index-column name="APP_NUMBER"/>
</index>
<index name="INDEX_APP_MSG_TYPE_ID">
<index-column name="APP_MSG_STATUS_ID"/>
</index>
<index name="INDEX_APP_MSG_STATUS_ID">
<index-column name="APP_MSG_STATUS_ID"/>
</index>
</table>
<table name="APP_OWNER">
<vendor type="mysql">

View File

@@ -582,7 +582,7 @@ class adminProxy extends HttpProxyController
{
global $G_PUBLISH;
$aConfiguration = array(
$configuration = [
'MESS_ENGINE' => $_POST['MESS_ENGINE'],
'MESS_SERVER' => $_POST['MESS_SERVER'],
'MESS_PORT' => $_POST['MESS_PORT'],
@@ -592,11 +592,10 @@ class adminProxy extends HttpProxyController
'MESS_FROM_MAIL' => $_POST["FROM_EMAIL"],
'MESS_RAUTH' => $_POST['MESS_RAUTH'],
'SMTPSecure' => isset($_POST['SMTPSecure'])?$_POST['SMTPSecure']:'none'
);
];
$sFrom = G::buildFrom($aConfiguration);
$sSubject = G::LoadTranslation('ID_MESS_TEST_SUBJECT');
$from = G::buildFrom($configuration);
$subject = G::LoadTranslation('ID_MESS_TEST_SUBJECT');
$msg = G::LoadTranslation('ID_MESS_TEST_BODY');
switch ($_POST['MESS_ENGINE']) {
@@ -618,43 +617,39 @@ class adminProxy extends HttpProxyController
$sBodyPre->assign('ver', System::getVersion());
$sBodyPre->assign('engine', $engine);
$sBodyPre->assign('msg', $msg);
$sBody = $sBodyPre->getOutputContent();
$body = $sBodyPre->getOutputContent();
$oSpool = new SpoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(
array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $_POST['TO'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach'=>'' // Added By Ankit
)
$spool = new SpoolRun();
$spool->setConfig($configuration);
$messageArray = AppMessage::buildMessageRow(
'',
'',
'',
'TEST',
$subject,
$from,
$_POST['TO'],
$body,
'',
'',
'',
'',
'pending'
);
$spool->create($messageArray);
$oSpool->sendMail();
$spool->sendMail();
$G_PUBLISH = new Publisher();
$o = new stdclass();
if ($oSpool->status == 'sent') {
if ($spool->status == 'sent') {
$o->status = true;
$o->success = true;
$o->msg = G::LoadTranslation('ID_MAIL_TEST_SUCCESS');
} else {
$o->status = false;
$o->success = false;
$o->msg = $oSpool->error;
$o->msg = $spool->error;
}
return $o;
}

View File

@@ -150,6 +150,7 @@ CREATE TABLE `APP_MESSAGE`
`APP_UID` VARCHAR(32) default '' NOT NULL,
`DEL_INDEX` INTEGER default 0 NOT NULL,
`APP_MSG_TYPE` VARCHAR(100) default '' NOT NULL,
`APP_MSG_TYPE_ID` TINYINT default 0,
`APP_MSG_SUBJECT` VARCHAR(150) default '' NOT NULL,
`APP_MSG_FROM` VARCHAR(100) default '' NOT NULL,
`APP_MSG_TO` MEDIUMTEXT NOT NULL,
@@ -159,17 +160,22 @@ CREATE TABLE `APP_MESSAGE`
`APP_MSG_BCC` MEDIUMTEXT,
`APP_MSG_TEMPLATE` MEDIUMTEXT,
`APP_MSG_STATUS` VARCHAR(20),
`APP_MSG_STATUS_ID` TINYINT default 0,
`APP_MSG_ATTACH` MEDIUMTEXT,
`APP_MSG_SEND_DATE` DATETIME NOT NULL,
`APP_MSG_SHOW_MESSAGE` TINYINT default 1 NOT NULL,
`APP_MSG_ERROR` MEDIUMTEXT,
`PRO_ID` INTEGER default 0,
`TAS_ID` INTEGER default 0,
`APP_NUMBER` INTEGER default 0,
PRIMARY KEY (`APP_MSG_UID`),
KEY `indexForAppUid`(`APP_UID`),
KEY `indexForMsgStatus`(`APP_MSG_STATUS`),
KEY `INDEX_PRO_ID`(`PRO_ID`),
KEY `INDEX_TAS_ID`(`TAS_ID`),
KEY `INDEX_APP_NUMBER`(`APP_NUMBER`)
KEY `INDEX_APP_NUMBER`(`APP_NUMBER`),
KEY `INDEX_APP_MSG_TYPE_ID`(`APP_MSG_STATUS_ID`),
KEY `INDEX_APP_MSG_STATUS_ID`(`APP_MSG_STATUS_ID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Messages in an Application';
#-----------------------------------------------------------------------------
#-- APP_OWNER

View File

@@ -15,32 +15,30 @@ $actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null;
switch ($actionAjax) {
case 'messageHistoryGridList_JXP':
if (!isset($_REQUEST['start']) || $_REQUEST['start'] == '') {
$_REQUEST['start'] = 0;
}
if (!isset($_REQUEST['limit']) || $_REQUEST['limit'] == '') {
$_REQUEST['limit'] = 20;
}
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'DESC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
global $G_PUBLISH;
$case = new Cases();
$case->dir = $dir;
$case->sort = $sort;
$appMessageArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']);
$appMessageCountArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true);
$result = new stdClass();
$process = [];
$proUid = $_SESSION['PROCESS'];
$appUid = $_SESSION['APPLICATION'];
$tasUid = $_SESSION['TASK'];
$usrUid = $_SESSION['USER_LOGGED'];
$caseData = $case->loadCase($appUid);
$appNumber = $caseData['APP_DATA']['APP_NUMBER'];
$appMessage = new AppMessage();
$appMessageArray = $appMessage->getDataMessage(
$appNumber,
true,
$start,
$limit,
$sort,
$dir
);
$totalCount = $appMessage->getCountMessage($appNumber);
$respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK');
$respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW');
@@ -70,37 +68,31 @@ switch ($actionAjax) {
}
}
$totalCount = 0;
foreach ($appMessageArray as $index => $value) {
if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1 && $respMess != 'BLOCK') &&
($appMessageArray[$index]['DEL_INDEX'] == 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex))) {
$messageList = [];
foreach ($appMessageArray as $index => &$value) {
if (
($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1 && $respMess != 'BLOCK')
&&
(
$appMessageArray[$index]['DEL_INDEX'] == 0
|| in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex)
)
) {
//Define the label with translation
$value['APP_MSG_TYPE'] = !empty($arrayToTranslation[$value['APP_MSG_TYPE']]) ? $arrayToTranslation[$value['APP_MSG_TYPE']] : $value['APP_MSG_TYPE'];
$appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID'];
if ($respMess == 'BLOCK' || $respMess == '') {
$appMessageArray[$index]['APP_MSG_BODY'] = '';
}
$process[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
$totalCount++;
$messageList[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
}
}
$process = array_splice($process, $_REQUEST['start'], $_REQUEST['limit']);
$response = new stdclass();
$response->data = $process;
$response->data = $messageList;
$response->totalCount = $totalCount;
if (!empty($process)) {
if (!isset($response->data[0])) {
$response->data[0] = array('APP_MSG_TYPE' => '');
}
foreach ($response->data as $key => $value) {
$response->data[$key]['APP_MSG_TYPE'] = array_key_exists($response->data[$key]['APP_MSG_TYPE'], $arrayToTranslation) ?
$arrayToTranslation[$response->data[$key]['APP_MSG_TYPE']] :
$response->data[$key]['APP_MSG_TYPE'];
}
}
echo G::json_encode($response);
break;
case 'showHistoryMessage':

View File

@@ -2,24 +2,6 @@
/**
* cases_Derivate.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage('ID_LOGIN_AGAIN', 'warning', 'labels');
@@ -50,6 +32,7 @@ if (!isset($_SESSION['USER_LOGGED'])) {
}
</script>');
}
/* Permissions */
switch ($RBAC->userCanAccess('PM_CASES')) {
case -2:
@@ -67,16 +50,16 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
/* Includes */
//If no variables are submitted and the $_POST variable is empty
if (!isset($_POST['form'])) {
$_POST['form'] = array();
$_POST['form'] = [];
}
/* GET , POST & $_SESSION Vars */
/* Process the info */
$sStatus = 'TO_DO';
foreach ($_POST['form']['TASKS'] as $aValues) {
}
try {
//Load Session variables
$processUid = isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '';
//load data
$oCase = new Cases();
//warning: we are not using the result value of function thisIsTheCurrentUser, so I'm commenting to optimize speed.
@@ -84,9 +67,9 @@ try {
$appFields = $oCase->loadCase($_SESSION['APPLICATION']);
$appFields['APP_DATA'] = array_merge($appFields['APP_DATA'], G::getSystemConstants());
//cleaning debug variables
$_SESSION['TRIGGER_DEBUG']['DATA'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array ();
$_SESSION['TRIGGER_DEBUG']['DATA'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] = [];
$triggers = $oCase->loadTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE');
@@ -94,7 +77,8 @@ try {
//if there are some triggers to execute
if (sizeof($triggers) > 0) {
//Execute triggers before derivation
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE', $appFields['APP_DATA'] );
$appFields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE',
$appFields['APP_DATA']);
//save trigger variables for debugger
$_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof($triggers);
@@ -119,18 +103,18 @@ try {
//Prepare information for the derivation
$oDerivation = new Derivation();
$aCurrentDerivation = array (
$aCurrentDerivation = [
'APP_UID' => $_SESSION['APPLICATION'],
'DEL_INDEX' => $_SESSION['INDEX'],
'APP_STATUS' => $sStatus,
'TAS_UID' => $_SESSION['TASK'],
'ROU_TYPE' => $_POST['form']['ROU_TYPE']
);
$aDataForPrepareInfo = array (
];
$aDataForPrepareInfo = [
'USER_UID' => $_SESSION['USER_LOGGED'],
'APP_UID' => $_SESSION['APPLICATION'],
'DEL_INDEX' => $_SESSION['INDEX']
);
];
//We define some parameters in the before the derivation
//Then this function will be route the case
@@ -155,9 +139,11 @@ try {
}
$appFields = $oCase->loadCase($_SESSION['APPLICATION']); //refresh appFields, because in derivations should change some values
$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER' ); //load the triggers after derivation
$triggers = $oCase->loadTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2,
'AFTER'); //load the triggers after derivation
if (sizeof($triggers) > 0) {
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER', $appFields['APP_DATA'] ); //Execute triggers after derivation
$appFields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER',
$appFields['APP_DATA']); //Execute triggers after derivation
$_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof($triggers);
@@ -201,7 +187,8 @@ try {
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail ();
foreach ($appDelPrev as $app) {
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
$Pmgmail->gmailsIfSelfServiceValueBased ( $_SESSION ['APPLICATION'], $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
$Pmgmail->gmailsIfSelfServiceValueBased($_SESSION ['APPLICATION'], $app ['DEL_INDEX'],
$_POST ['form'] ['TASKS'], $appFields ['APP_DATA']);
}
}
}
@@ -209,15 +196,23 @@ try {
/*----------------------------------********---------------------------------*/
try {
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromData );
$oCase->sendNotifications(
$_SESSION['TASK'],
$_POST['form']['TASKS'],
$appFields['APP_DATA'],
$_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$sFromData
);
} catch (Exception $e) {
G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' );
G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR') . ' - ' . $e->getMessage(), 'warning',
'string', null, '100%');
}
// Send notifications - End
// Events - Start
$oEvent = new Event();
$oEvent->closeAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] );
$oEvent->closeAppEvents($processUid, $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']);
$oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1);
$multipleDelegation = false;
// check if there are multiple derivations
@@ -229,12 +224,14 @@ try {
// if there is just a single derivation the TASK_UID can be set by the delegation data
if (!$multipleDelegation) {
$aCurrentAppDel = $oCurrentAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID'] );
$oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'],
$aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID']);
} else {
// else we need to check every task and create the events if it have any
foreach ($_POST['form']['TASKS'] as $taskDelegated) {
$aCurrentAppDel = $oCurrentAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID'] );
$oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'],
$aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID']);
}
}
}
@@ -260,11 +257,13 @@ try {
if (isset ($_SESSION ['user_experience']) && $flagGmail === false) {
$aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience'];
$debuggerAvailable = false;
} else if ($flagGmail === true) {
} else {
if ($flagGmail === true) {
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
} else {
$aNextStep ['PAGE'] = $casesRedirector;
}
}
if (isset($_SESSION['PMDEBUGGER']) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
@@ -309,7 +308,7 @@ try {
G::header("location: $loc");
} catch (Exception $e) {
$aMessage = array ();
$aMessage = [];
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);

View File

@@ -12,8 +12,8 @@ $userData = $rbacUser->getByUsername($data['USR_USERNAME']);
$userExists = $userData === false ? false : true;
if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'] && ($userData['USR_AUTH_TYPE'] === '' || $userData['USR_AUTH_TYPE'] == 'MYSQL')) {
$aSetup = System::getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
$setup = System::getEmailConfiguration();
if (count($setup) == 0 || !isset($setup['MESS_ENGINE'])) {
G::SendTemporalMessage('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
@@ -21,25 +21,26 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = Bootstrap::hashPassword($newPass);
$oUserProperty = new UsersProperties();
$aUserPropertyData = $oUserProperty->load($aData['USR_UID']);
$infoUser = [];
$infoUser['USR_UID'] = $userData['USR_UID'];
$infoUser['USR_PASSWORD'] = Bootstrap::hashPassword($newPass);
$userProperty = new UsersProperties();
$aUserPropertyData = $userProperty->load($infoUser['USR_UID']);
if (is_array($aUserPropertyData)) {
$aUserPropertyData['USR_LOGGED_NEXT_TIME'] = 1;
$oUserProperty = $oUserProperty->update($aUserPropertyData);
$userProperty = $userProperty->update($aUserPropertyData);
}
if (!isset($sFrom)) {
$sFrom = '';
if (!isset($from)) {
$from = '';
}
$sFrom = G::buildFrom($aSetup, $sFrom);
$from = G::buildFrom($setup, $from);
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
$subject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_USERMANE_IS') . ' : <strong>' . $userData['USR_USERNAME'] . '</strong></p>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_PASSWORD_IS') . ' : <strong>' . $newPass . '</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
switch ($setup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
@@ -51,7 +52,7 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
break;
}
$sBody = "
$body = "
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
<tbody><tr><td><img id='logo' src='http://" . $_SERVER['SERVER_NAME'] . "/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg</td></tr>
@@ -60,30 +61,30 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
</tr></tbody></table>";
$oSpool = new SpoolRun();
$spool = new SpoolRun();
$oSpool->setConfig($aSetup);
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach' => ''
));
$spool->setConfig($setup);
$messageArray = AppMessage::buildMessageRow(
'',
'',
0,
'TEST',
$subject,
$from,
$data['USR_EMAIL'],
$body,
'',
'',
'',
'',
'pending'
);
$spool->create($messageArray);
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
$spool->sendMail();
$rbacUser->update($infoUser);
$user->update($infoUser);
G::header("location: login");
G::SendTemporalMessage('ID_NEW_PASSWORD_SENT', "info");
} catch (phpmailerException $e) {

View File

@@ -22,18 +22,18 @@ $G_ID_SUB_MENU_SELECTED = 'EMAILS';
//get values for the comboBoxes
$userUid = (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
$status = array(
array('', G::LoadTranslation('ID_ALL')),
array("sent", G::LoadTranslation('ID_SENT')),
array("pending", G::LoadTranslation('ID_PENDING'))
);
//Get the status values
$status = AppMessage::getAllStatus();
//Get the process values
$process = new BmProcess();
$processes = $process->getProcessList('', true);
//Review if the plugin External is enable
$pluginRegistry = PluginRegistry::loadSingleton();
$flagER = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
$process = new BmProcess();
$processes = $process->getProcessList();
$G_PUBLISH = new Publisher();
$oHeadPublisher = &headPublisher::getSingleton();

View File

@@ -21,23 +21,15 @@ switch ($req) {
case 'MessageList':
$start = (isset($_REQUEST['start'])) ? $_REQUEST['start'] : '0';
$limit = (isset($_REQUEST['limit'])) ? $_REQUEST['limit'] : '25';
$proUid = (isset($_REQUEST['process'])) ? $_REQUEST['process'] : '';
$proId = (isset($_REQUEST['process'])) ? $_REQUEST['process'] : '';
$eventype = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : '';
$emailStatus = (isset($_REQUEST['status'])) ? $_REQUEST['status'] : '';
$msgStatusId = (isset($_REQUEST['status'])) ? $_REQUEST['status'] : '';
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : '';
$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'ASC';
$dateFrom = isset($_POST["dateFrom"]) ? substr($_POST["dateFrom"], 0, 10) : "";
$dateTo = isset($_POST["dateTo"]) ? substr($_POST["dateTo"], 0, 10) : "";
$filterBy = (isset($_REQUEST['filterBy'])) ? $_REQUEST['filterBy'] : 'ALL';
//Review the External Registration
$arrayType = [];
$pluginRegistry = PluginRegistry::loadSingleton();
$flagEr = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
if ($flagEr == 0) {
$arrayType[] = 'EXTERNAL_REGISTRATION';
}
$criteria = new Criteria();
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_UID);
$criteria->addSelectColumn(AppMessagePeer::APP_UID);
@@ -58,31 +50,33 @@ switch ($req) {
$criteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$criteria->addSelectColumn(TaskPeer::TAS_TITLE);
$criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(ApplicationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AppMessagePeer::TAS_ID, TaskPeer::TAS_ID, Criteria::LEFT_JOIN);
$criteria->addJoin(AppMessagePeer::PRO_ID, ProcessPeer::PRO_ID, Criteria::LEFT_JOIN);
//Status can be: All, Participated, Pending
if (!empty($emailStatus)) {
$criteria->add(AppMessagePeer::APP_MSG_STATUS, $emailStatus);
//Status can be: All, Participated, Pending, Failed
if (!empty($msgStatusId)) {
$criteria->add(AppMessagePeer::APP_MSG_STATUS_ID, $msgStatusId);
}
//Process uid
if (!empty($proUid)) {
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
if (!empty($proId)) {
$criteria->add(AppMessagePeer::PRO_ID, $proId);
}
//Filter by can be: All, Cases, Test
switch ($filterBy) {
case 'CASES':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, ['TEST', 'EXTERNAL_REGISTRATION'], Criteria::NOT_IN);
case 'CASES': //TRIGGER and DERIVATION
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, [AppMessage::TYPE_TRIGGER, AppMessage::TYPE_DERIVATION], Criteria::IN);
break;
case 'TEST':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'TEST', Criteria::EQUAL);
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_TEST, Criteria::EQUAL);
break;
case 'EXTERNAL-REGISTRATION':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'EXTERNAL_REGISTRATION', Criteria::EQUAL);
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_EXTERNAL_REGISTRATION, Criteria::EQUAL);
break;
default:
if (!empty($arrayType)) {
$criteria->add(AppMessagePeer::APP_MSG_TYPE, $arrayType, Criteria::NOT_IN);
//Review the External Registration
$pluginRegistry = PluginRegistry::loadSingleton();
if (!$pluginRegistry->isEnable('externalRegistration')) {
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_EXTERNAL_REGISTRATION, Criteria::NOT_EQUAL);
}
break;
}
@@ -157,9 +151,9 @@ switch ($req) {
die(G::json_encode($response));
break;
case 'updateStatusMessage':
if (isset($_REQUEST['APP_MSG_UID']) && isset($_REQUEST['APP_MSG_STATUS'])) {
if (isset($_REQUEST['APP_MSG_UID']) && isset($_REQUEST['APP_MSG_STATUS_ID'])) {
$message = new AppMessage();
$result = $message->updateStatus($_REQUEST['APP_MSG_UID'], $_REQUEST['APP_MSG_STATUS']);
$result = $message->updateStatus($_REQUEST['APP_MSG_UID'], $_REQUEST['APP_MSG_STATUS_ID']);
}
break;
}

View File

@@ -66,7 +66,10 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$ws = new WsBase();
$result = $ws->derivateCase(
$caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true
$caseFieldsABE['CURRENT_USER_UID'],
$_REQUEST['APP_UID'],
$_REQUEST['DEL_INDEX'],
true
);
$code = (is_array($result))? $result['status_code'] : $result->status_code;
@@ -101,9 +104,9 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$response = new stdClass();
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
$response->appUid = $_REQUEST['APP_UID'];
$response->delIndex = $_REQUEST['DEL_INDEX'];
$response->noteText = 'Check the information that was sent for the receiver: ' .
$dataAbeRequests['ABE_REQ_SENT_TO'];
postNote($response);
}

View File

@@ -5,28 +5,7 @@ if (PMLicensedFeatures
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
$G_PUBLISH = new Publisher();
try {
/**
* $backupSession = serialize($_SESSION);
* This script runs with $ _SESSION ['USER_LOGGED'] = '00000000000000000000000000000001',
* this action enables login as admin if you enter the url 'http://myserver.net/sysworkflow/en/neoclassic/processes/main',
* in the Browser that invoked this script.
* This action ensures that any changes to the session variables required by
* this script do not affect the main session if it exists, for example
* when multiple tabs are open.
* Serialization is used because for object types the simple assignment:
* $backupSession = $ _SESSION will not work because the assignment is by
* reference, eg:
* <?php
* $obj = new stdClass();
* $obj->value = "value";
*
* $a = ["one" => 1, "two" => $obj, "three" => 3];
* $b = $a;
* $a["two"]->value = "modify";
*
* In 'b' is reflected the output of 'a'.
*/
$backupSession = serialize($_SESSION);
if (empty($_GET['APP_UID'])) {
@@ -52,46 +31,19 @@ if (PMLicensedFeatures
$aber = G::decrypt($_REQUEST['ABER'], URL_KEY);
$forms = isset($_REQUEST['form']) ? $_REQUEST['form'] : [];
//Load data related to the case
$case = new Cases();
$casesFields = $case->loadCase($appUid, $delIndex);
$casesFields['APP_DATA'] = array_merge($casesFields['APP_DATA'], $forms);
//Get user info
$current_user_uid = null;
$currentUsrName = null;
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
$rsSQL = AppDelegationPeer::doSelectRS($criteria);
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsSQL->next()) {
$row = $rsSQL->getRow();
$current_user_uid = $row["USR_UID"];
}
if ($current_user_uid != null) {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->add(UsersPeer::USR_UID, $current_user_uid);
$rsSQL = UsersPeer::doSelectRS($criteria);
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsSQL->next();
$row = $rsSQL->getRow();
$currentUsrName = $row["USR_USERNAME"];
$casesFields["APP_DATA"]["USER_LOGGED"] = $current_user_uid;
$casesFields["APP_DATA"]["USR_USERNAME"] = $currentUsrName;
//Get current user info
$delegation = new AppDelegation();
$currentUsrUid = $delegation->getUserAssignedInThread($appUid, $delIndex);
if (!is_null($currentUsrUid)) {
$users = new Users();
$userInfo = $users->loadDetails($currentUsrUid);
$casesFields["APP_DATA"]["USER_LOGGED"] = $currentUsrUid;
$casesFields["APP_DATA"]["USR_USERNAME"] = $userInfo['USR_USERNAME'];
}
foreach ($casesFields["APP_DATA"] as $index => $value) {
@@ -102,7 +54,12 @@ if (PMLicensedFeatures
$case->updateCase($appUid, $casesFields);
$wsBaseInstance = new WsBase();
$result = $wsBaseInstance->derivateCase($casesFields['CURRENT_USER_UID'], $appUid, $delIndex, true);
$result = $wsBaseInstance->derivateCase(
$casesFields['CURRENT_USER_UID'],
$appUid,
$delIndex,
true
);
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
$dataResponses = array();
@@ -130,8 +87,8 @@ if (PMLicensedFeatures
$response = new stdclass();
$response->usrUid = $casesFields['APP_DATA']['USER_LOGGED'];
$response->appUid = $appUid;
$response->delIndex = $delIndex;
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
postNote($response);
}
@@ -141,7 +98,7 @@ if (PMLicensedFeatures
if (isset($_FILES ['form'])) {
if (isset($_FILES["form"]["name"]) && count($_FILES["form"]["name"]) > 0) {
$oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
$oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $current_user_uid, $appUid, $delIndex);
$oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $currentUsrUid, $appUid, $delIndex);
}
}

View File

@@ -4,19 +4,23 @@ namespace ProcessMaker\BusinessModel;
use AbeConfiguration;
use AbeConfigurationPeer;
use AppMessage;
use AbeRequests;
use AbeRequestsPeer;
use AbeResponsesPeer;
use ApplicationPeer;
use AppDelegationPeer;
use Criteria;
use EmailServerPeer;
use Exception;
use G;
use Publisher;
use ProcessMaker\BusinessModel\EmailServer;
use ProcessMaker\Core\System;
use ProcessMaker\Plugins\PluginRegistry;
use PmDynaform;
use PMLicensedFeatures;
use ProcessPeer;
use ResultSet;
use SpoolRun;
use stdClass;
@@ -378,9 +382,11 @@ class ActionsByEmail
/**
* Forward the Mail
*
* @param array $arrayData
*
* @return string $message
* @throws Exception
*/
public function forwardMail(array $arrayData)
{
@@ -388,38 +394,15 @@ class ActionsByEmail
$arrayData['REQ_UID'] = '';
}
$criteria = new Criteria();
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
$criteria->addSelectColumn(TaskPeer::TAS_ID);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
$criteria->addSelectColumn(AppDelegationPeer::APP_NUMBER);
$criteria->addJoin(AbeConfigurationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID, Criteria::LEFT_JOIN);
$conditions[] = [AbeRequestsPeer::APP_UID, AppDelegationPeer::APP_UID];
$conditions[] = [AbeRequestsPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX];
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$resultRes->next();
$dataRes = [];
$abeRequest = new AbeRequests();
$dataRes = $abeRequest->getAbeRequest($arrayData['REQ_UID']);
if ($dataRes = $resultRes->getRow()) {
if (!empty($dataRes)) {
if (is_null($dataRes['DEL_FINISH_DATE'])) {
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
$emailServer = new EmailServer();
$criteria = $emailServer->getEmailServerCriteria();
$rsCriteria = \EmailServerPeer::doSelectRS($criteria);
$rsCriteria = EmailServerPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
@@ -431,24 +414,29 @@ class ActionsByEmail
$spool = new SpoolRun();
$spool->setConfig($aSetup);
$messageArray = AppMessage::buildMessageRow(
'',
$dataRes['APP_UID'],
$dataRes['DEL_INDEX'],
'TEST',
$dataRes['ABE_REQ_SUBJECT'],
$aSetup['MESS_ACCOUNT'],
$dataRes['ABE_REQ_SENT_TO'],
$dataRes['ABE_REQ_BODY'],
'',
'',
'',
'',
'pending',
'',
'',
false,
isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : 0,
$dataRes['PRO_ID'],
$dataRes['TAS_ID']
);
$spool->create([
'msg_uid' => '',
'app_uid' => $dataRes['APP_UID'],
'del_index' => $dataRes['DEL_INDEX'],
'app_msg_type' => 'TEST',
'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'],
'app_msg_from' => $aSetup['MESS_ACCOUNT'],
'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'],
'app_msg_body' => $dataRes['ABE_REQ_BODY'],
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
"tas_id" => $dataRes['TAS_ID'],
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
]);
$spool->create($messageArray);
if ($spool->sendMail()) {
$dataRes['ABE_REQ_STATUS'] = 'SENT';

View File

@@ -1,10 +1,13 @@
<?php
namespace ProcessMaker\BusinessModel;
use G;
use Exception;
use AppMessage;
use Bootstrap;
use SpoolRun;
use Exception;
use G;
use ProcessMaker\Core\System;
use SpoolRun;
use TemplatePower;
class EmailServer
{
@@ -158,7 +161,7 @@ class EmailServer
{
try {
$aConfiguration = array(
$configuration = array(
"MESS_ENGINE" => $arrayData["MESS_ENGINE"],
"MESS_SERVER" => $arrayData["MESS_SERVER"],
"MESS_PORT" => (int)($arrayData["MESS_PORT"]),
@@ -170,9 +173,6 @@ class EmailServer
"SMTPSecure" => (isset($arrayData["SMTPSecure"]))? $arrayData["SMTPSecure"] : "none"
);
$sFrom = G::buildFrom($aConfiguration);
$sSubject = G::LoadTranslation("ID_MESS_TEST_SUBJECT");
$msg = G::LoadTranslation("ID_MESS_TEST_BODY");
switch ($arrayData["MESS_ENGINE"]) {
@@ -187,52 +187,47 @@ class EmailServer
break;
}
$sBodyPre = new \TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
$bodyPre = new TemplatePower(PATH_TPL . "admin" . PATH_SEP . "email.tpl");
$sBodyPre->prepare();
$sBodyPre->assign("server", $_SERVER["SERVER_NAME"]);
$sBodyPre->assign("date", date("H:i:s"));
$sBodyPre->assign("ver", System::getVersion());
$sBodyPre->assign("engine", $engine);
$sBodyPre->assign("msg", $msg);
$sBody = $sBodyPre->getOutputContent();
$bodyPre->prepare();
$bodyPre->assign("server", $_SERVER["SERVER_NAME"]);
$bodyPre->assign("date", date("H:i:s"));
$bodyPre->assign("ver", System::getVersion());
$bodyPre->assign("engine", $engine);
$bodyPre->assign("msg", $msg);
$body = $bodyPre->getOutputContent();
$oSpool = new SpoolRun();
$oSpool->setConfig($aConfiguration);
$oSpool->create(
array(
"msg_uid" => "",
"app_uid" => "",
"del_index" => 0,
"app_msg_type" => "TEST",
"app_msg_subject" => $sSubject,
"app_msg_from" => $sFrom,
"app_msg_to" => $arrayData["TO"],
"app_msg_body" => $sBody,
"app_msg_cc" => "",
"app_msg_bcc" => "",
"app_msg_attach" => "",
"app_msg_template" => "",
"app_msg_status" => "pending",
"app_msg_attach" => ""
)
$spool = new SpoolRun();
$spool->setConfig($configuration);
$messageArray = AppMessage::buildMessageRow(
'',
'',
0,
'TEST',
G::LoadTranslation("ID_MESS_TEST_SUBJECT"),
G::buildFrom($configuration),
$arrayData["TO"],
$body,
'',
'',
'',
'',
'pending'
);
$oSpool->sendMail();
$spool->create($messageArray);
$spool->sendMail();
//Return
$arrayTestMailResult = array();
$arrayTestMailResult = [];
if ($oSpool->status == "sent") {
if ($spool->status == "sent") {
$arrayTestMailResult["status"] = true;
$arrayTestMailResult["success"] = true;
$arrayTestMailResult["msg"] = G::LoadTranslation("ID_MAIL_TEST_SUCCESS");
} else {
$arrayTestMailResult["status"] = false;
$arrayTestMailResult["success"] = false;
$arrayTestMailResult["msg"] = $oSpool->error;
$arrayTestMailResult["msg"] = $spool->error;
}
return $arrayTestMailResult;

View File

@@ -1862,6 +1862,7 @@ class Process
if (!empty($search)) {
$process->add(ProcessPeer::PRO_TITLE, "%$search%", Criteria::LIKE);
}
$process->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$dataset = ProcessPeer::doSelectRS($process);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();

View File

@@ -12,6 +12,7 @@ function postNote($httpData)
{
$appUid = (isset($httpData->appUid)) ? $httpData->appUid : '';
$usrUid = (isset($httpData->usrUid)) ? $httpData->usrUid : '';
$delIndex = (isset($httpData->delIndex)) ? $httpData->delIndex : 0;
$appNotes = new AppNotes();
$noteContent = addslashes($httpData->noteText);
$result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false);
@@ -33,7 +34,7 @@ function postNote($httpData)
}
$noteRecipients = implode(",", $noteRecipientsList);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients);
$appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, '', $delIndex);
}
/**

View File

@@ -358,10 +358,11 @@ Ext.onReady(function(){
params : {
request : 'updateStatusMessage',
APP_MSG_UID: row.data.APP_MSG_UID,
APP_MSG_STATUS: this.value
APP_MSG_STATUS_ID: this.value
},
success: function ( result, request ) {
Ext.MessageBox.hide();
emailsGrid.store.load();
},
failure: function ( result, request) {
if (typeof(result.responseText) != 'undefined') {