From ee7ec4f2df089cdb80f26e4d234a290b1f82677c Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Fri, 23 Nov 2012 10:46:59 -0400 Subject: [PATCH] BUG 9935 "DEL_INDEX PM Table Value" SOLVED - Every time I send E-mails with PMFSendMessage() function, it doesn't keep a track in DEL_INDEX field from APP_MESSAGE table - Added parameter $delIndex to the function * Available from version 2.0.46 --- workflow/engine/classes/class.pmFunctions.php | 34 ++++++++++++++++--- workflow/engine/classes/class.wsBase.php | 34 +++++++++++++++++-- 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index e7a772d23..1e6437032 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -786,12 +786,25 @@ function getEmailConfiguration () * @param string(32) | $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 array | $aFields | An optional associative array | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. * @param array | $aAttachment | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email. + * @param boolean | $showMessage = true | Show message | Optional parameter. + * @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case. * @return int | $result | result | Result of sending email * */ //@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 ($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $aFields = array(), $aAttachment = array(), $showMessage = true) -{ +function PMFSendMessage( + $caseId, + $sFrom, + $sTo, + $sCc, + $sBcc, + $sSubject, + $sTemplate, + $aFields = array(), + $aAttachment = array(), + $showMessage = true, + $delIndex = 0 +) { global $oPMScript; if (isset( $oPMScript->aFields ) && is_array( $oPMScript->aFields )) { @@ -802,9 +815,22 @@ function PMFSendMessage ($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTempla } } - G::LoadClass( 'wsBase' ); + G::LoadClass("wsBase"); + $ws = new wsBase(); - $result = $ws->sendMessage( $caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $aFields, $aAttachment, $showMessage); + $result = $ws->sendMessage( + $caseId, + $sFrom, + $sTo, + $sCc, + $sBcc, + $sSubject, + $sTemplate, + $aFields, + $aAttachment, + $showMessage, + $delIndex + ); if ($result->status_code == 0) { return 1; diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index d386d54d9..fe9a6f8dd 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -729,10 +729,24 @@ class wsBase * @param string $sSubject * @param string $sTemplate * @param $appFields = null + * @param $aAttachment = null + * @param boolean $showMessage = true + * @param int $delIndex = 0 * @return $result will return an object */ - public function sendMessage ($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $aAttachment = null, $showMessage = true) - { + public function sendMessage( + $caseId, + $sFrom, + $sTo, + $sCc, + $sBcc, + $sSubject, + $sTemplate, + $appFields = null, + $aAttachment = null, + $showMessage = true, + $delIndex = 0 + ) { try { G::loadClass( 'system' ); @@ -789,7 +803,21 @@ class wsBase } $showMessage = ($showMessage) ? 1 : 0 ; - $messageArray = array ('msg_uid' => '','app_uid' => $caseId,'del_index' => 0,'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 + $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 ); $oSpool->create( $messageArray );