This commit is contained in:
Israel Bernabe
2019-03-29 10:00:39 -04:00
committed by Paula Quispe
parent bddc2906a6
commit ef84cd1523
15 changed files with 242 additions and 75 deletions

View File

@@ -17,7 +17,8 @@ this.escapeHtml=function(v){var pre=document.createElement('pre');var text=docum
this.getBrowser=function(){var browsersList=["opera","msie","firefox","chrome","safari","trident"],browserMeta=navigator.userAgent.toLowerCase(),name='Unknown',version='',screen={width:Ext.getBody().getViewSize().width,height:Ext.getBody().getViewSize().height};for(var i=0;i<browsersList.length;i++){if((name==="")&&(browserMeta.indexOf(browsersList[i])!==-1)){name=browsersList[i];version=String(parseFloat(browserMeta.substr(browserMeta.indexOf(browsersList[i])+browsersList[i].length+1)));break;}} this.getBrowser=function(){var browsersList=["opera","msie","firefox","chrome","safari","trident"],browserMeta=navigator.userAgent.toLowerCase(),name='Unknown',version='',screen={width:Ext.getBody().getViewSize().width,height:Ext.getBody().getViewSize().height};for(var i=0;i<browsersList.length;i++){if((name==="")&&(browserMeta.indexOf(browsersList[i])!==-1)){name=browsersList[i];version=String(parseFloat(browserMeta.substr(browserMeta.indexOf(browsersList[i])+browsersList[i].length+1)));break;}}
return{name:name,version:version,screen:screen}};this.createInfoPanel=function(url,params,columnsSize){var labelColumnWidth=170;var valueColumnWidth=350;params=params||{};if(typeof columnsSize!=='undefined'){labelColumnWidth=columnsSize[0]||labelColumnWidth;valueColumnWidth=columnsSize[1]||valueColumnWidth;} return{name:name,version:version,screen:screen}};this.createInfoPanel=function(url,params,columnsSize){var labelColumnWidth=170;var valueColumnWidth=350;params=params||{};if(typeof columnsSize!=='undefined'){labelColumnWidth=columnsSize[0]||labelColumnWidth;valueColumnWidth=columnsSize[1]||valueColumnWidth;}
return new Ext.grid.GridPanel({store:new Ext.data.GroupingStore({autoLoad:true,proxy:new Ext.data.HttpProxy({url:url,method:'POST'}),baseParams:params,reader:new Ext.data.JsonReader({fields:[{name:'label'},{name:'value'},{name:'section'}]}),groupField:'section'}),columns:[{width:labelColumnWidth,dataIndex:"label",renderer:function(v){return"<b><font class='selectText' color=\"#465070\">"+v+"</font></b>";},align:"right"},{width:valueColumnWidth,dataIndex:"value",renderer:function(v){return"<b class='selectText'>"+v+"</b>";}},{hidden:true,dataIndex:"section"}],autoHeight:true,columnLines:true,trackMouseOver:false,disableSelection:true,view:new Ext.grid.GroupingView({forceFit:true,headersDisabled:true,groupTextTpl:'{group}'}),loadMask:true});};this.cookie={create:function(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";},read:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);} return new Ext.grid.GridPanel({store:new Ext.data.GroupingStore({autoLoad:true,proxy:new Ext.data.HttpProxy({url:url,method:'POST'}),baseParams:params,reader:new Ext.data.JsonReader({fields:[{name:'label'},{name:'value'},{name:'section'}]}),groupField:'section'}),columns:[{width:labelColumnWidth,dataIndex:"label",renderer:function(v){return"<b><font class='selectText' color=\"#465070\">"+v+"</font></b>";},align:"right"},{width:valueColumnWidth,dataIndex:"value",renderer:function(v){return"<b class='selectText'>"+v+"</b>";}},{hidden:true,dataIndex:"section"}],autoHeight:true,columnLines:true,trackMouseOver:false,disableSelection:true,view:new Ext.grid.GroupingView({forceFit:true,headersDisabled:true,groupTextTpl:'{group}'}),loadMask:true});};this.cookie={create:function(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";},read:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length,c.length);}
return null;},erase:function(name){Tools.createCookie(name,"",-1);}}} return null;},erase:function(name){Tools.createCookie(name,"",-1);}}
this.emailConst={appMsgTypeWithoutTask:['EXTERNAL_REGISTRATION','TEST','CASE_NOTE','SOAP','RETRIEVE_PASSWORD'],appMsgTypeWithConditionalTask:['PM_FUNCTION'],appMsgTypeWithoutCase:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],appMsgTypeWithoutProcess:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],appMsgTypeWithoutNumber:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],numberColumn:{name:'APP_NUMBER',defaultValue:'N/A'},taskColumn:{name:'TAS_TITLE',defaultValue:'N/A'},caseColumn:{name:'APP_TITLE',defaultValue:'N/A'},processColumn:{name:'PRO_TITLE',defaultValue:'N/A'}}}
var PMExt=new PMExtJSCommon();Ext.msgBoxSlider=function(){var msgCt;function createBox(t,s){return['<div class="msg">','<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>','<div class="x-box-ml"><div class="x-box-mr"><div id="x-box-mc-inner" class="x-box-mc"><h3>',t,'</h3>',s,'</div></div></div>','<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>','</div>'].join('');} var PMExt=new PMExtJSCommon();Ext.msgBoxSlider=function(){var msgCt;function createBox(t,s){return['<div class="msg">','<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>','<div class="x-box-ml"><div class="x-box-mr"><div id="x-box-mc-inner" class="x-box-mc"><h3>',t,'</h3>',s,'</div></div></div>','<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>','</div>'].join('');}
return{msg:function(title,format,type,time){if(!msgCt){msgCt=Ext.DomHelper.insertFirst(document.body,{id:'msg-div',style:'position:absolute'},true);} return{msg:function(title,format,type,time){if(!msgCt){msgCt=Ext.DomHelper.insertFirst(document.body,{id:'msg-div',style:'position:absolute'},true);}
var s=String.format.apply(String,Array.prototype.slice.call(arguments,1));var m=Ext.DomHelper.append(msgCt,{html:createBox(title,s)},true);m.setWidth(400);m.position(null,5000);m.alignTo(document,'br-br');type=typeof type!='undefined'?type:'';time=typeof time!='undefined'?time:PMExt.notify_time_out;switch(type){case'alert':case'warning':case'tmp-warning':image='/images/alert.gif';break;case'error':case'tmp-error':image='/images/error.png';break;case'tmp-info':case'info':image='/images/info.png';break;case'success':case'ok':image='/images/select-icon.png';break;default:image='';} var s=String.format.apply(String,Array.prototype.slice.call(arguments,1));var m=Ext.DomHelper.append(msgCt,{html:createBox(title,s)},true);m.setWidth(400);m.position(null,5000);m.alignTo(document,'br-br');type=typeof type!='undefined'?type:'';time=typeof time!='undefined'?time:PMExt.notify_time_out;switch(type){case'alert':case'warning':case'tmp-warning':image='/images/alert.gif';break;case'error':case'tmp-error':image='/images/error.png';break;case'tmp-info':case'info':image='/images/info.png';break;case'success':case'ok':image='/images/select-icon.png';break;default:image='';}

View File

@@ -178,7 +178,29 @@ PMExtJSCommon = function() {
Tools.createCookie(name,"",-1); Tools.createCookie(name,"",-1);
} }
} }
this.emailConst = {
appMsgTypeWithoutTask:['EXTERNAL_REGISTRATION','TEST','CASE_NOTE','SOAP','RETRIEVE_PASSWORD'],
appMsgTypeWithConditionalTask:['PM_FUNCTION'],
appMsgTypeWithoutCase:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],
appMsgTypeWithoutProcess:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],
appMsgTypeWithoutNumber:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'],
numberColumn:{
name:'APP_NUMBER',
defaultValue:'N/A'
},
taskColumn:{
name:'TAS_TITLE',
defaultValue:'N/A'
},
caseColumn:{
name:'APP_TITLE',
defaultValue:'N/A'
},
processColumn:{
name:'PRO_TITLE',
defaultValue:'N/A'
}
}
} }
var PMExt = new PMExtJSCommon(); var PMExt = new PMExtJSCommon();

View File

@@ -292,7 +292,8 @@ class ActionsByEmailCoreClass extends PMPlugin
true, true,
$data->DEL_INDEX, $data->DEL_INDEX,
$emailSetup, $emailSetup,
0 0,
WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL
); );
$abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); $abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR');

View File

@@ -5615,9 +5615,14 @@ class Cases
} }
/** /**
* This function send an email for each task in $arrayTask if $to is definded
*
* @param $dataLastEmail * @param $dataLastEmail
* @param $arrayData * @param $arrayData
* @param $arrayTask * @param $arrayTask
* @return void
*
* @see \Cases->sendNotifications()
*/ */
public function sendMessage($dataLastEmail, $arrayData, $arrayTask) public function sendMessage($dataLastEmail, $arrayData, $arrayTask)
{ {
@@ -5701,7 +5706,7 @@ class Cases
'', '',
$dataLastEmail['applicationUid'], $dataLastEmail['applicationUid'],
$dataLastEmail['delIndex'], $dataLastEmail['delIndex'],
'DERIVATION', WsBase::MESSAGE_TYPE_TASK_NOTIFICATION,
$dataLastEmail['subject'], $dataLastEmail['subject'],
$dataLastEmail['from'], $dataLastEmail['from'],
$to, $to,

View File

@@ -663,14 +663,19 @@ class Derivation
/** /**
* Execute Event * Execute Event
* *
* @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask * @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask
* @param array $applicationData Case data * @param array $applicationData Case data
* @param bool $flagEventExecuteBeforeGateway Execute event before gateway * @param bool $flagEventExecuteBeforeGateway Execute event before gateway
* @param bool $flagEventExecuteAfterGateway Execute event after gateway * @param bool $flagEventExecuteAfterGateway Execute event after gateway
* @param int $taskId
* *
* @return void * @return void
* @see Derivation->derivate()
* @see Derivation->doRouteWithoutThread()
* @see Derivation->finishProcess()
* @see Derivation->finishTask()
*/ */
private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='') private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='',$tasId = 0)
{ {
try { try {
//Verify if the Project is BPMN //Verify if the Project is BPMN
@@ -743,7 +748,7 @@ class Derivation
if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') { if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') {
//Email-Event throw //Email-Event throw
$result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData); $result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData, $tasId);
$aContext['envUid'] = $value['uid']; $aContext['envUid'] = $value['uid'];
$aContext['envType'] = $event->getEvnType(); $aContext['envType'] = $event->getEvnType();
@@ -1031,7 +1036,8 @@ class Derivation
$appFields, $appFields,
true, true,
true, true,
$currentDelegation["TAS_UID"] $currentDelegation["TAS_UID"],
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
); );
//Route the case //Route the case
@@ -1877,7 +1883,15 @@ class Derivation
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType()) if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())
&& $multiInstanceCompleted && $executeEvent && $multiInstanceCompleted && $executeEvent
) { ) {
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); $nextDel["TAS_ID"] = $taskDummy->getTasId();
$this->executeEvent(
$nextDel["TAS_UID_DUMMY"],
$appFields,
$flagFirstIteration,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
} }
} }
$aContext['action'] = 'finish-task'; $aContext['action'] = 'finish-task';
@@ -1904,12 +1918,27 @@ class Derivation
$nextDel['ROU_CONDITION'] = ''; $nextDel['ROU_CONDITION'] = '';
} }
//Execute the Intermediate Event After the End of Process //Execute the Intermediate Event After the End of Process
$this->executeEvent($nextDel["TAS_UID"], $appFields, true, true); $this->executeEvent(
$nextDel["TAS_UID"],
$appFields,
true,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
if (isset($nextDel["TAS_UID_DUMMY"]) ) { if (isset($nextDel["TAS_UID_DUMMY"]) ) {
$taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]); $taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]);
if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) { if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) {
$nextDel["TAS_ID"] = $taskDummy->getTasId();
//Throw Events //Throw Events
$this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); $this->executeEvent(
$nextDel["TAS_UID_DUMMY"],
$appFields,
$flagFirstIteration,
true,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
} }
} }
$aContext['action'] = 'end-process'; $aContext['action'] = 'end-process';
@@ -2231,7 +2260,14 @@ class Derivation
//If the all Siblings are done execute the events //If the all Siblings are done execute the events
if (sizeof($arraySiblings) === 0 && !$flagTypeMultipleInstance) { if (sizeof($arraySiblings) === 0 && !$flagTypeMultipleInstance) {
//Throw Events //Throw Events
$this->executeEvent($nextDel["TAS_UID"], $appFields, $flagFirstIteration, false); $this->executeEvent(
$nextDel["TAS_UID"],
$appFields,
$flagFirstIteration,
false,
'',
!empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0
);
} }
//Close thread //Close thread
$this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex );

View File

@@ -8,8 +8,18 @@ use ProcessMaker\Core\System;
class WsBase class WsBase
{ {
const MESSAGE_TYPE_ACTIONS_BY_EMAIL = 'ACTIONS_BY_EMAIL';
const MESSAGE_TYPE_CASE_NOTE = 'CASE_NOTE';
const MESSAGE_TYPE_EMAIL_EVENT = 'EVENT';
const MESSAGE_TYPE_EXTERNAL_REGISTRATION = 'EXTERNAL_REGISTRATION';
const MESSAGE_TYPE_PM_FUNCTION = 'PM_FUNCTION';
const MESSAGE_TYPE_RETRIEVE_PASSWORD = 'RETRIEVE_PASSWORD';
const MESSAGE_TYPE_SOAP = 'SOAP';
const MESSAGE_TYPE_TASK_NOTIFICATION = 'ROUTING';
const MESSAGE_TYPE_TEST_EMAIL = 'TEST';
public $stored_system_variables; //boolean public $stored_system_variables; //boolean
public $wsSessionId; //web service session id, if the wsbase function is used from a WS request public $wsSessionId; //web service session id, if the wsbase function is used from a WS request
private $taskId;
private $flagSameCase = true; private $flagSameCase = true;
public function __construct($params = null) public function __construct($params = null)
@@ -45,6 +55,28 @@ class WsBase
$this->flagSameCase = $var; $this->flagSameCase = $var;
} }
/**
* Get the taskId
*
* @return int
*/
public function getTaskId()
{
return $this->taskId;
}
/**
* Set the taskId
*
* @param int $taskId
*
* @return void
*/
public function setTaskId($taskId)
{
$this->taskId = $taskId;
}
/** /**
* function to start a web services session in ProcessMaker * function to start a web services session in ProcessMaker
* *
@@ -854,6 +886,13 @@ class WsBase
* @param array $config * @param array $config
* *
* @return $result will return an object * @return $result will return an object
*
* @see ActionsByEmailCoreClass->sendActionsByEmail()
* @see workflow\engine\classes\class.pmFunctions::PMFSendMessage()
* @see workflow\engine\methods\services\soap2::sendMessage()
* @see \ProcessMaker\BusinessModel\EmailEvent->sendEmail()
* @see \ProcessMaker\BusinessModel\Pmgmail->sendEmailWithApplicationData()
*
*/ */
public function sendMessage( public function sendMessage(
$appUid, $appUid,
@@ -868,7 +907,8 @@ class WsBase
$showMessage = true, $showMessage = true,
$delIndex = 0, $delIndex = 0,
$config = [], $config = [],
$gmail = 0 $gmail = 0,
$appMsgType = WsBase::MESSAGE_TYPE_PM_FUNCTION
) )
{ {
try { try {
@@ -920,7 +960,7 @@ class WsBase
$spool->setConfig($setup); $spool->setConfig($setup);
$case = new Cases(); $case = new Cases();
$oldFields = $case->loadCase($appUid); $oldFields = $case->loadCase($appUid, $delIndex);
if ($gmail == 1) { if ($gmail == 1) {
$pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP; $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP;
} else { } else {
@@ -946,7 +986,7 @@ class WsBase
'', '',
$appUid, $appUid,
$delIndex, $delIndex,
'TRIGGER', $appMsgType,
$subject, $subject,
G::buildFrom($setup, $from), G::buildFrom($setup, $from),
$to, $to,
@@ -961,7 +1001,7 @@ class WsBase
(preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false, (preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false,
isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0, isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0,
isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0, isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0,
isset($fieldsCase['TAS_ID']) ? $fieldsCase['TAS_ID'] : 0 $this->getTaskId() ?$this->getTaskId():(isset($oldFields['TAS_ID'])? $oldFields['TAS_ID'] : 0)
); );
$spool->create($messageArray); $spool->create($messageArray);

View File

@@ -920,34 +920,34 @@ function getEmailConfiguration ()
* @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFSendMessage.28.29 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFSendMessage.28.29
* *
* @param string(32) | $caseId | UID for case | The UID (unique identification) for a case, which is a string of 32 hexadecimal characters to identify the case. * @param string(32) | $caseId | UID for case | The UID (unique identification) for a case, which is a string of 32 hexadecimal characters to identify the case.
* @param string(32) | $sFrom | Sender | The email address of the person who sends out the email. * @param string(32) | $from | Sender | The email address of the person who sends out the email.
* @param string(100) | $sTo | Recipient | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma. * @param string(100) | $to | Recipient | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma.
* @param string(100) | $sCc = '' | Carbon copy recipient | The email address(es) of people who will receive carbon copies of the email. * @param string(100) | $cc = '' | Carbon copy recipient | The email address(es) of people who will receive carbon copies of the email.
* @param string(100) | $sBcc = ''| Carbon copy recipient | The email address(es) of people who will receive blind carbon copies of the email. * @param string(100) | $bcc = ''| Carbon copy recipient | The email address(es) of people who will receive blind carbon copies of the email.
* @param string(50) | $sSubject | Subject of the email | The subject (title) of the email. * @param string(50) | $subject | Subject of the email | The subject (title) of the email.
* @param string(50) | $sTemplate | Name of the template | The name of the template file in plain text or HTML format which will produce the body of the email. * @param string(50) | $template | Name of the template | The name of the template file in plain text or HTML format which will produce the body of the email.
* @param array | $aFields = array() | Variables for email template | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. * @param array | $emailTemplateVariables = [] | Variables for email template | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values.
* @param array | $aAttachment = array() | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email. * @param array | $attachments = [] | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email.
* @param boolean | $showMessage = true | Show message | Optional parameter. Set to TRUE to show the message in the case's message history. * @param boolean | $showMessage = true | Show message | Optional parameter. Set to TRUE to show the message in the case's message history.
* @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case. * @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case.
* @param string(100) | $config = '' | Email server configuration | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure) Or String: UID of Email server . * @param array | $config = [] | Email server configuration | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure) Or String: UID of Email server .
* @return int | | result | Result of sending email * @return int | | result | Result of sending email
* *
* @see class.pmFunctions::PMFSendMessageToGroup()
*/ */
//@param array | $aFields=array() | An associative array optional | Optional parameter. An associative array where the keys are the variable name and the values are the variable's value.
function PMFSendMessage( function PMFSendMessage(
$caseId, $caseId,
$sFrom, $from,
$sTo, $to,
$sCc, $cc,
$sBcc, $bcc,
$sSubject, $subject,
$sTemplate, $template,
$aFields = array(), $emailTemplateVariables = [],
$aAttachment = array(), $attachments = [],
$showMessage = true, $showMessage = true,
$delIndex = 0, $delIndex = 0,
$config = array() $config = []
) { ) {
ini_set ( "pcre.backtrack_limit", 1000000 ); ini_set ( "pcre.backtrack_limit", 1000000 );
ini_set ( 'memory_limit', '-1' ); ini_set ( 'memory_limit', '-1' );
@@ -955,28 +955,30 @@ function PMFSendMessage(
global $oPMScript; global $oPMScript;
if (isset( $oPMScript->aFields ) && is_array( $oPMScript->aFields )) { if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) {
if (is_array( $aFields )) { if (is_array($emailTemplateVariables)) {
$aFields = array_merge( $oPMScript->aFields, $aFields ); $emailTemplateVariables = array_merge($oPMScript->aFields, $emailTemplateVariables);
} else { } else {
$aFields = $oPMScript->aFields; $emailTemplateVariables = $oPMScript->aFields;
} }
} }
$ws = new WsBase(); $ws = new WsBase();
$result = $ws->sendMessage( $result = $ws->sendMessage(
$caseId, $caseId,
$sFrom, $from,
$sTo, $to,
$sCc, $cc,
$sBcc, $bcc,
$sSubject, $subject,
$sTemplate, $template,
$aFields, $emailTemplateVariables,
$aAttachment, $attachments,
$showMessage, $showMessage,
$delIndex, $delIndex,
$config $config,
0,
WsBase::MESSAGE_TYPE_PM_FUNCTION
); );
if ($result->status_code == 0) { if ($result->status_code == 0) {

View File

@@ -180,8 +180,12 @@ class AppNotes extends BaseAppNotes
* @param string $noteRecipients * @param string $noteRecipients
* @param string $from * @param string $from
* @param integer $delIndex * @param integer $delIndex
* * @return void
* @throws Exception * @throws Exception
*
* @see AppNotes->addCaseNote()
* @see AppNotes->postNewNote()
* @see workflow/engine/src/ProcessMaker/Util/helpers.php::postNote()
*/ */
public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $from = '', $delIndex = 0) public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $from = '', $delIndex = 0)
{ {
@@ -224,7 +228,7 @@ class AppNotes extends BaseAppNotes
'', '',
$appUid, $appUid,
$delIndex, $delIndex,
'DERIVATION', WsBase::MESSAGE_TYPE_CASE_NOTE,
G::replaceDataField($configNoteNotification['subject'], $fieldCase), G::replaceDataField($configNoteNotification['subject'], $fieldCase),
G::buildFrom($configuration, $from), G::buildFrom($configuration, $from),
$to, $to,

View File

@@ -574,8 +574,10 @@ class adminProxy extends HttpProxyController
} }
/** /**
* for send email configuration * For test email configuration
* @autor Alvaro <alvaro@colosa.com> * @return stdClass()
*
* @see adminProxy->testConnection()
*/ */
public function sendTestMail() public function sendTestMail()
{ {
@@ -624,7 +626,7 @@ class adminProxy extends HttpProxyController
'', '',
'', '',
'', '',
'TEST', WsBase::MESSAGE_TYPE_TEST_EMAIL,
$subject, $subject,
$from, $from,
$_POST['TO'], $_POST['TO'],

View File

@@ -68,7 +68,7 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
'', '',
'', '',
0, 0,
'TEST', WsBase::MESSAGE_TYPE_RETRIEVE_PASSWORD,
$subject, $subject,
$from, $from,
$data['USR_EMAIL'], $data['USR_EMAIL'],

View File

@@ -378,6 +378,13 @@ function removeDocument($params)
return $res; return $res;
} }
/**
* Send Message
*
* @param object $params
* @return array
*
*/
function SendMessage($params) function SendMessage($params)
{ {
$vsResult = isValidSession($params->sessionId); $vsResult = isValidSession($params->sessionId);
@@ -393,7 +400,22 @@ function SendMessage($params)
} }
$ws = new WsBase(); $ws = new WsBase();
$res = $ws->sendMessage($params->caseId, $params->from, $params->to, $params->cc, $params->bcc, $params->subject, $params->template); $res = $ws->sendMessage(
$params->caseId,
$params->from,
$params->to,
$params->cc,
$params->bcc,
$params->subject,
$params->template,
null,
null,
true,
0,
[],
0,
WsBase::MESSAGE_TYPE_SOAP
);
return $res->getPayloadArray(); return $res->getPayloadArray();
} }

View File

@@ -24,6 +24,7 @@ use ResultSet;
use SpoolRun; use SpoolRun;
use stdClass; use stdClass;
use Users as ClassUsers; use Users as ClassUsers;
use WsBase;
/** /**
* Description of ActionsByEmailService * Description of ActionsByEmailService
@@ -366,6 +367,9 @@ class ActionsByEmail
* *
* @return string $message * @return string $message
* @throws Exception * @throws Exception
*
* @see workflow/engine/methods/actionsByEmail/actionsByEmailAjax.php
* @see \ProcessMaker\Services\Api\ActionsByEmail::forwardMail()
*/ */
public function forwardMail(array $arrayData) public function forwardMail(array $arrayData)
{ {
@@ -397,7 +401,7 @@ class ActionsByEmail
'', '',
$dataRes['APP_UID'], $dataRes['APP_UID'],
$dataRes['DEL_INDEX'], $dataRes['DEL_INDEX'],
'TEST', WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL,
$dataRes['ABE_REQ_SUBJECT'], $dataRes['ABE_REQ_SUBJECT'],
$aSetup['MESS_ACCOUNT'], $aSetup['MESS_ACCOUNT'],
$dataRes['ABE_REQ_SENT_TO'], $dataRes['ABE_REQ_SENT_TO'],

View File

@@ -14,6 +14,7 @@ use ProcessMaker\Util\Common;
use Propel; use Propel;
use ResultSet; use ResultSet;
use UsersPeer; use UsersPeer;
use WsBase;
class EmailEvent class EmailEvent
{ {
@@ -455,11 +456,13 @@ class EmailEvent
* @param string $prj_uid Unique id of Project * @param string $prj_uid Unique id of Project
* @param string $eventUid Unique id of event * @param string $eventUid Unique id of event
* @param array $arrayApplicationData Case data * @param array $arrayApplicationData Case data
* @param int $tasId id of task
* *
* @return void * @return void
* @throws Exception * @throws Exception
* @see \Derivation::executeEvent()
*/ */
public function sendEmail($appUID, $prj_uid, $eventUid, $arrayApplicationData) public function sendEmail($appUID, $prj_uid, $eventUid, $arrayApplicationData, $tasId = 0)
{ {
if (!$this->existsEvent($prj_uid, $eventUid)) { if (!$this->existsEvent($prj_uid, $eventUid)) {
throw new Exception(G::LoadTranslation('ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST')); throw new Exception(G::LoadTranslation('ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST'));
@@ -511,7 +514,9 @@ class EmailEvent
} }
} }
if (!empty($emailTo)) { if (!empty($emailTo)) {
PMFSendMessage( $ws = new WsBase();
$ws->setTaskId($tasId);
$ws->sendMessage(
$appUID, $appUID,
G::buildFrom($configEmailData), G::buildFrom($configEmailData),
$emailTo, $emailTo,
@@ -523,7 +528,9 @@ class EmailEvent
[], [],
true, true,
0, 0,
$configEmailData $configEmailData,
0,
WsBase::MESSAGE_TYPE_EMAIL_EVENT
); );
} else { } else {
Bootstrap::registerMonolog( Bootstrap::registerMonolog(

View File

@@ -8,6 +8,7 @@ use G;
use ProcessMaker\Core\System; use ProcessMaker\Core\System;
use SpoolRun; use SpoolRun;
use TemplatePower; use TemplatePower;
use WsBase;
class EmailServer class EmailServer
{ {
@@ -156,6 +157,7 @@ class EmailServer
* *
* @return array, return array with result of send test mail * @return array, return array with result of send test mail
* @throws Exception * @throws Exception
* @see EmailServer->testConnectionByStep()
*/ */
public function sendTestMail(array $arrayData) public function sendTestMail(array $arrayData)
{ {
@@ -203,7 +205,7 @@ class EmailServer
'', '',
'', '',
0, 0,
'TEST', WsBase::MESSAGE_TYPE_TEST_EMAIL,
G::LoadTranslation("ID_MESS_TEST_SUBJECT"), G::LoadTranslation("ID_MESS_TEST_SUBJECT"),
G::buildFrom($configuration), G::buildFrom($configuration),
$arrayData["TO"], $arrayData["TO"],

View File

@@ -33,20 +33,39 @@ Ext.onReady(function(){
'<span> {APP_PRO_TITLE}</span>', '<span> {APP_PRO_TITLE}</span>',
'</div></tpl>' '</div></tpl>'
); );
var columnRenderer = function(data, metadata, record, rowIndex,columnIndex, store) { var columnRenderer = function(data, metadata, record, rowIndex,columnIndex, store) {
var new_text = metadata.style.split(';'); if(metadata.id == PMExt.emailConst.taskColumn.name){
var style = ''; if((PMExt.emailConst.appMsgTypeWithoutTask.includes(record.data.APP_MSG_TYPE)) || (PMExt.emailConst.appMsgTypeWithConditionalTask.includes(record.data.APP_MSG_TYPE) && record.data.DEL_INDEX == 0)){
for (var i = 0; i < new_text.length -1 ; i++) { data = PMExt.emailConst.taskColumn.defaultValue;
var chain = new_text[i] +";"; }
if (chain.indexOf('width') == -1) { }
style = style + chain; if(metadata.id == PMExt.emailConst.caseColumn.name){
} if(PMExt.emailConst.appMsgTypeWithoutCase.includes(record.data.APP_MSG_TYPE)){
} data = PMExt.emailConst.caseColumn.defaultValue;
metadata.attr = 'ext:qtip="' + data + '" style="'+ style +' white-space: normal; "'; }
}
if(metadata.id == PMExt.emailConst.processColumn.name){
if(PMExt.emailConst.appMsgTypeWithoutProcess.includes(record.data.APP_MSG_TYPE)){
data = PMExt.emailConst.processColumn.defaultValue;
}
}
if(metadata.id == PMExt.emailConst.numberColumn.name){
if(PMExt.emailConst.appMsgTypeWithoutNumber.includes(record.data.APP_MSG_TYPE)){
data = PMExt.emailConst.numberColumn.defaultValue;
}
}
var new_text = metadata.style.split(';');
var style = '';
for (var i = 0; i < new_text.length -1 ; i++) {
var chain = new_text[i] +";";
if (chain.indexOf('width') == -1) {
style = style + chain;
}
}
metadata.attr = 'ext:qtip="' + data + '" style="'+ style +' white-space: normal; "';
return PMExt.escapeHtml(data); return PMExt.escapeHtml(data);
}; };
var dateFrom = new Ext.form.DateField({ var dateFrom = new Ext.form.DateField({
id:'dateFrom', id:'dateFrom',