From 853bd5be485b5d10e1fcfdcebf9a38ea14a09c34 Mon Sep 17 00:00:00 2001 From: Carlos Pacha Date: Wed, 17 Aug 2011 10:41:06 -0400 Subject: [PATCH] BUG 3910 Attachments to email messages added attachment option, at least one or more attachment file --- gulliver/thirdparty/phpmailer/class.phpmailer.php | 2 +- workflow/engine/classes/class.pmFunctions.php | 2 +- workflow/engine/classes/class.spool.php | 7 +++++-- workflow/engine/classes/class.wsBase.php | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/gulliver/thirdparty/phpmailer/class.phpmailer.php b/gulliver/thirdparty/phpmailer/class.phpmailer.php index 5a550ddad..81fb5ec38 100644 --- a/gulliver/thirdparty/phpmailer/class.phpmailer.php +++ b/gulliver/thirdparty/phpmailer/class.phpmailer.php @@ -1359,7 +1359,7 @@ class PHPMailer { 4 => $type, 5 => false, // isStringAttachment 6 => 'attachment', - 7 => 0 + 7 => count($this->attachment) ); } catch (phpmailerException $e) { diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 4dcc8d893..ee27f635a 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -773,7 +773,7 @@ function getEmailConfiguration () { * */ //@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(), $sAttachment) { +function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $aFields = array(), $sAttachment = array()) { G::LoadClass('wsBase'); $ws = new wsBase (); diff --git a/workflow/engine/classes/class.spool.php b/workflow/engine/classes/class.spool.php index bd805b775..87b6e9903 100755 --- a/workflow/engine/classes/class.spool.php +++ b/workflow/engine/classes/class.spool.php @@ -386,8 +386,11 @@ class spoolRun { } $oPHPMailer->Body = $msBody; - if($this->fileData['attachments']) - $oPHPMailer->AddAttachment($this->fileData['attachments']); + if(is_array($this->fileData['attachments'])){ + foreach($this->fileData['attachments'] as $key => $fileAttach){ + $oPHPMailer->AddAttachment($fileAttach); + } + } foreach( $this->fileData['envelope_to'] as $sEmail ) { $evalMail = strpos($sEmail, '<'); if( strpos($sEmail, '<') !== false ) { diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 176bb3b7e..403dfc346 100644 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -596,7 +596,7 @@ class wsBase * @param $appFields = null * @return $result will return an object */ - public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $sAttachment ) { + public function sendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplate, $appFields = null, $sAttachment = null ) { try { $aSetup = getEmailConfiguration();