Merged in luisfernandosl/processmaker/HOR-1322-E-31 (pull request #4634)

HOR-1322-E
This commit is contained in:
Julio Cesar Laura Avendaño
2016-07-28 18:27:51 -04:00
2 changed files with 14 additions and 3 deletions

View File

@@ -4169,7 +4169,16 @@ class Processes
try {
$emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
$arrayEmailServerDefault = $emailServer->getEmailServerDefault();
foreach ($arrayData as $value) {
unset($value['EMAIL_EVENT_FROM']);
if (!empty($arrayEmailServerDefault)) {
$value['EMAIL_EVENT_FROM'] = $arrayEmailServerDefault['MESS_ACCOUNT'];
}
$emailEventData = $emailEvent->save($processUid, $value);
}
} catch (Exception $e) {

View File

@@ -69,9 +69,9 @@ class EmailEvent
$aRow['EMAIL'] = $aRow['MESS_ACCOUNT'];
} else {
$aRow['EMAIL'] = $aRow['MESS_FROM_MAIL'];
}
}
if($aRow['EMAIL'] != "") {
$accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
$accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
}
}
$result->next();
@@ -445,10 +445,12 @@ class EmailEvent
$emailTo = $email;
}
}
if(!empty($emailTo)) {
if(!empty($emailTo) && $arrayData[3] != '') {
$subject = $arrayData[5];
$subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']);
\PMFSendMessage($appUID, $arrayData[3], $emailTo, '', '', $subject, $contentFile['prf_filename'], array());
} else {
\Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'emailEvent.log');
}
}
}