.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
$actionAjax = isset( $_REQUEST['actionAjax'] ) ? $_REQUEST['actionAjax'] : null;
if ($actionAjax == 'messageHistoryGridList_JXP') {
if (!isset($_REQUEST['start'])) {
$_REQUEST['start'] = 0;
}
if (!isset($_REQUEST['limit'])) {
$_REQUEST['limit'] = 20;
}
G::LoadClass( 'case' );
G::LoadClass( "BasePeer" );
$dir = isset( $_POST['dir'] ) ? $_POST['dir'] : 'ASC';
$sort = isset( $_POST['sort'] ) ? $_POST['sort'] : '';
global $G_PUBLISH;
$oCase = new Cases();
$oCase->dir = $dir;
$oCase->sort = $sort;
$appMessageArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']);
$appMessageCountArray = $oCase->getHistoryMessagesTrackerExt( $_SESSION['APPLICATION'], true);
$result = new stdClass();
$aProcesses = Array ();
$proUid = $_SESSION['PROCESS'];
$appUid = $_SESSION['APPLICATION'];
$tasUid = $_SESSION['TASK'];
$usrUid = $_SESSION['USER_LOGGED'];
$respBlock = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' );
$respView = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' );
$respResend = $oCase->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'RESEND' );
$delIndex = array();
$respMess = "";
if (count($respBlock["MSGS_HISTORY"]) > 0) {
$respMess = $respBlock["MSGS_HISTORY"]["PERMISSION"];
if (isset($respBlock["MSGS_HISTORY"]["DEL_INDEX"])) {
$delIndex = $respBlock["MSGS_HISTORY"]["DEL_INDEX"];
}
}
if (count($respView["MSGS_HISTORY"]) > 0) {
$respMess = $respView["MSGS_HISTORY"]["PERMISSION"];
if (isset($respView["MSGS_HISTORY"]["DEL_INDEX"])) {
$delIndex = $respView["MSGS_HISTORY"]["DEL_INDEX"];
}
}
if (count($respResend["MSGS_HISTORY"]) > 0) {
$respMess = $respResend["MSGS_HISTORY"]["PERMISSION"];
if (isset($respResend["MSGS_HISTORY"]["DEL_INDEX"])) {
$delIndex = $respResend["MSGS_HISTORY"]["DEL_INDEX"];
}
}
foreach ($appMessageArray as $index => $value) {
if (($appMessageArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1 && $respMess != 'BLOCK' ) &&
($appMessageArray[$index]['DEL_INDEX'] == 0 || in_array($appMessageArray[$index]['DEL_INDEX'], $delIndex ))) {
$appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID'];
if ($respMess == 'BLOCK' || $respMess == '') {
$appMessageArray[$index]['APP_MSG_BODY'] = "";
}
$aProcesses[] = array_merge($appMessageArray[$index], array('MSGS_HISTORY' => $respMess));
}
}
$totalCount = 0;
foreach ($appMessageCountArray as $index => $value) {
if ($appMessageCountArray[$index]['APP_MSG_SHOW_MESSAGE'] == 1) {
$totalCount ++;
}
}
$aProcesses = array_splice($aProcesses, $_REQUEST['start'], $_REQUEST['limit']);
$newDir = '/tmp/test/directory';
$r = G::verifyPath( $newDir );
$r->data = $aProcesses;
$r->totalCount = $totalCount;
echo G::json_encode( $r );
}
if ($actionAjax == 'showHistoryMessage') {
?>
AddContent( 'xmlform', 'xmlform', 'cases/cases_MessagesView', '', $oCase->getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] ) );
?>
getHistoryMessagesTrackerView( $_POST['APP_UID'], $_POST['APP_MSG_UID'] );
G::LoadClass('system');
$aSetup = System::getEmailConfiguration();
$oSpool = new spoolRun();
$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();
} catch (Exception $e) {
$errorMessage = $e->getMessage();
}
echo $errorMessage;
}