Improvements in the system emailing, refactoring part 1

This commit is contained in:
Julio Cesar Laura
2014-04-29 15:18:46 -04:00
parent b8e41bd2a1
commit b2362753a7
6 changed files with 52 additions and 214 deletions

View File

@@ -36,13 +36,13 @@ if ($actionAjax == 'messageHistoryGridList_JXP') {
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : '';
global $G_PUBLISH;
$oCase = new Cases();
$oCase->dir = $dir;
$oCase->dir = $dir;
$oCase->sort = $sort;
$appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']);
@@ -179,41 +179,13 @@ if ($actionAjax == 'sendMailMessage_JXP') {
$oCase = new Cases();
$data = $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] );
G::LoadClass("system");
G::LoadClass('system');
$aSetup = System::getEmailConfiguration();
$passwd = $aSetup['MESS_PASSWORD'];
$passwdDec = G::decrypt( $passwd, 'EMAILENCRYPT' );
$auxPass = explode( 'hash:', $passwdDec );
if (count( $auxPass ) > 1) {
if (count( $auxPass ) == 2) {
$passwd = $auxPass[1];
} else {
array_shift( $auxPass );
$passwd = implode( '', $auxPass );
}
}
$aSetup['MESS_PASSWORD'] = $passwd;
if ($aSetup['MESS_RAUTH'] == false || (is_string($aSetup['MESS_RAUTH']) && $aSetup['MESS_RAUTH'] == 'false')) {
$aSetup['MESS_RAUTH'] = 0;
} else {
$aSetup['MESS_RAUTH'] = 1;
}
$oSpool = new spoolRun();
$oSpool->setConfig(
array (
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
'MESS_SERVER' => $aSetup['MESS_SERVER'],
'MESS_PORT' => $aSetup['MESS_PORT'],
'MESS_ACCOUNT' => $aSetup['MESS_ACCOUNT'],
'MESS_PASSWORD' => $aSetup['MESS_PASSWORD'],
'SMTPSecure' => $aSetup['SMTPSecure'],
'SMTPAuth' => $aSetup['MESS_RAUTH']
)
);
$oSpool->setConfig($aSetup);
$oSpool->create( array ('msg_uid' => $data['MSG_UID'],'app_uid' => $data['APP_UID'],'del_index' => $data['DEL_INDEX'],'app_msg_type' => $data['APP_MSG_TYPE'],'app_msg_subject' => $data['APP_MSG_SUBJECT'],'app_msg_from' => $data['APP_MSG_FROM'],'app_msg_to' => $data['APP_MSG_TO'],'app_msg_body' => $data['APP_MSG_BODY'],'app_msg_cc' => $data['APP_MSG_CC'],'app_msg_bcc' => $data['APP_MSG_BCC'],'app_msg_attach' => $data['APP_MSG_ATTACH'],'app_msg_template' => $data['APP_MSG_TEMPLATE'],'app_msg_status' => 'pending'
) );
$oSpool->sendMail();