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:
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user