Merged in bugfix/HOR-4396 (pull request #6436)

HOR-4396

Approved-by: David Callizaya <david.callizaya@processmaker.com>
Approved-by: Paula Quispe <paula.quispe@processmaker.com>
Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2018-05-04 15:30:48 +00:00
committed by Julio Cesar Laura Avendaño
29 changed files with 1239 additions and 772 deletions

View File

@@ -15,32 +15,30 @@ $actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null;
switch ($actionAjax) {
case 'messageHistoryGridList_JXP':
if (!isset($_REQUEST['start']) || $_REQUEST['start'] == '') {
$_REQUEST['start'] = 0;
}
if (!isset($_REQUEST['limit']) || $_REQUEST['limit'] == '') {
$_REQUEST['limit'] = 20;
}
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$start = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0;
$limit = isset($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'DESC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
global $G_PUBLISH;
$case = new Cases();
$case->dir = $dir;
$case->sort = $sort;
$appMessageArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true, $_REQUEST['start'], $_REQUEST['limit']);
$appMessageCountArray = $case->getHistoryMessagesTrackerExt($_SESSION['APPLICATION'], true);
$result = new stdClass();
$process = [];
$proUid = $_SESSION['PROCESS'];
$appUid = $_SESSION['APPLICATION'];
$tasUid = $_SESSION['TASK'];
$usrUid = $_SESSION['USER_LOGGED'];
$caseData = $case->loadCase($appUid);
$appNumber = $caseData['APP_DATA']['APP_NUMBER'];
$appMessage = new AppMessage();
$appMessageArray = $appMessage->getDataMessage(
$appNumber,
true,
$start,
$limit,
$sort,
$dir
);
$totalCount = $appMessage->getCountMessage($appNumber);
$respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'BLOCK');
$respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, 'VIEW');
@@ -70,37 +68,31 @@ switch ($actionAjax) {
}
}
$totalCount = 0;
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))) {
$messageList = [];
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)
)
) {
//Define the label with translation
$value['APP_MSG_TYPE'] = !empty($arrayToTranslation[$value['APP_MSG_TYPE']]) ? $arrayToTranslation[$value['APP_MSG_TYPE']] : $value['APP_MSG_TYPE'];
$appMessageArray[$index]['ID_MESSAGE'] = $appMessageArray[$index]['APP_UID'] . '_' . $appMessageArray[$index]['APP_MSG_UID'];
if ($respMess == 'BLOCK' || $respMess == '') {
$appMessageArray[$index]['APP_MSG_BODY'] = '';
}
$process[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
$totalCount++;
$messageList[] = array_merge($appMessageArray[$index], ['MSGS_HISTORY' => $respMess]);
}
}
$process = array_splice($process, $_REQUEST['start'], $_REQUEST['limit']);
$response = new stdclass();
$response->data = $process;
$response->data = $messageList;
$response->totalCount = $totalCount;
if (!empty($process)) {
if (!isset($response->data[0])) {
$response->data[0] = array('APP_MSG_TYPE' => '');
}
foreach ($response->data as $key => $value) {
$response->data[$key]['APP_MSG_TYPE'] = array_key_exists($response->data[$key]['APP_MSG_TYPE'], $arrayToTranslation) ?
$arrayToTranslation[$response->data[$key]['APP_MSG_TYPE']] :
$response->data[$key]['APP_MSG_TYPE'];
}
}
echo G::json_encode($response);
break;
case 'showHistoryMessage':

File diff suppressed because it is too large Load Diff

View File

@@ -12,8 +12,8 @@ $userData = $rbacUser->getByUsername($data['USR_USERNAME']);
$userExists = $userData === false ? false : true;
if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL'] === $data['USR_EMAIL'] && ($userData['USR_AUTH_TYPE'] === '' || $userData['USR_AUTH_TYPE'] == 'MYSQL')) {
$aSetup = System::getEmailConfiguration();
if (count($aSetup) == 0 || !isset($aSetup['MESS_ENGINE'])) {
$setup = System::getEmailConfiguration();
if (count($setup) == 0 || !isset($setup['MESS_ENGINE'])) {
G::SendTemporalMessage('ID_EMAIL_ENGINE_IS_NOT_ENABLED', "warning");
G::header('location: forgotPassword');
die;
@@ -21,25 +21,26 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
$newPass = G::generate_password();
$aData['USR_UID'] = $userData['USR_UID'];
$aData['USR_PASSWORD'] = Bootstrap::hashPassword($newPass);
$oUserProperty = new UsersProperties();
$aUserPropertyData = $oUserProperty->load($aData['USR_UID']);
$infoUser = [];
$infoUser['USR_UID'] = $userData['USR_UID'];
$infoUser['USR_PASSWORD'] = Bootstrap::hashPassword($newPass);
$userProperty = new UsersProperties();
$aUserPropertyData = $userProperty->load($infoUser['USR_UID']);
if (is_array($aUserPropertyData)) {
$aUserPropertyData['USR_LOGGED_NEXT_TIME'] = 1;
$oUserProperty = $oUserProperty->update($aUserPropertyData);
$userProperty = $userProperty->update($aUserPropertyData);
}
if (!isset($sFrom)) {
$sFrom = '';
if (!isset($from)) {
$from = '';
}
$sFrom = G::buildFrom($aSetup, $sFrom);
$from = G::buildFrom($setup, $from);
$sSubject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
$subject = G::LoadTranslation('ID_RESET_PASSWORD') . ' - ProcessMaker';
$msg = '<h3>ProcessMaker Forgot password Service</h3>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_USERMANE_IS') . ' : <strong>' . $userData['USR_USERNAME'] . '</strong></p>';
$msg .= '<p>' . G::LoadTranslation('ID_YOUR_PASSWORD_IS') . ' : <strong>' . $newPass . '</strong></p>';
switch ($aSetup['MESS_ENGINE']) {
switch ($setup['MESS_ENGINE']) {
case 'MAIL':
$engine = G::LoadTranslation('ID_MESS_ENGINE_TYPE_1');
break;
@@ -51,7 +52,7 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
break;
}
$sBody = "
$body = "
<table style=\"background-color: white; font-family: Arial,Helvetica,sans-serif; color: black; font-size: 11px; text-align: left;\" cellpadding='10' cellspacing='0' width='100%'>
<tbody><tr><td><img id='logo' src='http://" . $_SERVER['SERVER_NAME'] . "/images/processmaker.logo.jpg' /></td></tr>
<tr><td style='font-size: 14px;'>$msg</td></tr>
@@ -60,30 +61,30 @@ if ($userExists === true && $userData['USR_EMAIL'] != '' && $userData['USR_EMAIL
<a href='http://www.processmaker.com' style='color:#c40000;'>www.processmaker.com</a><br /></td>
</tr></tbody></table>";
$oSpool = new SpoolRun();
$spool = new SpoolRun();
$oSpool->setConfig($aSetup);
$oSpool->create(array(
'msg_uid' => '',
'app_uid' => '',
'del_index' => 0,
'app_msg_type' => 'TEST',
'app_msg_subject' => $sSubject,
'app_msg_from' => $sFrom,
'app_msg_to' => $data['USR_EMAIL'],
'app_msg_body' => $sBody,
'app_msg_cc' => '',
'app_msg_bcc' => '',
'app_msg_attach' => '',
'app_msg_template' => '',
'app_msg_status' => 'pending',
'app_msg_attach' => ''
));
$spool->setConfig($setup);
$messageArray = AppMessage::buildMessageRow(
'',
'',
0,
'TEST',
$subject,
$from,
$data['USR_EMAIL'],
$body,
'',
'',
'',
'',
'pending'
);
$spool->create($messageArray);
try {
$oSpool->sendMail();
$rbacUser->update($aData);
$user->update($aData);
$spool->sendMail();
$rbacUser->update($infoUser);
$user->update($infoUser);
G::header("location: login");
G::SendTemporalMessage('ID_NEW_PASSWORD_SENT', "info");
} catch (phpmailerException $e) {

View File

@@ -22,18 +22,18 @@ $G_ID_SUB_MENU_SELECTED = 'EMAILS';
//get values for the comboBoxes
$userUid = (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
$status = array(
array('', G::LoadTranslation('ID_ALL')),
array("sent", G::LoadTranslation('ID_SENT')),
array("pending", G::LoadTranslation('ID_PENDING'))
);
//Get the status values
$status = AppMessage::getAllStatus();
//Get the process values
$process = new BmProcess();
$processes = $process->getProcessList('', true);
//Review if the plugin External is enable
$pluginRegistry = PluginRegistry::loadSingleton();
$flagER = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
$process = new BmProcess();
$processes = $process->getProcessList();
$G_PUBLISH = new Publisher();
$oHeadPublisher = &headPublisher::getSingleton();

View File

@@ -21,23 +21,15 @@ switch ($req) {
case 'MessageList':
$start = (isset($_REQUEST['start'])) ? $_REQUEST['start'] : '0';
$limit = (isset($_REQUEST['limit'])) ? $_REQUEST['limit'] : '25';
$proUid = (isset($_REQUEST['process'])) ? $_REQUEST['process'] : '';
$proId = (isset($_REQUEST['process'])) ? $_REQUEST['process'] : '';
$eventype = (isset($_REQUEST['type'])) ? $_REQUEST['type'] : '';
$emailStatus = (isset($_REQUEST['status'])) ? $_REQUEST['status'] : '';
$msgStatusId = (isset($_REQUEST['status'])) ? $_REQUEST['status'] : '';
$sort = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : '';
$dir = isset($_REQUEST['dir']) ? $_REQUEST['dir'] : 'ASC';
$dateFrom = isset($_POST["dateFrom"]) ? substr($_POST["dateFrom"], 0, 10) : "";
$dateTo = isset($_POST["dateTo"]) ? substr($_POST["dateTo"], 0, 10) : "";
$filterBy = (isset($_REQUEST['filterBy'])) ? $_REQUEST['filterBy'] : 'ALL';
//Review the External Registration
$arrayType = [];
$pluginRegistry = PluginRegistry::loadSingleton();
$flagEr = $pluginRegistry->isEnable('externalRegistration') ? 1 : 0;
if ($flagEr == 0) {
$arrayType[] = 'EXTERNAL_REGISTRATION';
}
$criteria = new Criteria();
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_UID);
$criteria->addSelectColumn(AppMessagePeer::APP_UID);
@@ -58,31 +50,33 @@ switch ($req) {
$criteria->addSelectColumn(ProcessPeer::PRO_TITLE);
$criteria->addSelectColumn(TaskPeer::TAS_TITLE);
$criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(ApplicationPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$criteria->addJoin(AppMessagePeer::TAS_ID, TaskPeer::TAS_ID, Criteria::LEFT_JOIN);
$criteria->addJoin(AppMessagePeer::PRO_ID, ProcessPeer::PRO_ID, Criteria::LEFT_JOIN);
//Status can be: All, Participated, Pending
if (!empty($emailStatus)) {
$criteria->add(AppMessagePeer::APP_MSG_STATUS, $emailStatus);
//Status can be: All, Participated, Pending, Failed
if (!empty($msgStatusId)) {
$criteria->add(AppMessagePeer::APP_MSG_STATUS_ID, $msgStatusId);
}
//Process uid
if (!empty($proUid)) {
$criteria->add(ApplicationPeer::PRO_UID, $proUid);
if (!empty($proId)) {
$criteria->add(AppMessagePeer::PRO_ID, $proId);
}
//Filter by can be: All, Cases, Test
switch ($filterBy) {
case 'CASES':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, ['TEST', 'EXTERNAL_REGISTRATION'], Criteria::NOT_IN);
case 'CASES': //TRIGGER and DERIVATION
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, [AppMessage::TYPE_TRIGGER, AppMessage::TYPE_DERIVATION], Criteria::IN);
break;
case 'TEST':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'TEST', Criteria::EQUAL);
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_TEST, Criteria::EQUAL);
break;
case 'EXTERNAL-REGISTRATION':
$criteria->add(AppMessagePeer::APP_MSG_TYPE, 'EXTERNAL_REGISTRATION', Criteria::EQUAL);
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_EXTERNAL_REGISTRATION, Criteria::EQUAL);
break;
default:
if (!empty($arrayType)) {
$criteria->add(AppMessagePeer::APP_MSG_TYPE, $arrayType, Criteria::NOT_IN);
//Review the External Registration
$pluginRegistry = PluginRegistry::loadSingleton();
if (!$pluginRegistry->isEnable('externalRegistration')) {
$criteria->add(AppMessagePeer::APP_MSG_TYPE_ID, AppMessage::TYPE_EXTERNAL_REGISTRATION, Criteria::NOT_EQUAL);
}
break;
}
@@ -157,9 +151,9 @@ switch ($req) {
die(G::json_encode($response));
break;
case 'updateStatusMessage':
if (isset($_REQUEST['APP_MSG_UID']) && isset($_REQUEST['APP_MSG_STATUS'])) {
if (isset($_REQUEST['APP_MSG_UID']) && isset($_REQUEST['APP_MSG_STATUS_ID'])) {
$message = new AppMessage();
$result = $message->updateStatus($_REQUEST['APP_MSG_UID'], $_REQUEST['APP_MSG_STATUS']);
$result = $message->updateStatus($_REQUEST['APP_MSG_UID'], $_REQUEST['APP_MSG_STATUS_ID']);
}
break;
}

View File

@@ -66,7 +66,10 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$ws = new WsBase();
$result = $ws->derivateCase(
$caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true
$caseFieldsABE['CURRENT_USER_UID'],
$_REQUEST['APP_UID'],
$_REQUEST['DEL_INDEX'],
true
);
$code = (is_array($result))? $result['status_code'] : $result->status_code;
@@ -101,9 +104,9 @@ if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
$response = new stdClass();
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
$response->appUid = $_REQUEST['APP_UID'];
$response->delIndex = $_REQUEST['DEL_INDEX'];
$response->noteText = 'Check the information that was sent for the receiver: ' .
$dataAbeRequests['ABE_REQ_SENT_TO'];
postNote($response);
}

View File

@@ -5,28 +5,7 @@ if (PMLicensedFeatures
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
$G_PUBLISH = new Publisher();
try {
/**
* $backupSession = serialize($_SESSION);
* This script runs with $ _SESSION ['USER_LOGGED'] = '00000000000000000000000000000001',
* this action enables login as admin if you enter the url 'http://myserver.net/sysworkflow/en/neoclassic/processes/main',
* in the Browser that invoked this script.
* This action ensures that any changes to the session variables required by
* this script do not affect the main session if it exists, for example
* when multiple tabs are open.
* Serialization is used because for object types the simple assignment:
* $backupSession = $ _SESSION will not work because the assignment is by
* reference, eg:
* <?php
* $obj = new stdClass();
* $obj->value = "value";
*
* $a = ["one" => 1, "two" => $obj, "three" => 3];
* $b = $a;
* $a["two"]->value = "modify";
*
* In 'b' is reflected the output of 'a'.
*/
$backupSession = serialize($_SESSION);
if (empty($_GET['APP_UID'])) {
@@ -52,46 +31,19 @@ if (PMLicensedFeatures
$aber = G::decrypt($_REQUEST['ABER'], URL_KEY);
$forms = isset($_REQUEST['form']) ? $_REQUEST['form'] : [];
//Load data related to the case
$case = new Cases();
$casesFields = $case->loadCase($appUid, $delIndex);
$casesFields['APP_DATA'] = array_merge($casesFields['APP_DATA'], $forms);
//Get user info
$current_user_uid = null;
$currentUsrName = null;
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
$rsSQL = AppDelegationPeer::doSelectRS($criteria);
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsSQL->next()) {
$row = $rsSQL->getRow();
$current_user_uid = $row["USR_UID"];
}
if ($current_user_uid != null) {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
$criteria->add(UsersPeer::USR_UID, $current_user_uid);
$rsSQL = UsersPeer::doSelectRS($criteria);
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$rsSQL->next();
$row = $rsSQL->getRow();
$currentUsrName = $row["USR_USERNAME"];
$casesFields["APP_DATA"]["USER_LOGGED"] = $current_user_uid;
$casesFields["APP_DATA"]["USR_USERNAME"] = $currentUsrName;
//Get current user info
$delegation = new AppDelegation();
$currentUsrUid = $delegation->getUserAssignedInThread($appUid, $delIndex);
if (!is_null($currentUsrUid)) {
$users = new Users();
$userInfo = $users->loadDetails($currentUsrUid);
$casesFields["APP_DATA"]["USER_LOGGED"] = $currentUsrUid;
$casesFields["APP_DATA"]["USR_USERNAME"] = $userInfo['USR_USERNAME'];
}
foreach ($casesFields["APP_DATA"] as $index => $value) {
@@ -102,7 +54,12 @@ if (PMLicensedFeatures
$case->updateCase($appUid, $casesFields);
$wsBaseInstance = new WsBase();
$result = $wsBaseInstance->derivateCase($casesFields['CURRENT_USER_UID'], $appUid, $delIndex, true);
$result = $wsBaseInstance->derivateCase(
$casesFields['CURRENT_USER_UID'],
$appUid,
$delIndex,
true
);
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
$dataResponses = array();
@@ -130,8 +87,8 @@ if (PMLicensedFeatures
$response = new stdclass();
$response->usrUid = $casesFields['APP_DATA']['USER_LOGGED'];
$response->appUid = $appUid;
$response->delIndex = $delIndex;
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
postNote($response);
}
@@ -141,7 +98,7 @@ if (PMLicensedFeatures
if (isset($_FILES ['form'])) {
if (isset($_FILES["form"]["name"]) && count($_FILES["form"]["name"]) > 0) {
$oInputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
$oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $current_user_uid, $appUid, $delIndex);
$oInputDocument->uploadFileCase($_FILES, $case, $casesFields, $currentUsrUid, $appUid, $delIndex);
}
}