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':

View File

@@ -2,28 +2,10 @@
/**
* cases_Derivate.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (!isset($_SESSION['USER_LOGGED'])) {
G::SendTemporalMessage( 'ID_LOGIN_AGAIN', 'warning', 'labels' );
die( '<script type="text/javascript">
G::SendTemporalMessage('ID_LOGIN_AGAIN', 'warning', 'labels');
die('<script type="text/javascript">
var olink = document.location.href;
olink = ( olink.search("gmail") == -1 ) ? parent.document.location.href : olink;
if(olink.search("gmail") == -1){
@@ -50,16 +32,17 @@ if (!isset($_SESSION['USER_LOGGED'])) {
}
</script>');
}
/* Permissions */
switch ($RBAC->userCanAccess( 'PM_CASES' )) {
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::header( 'location: ../login/login' );
switch ($RBAC->userCanAccess('PM_CASES')) {
case -2:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::header( 'location: ../login/login' );
case -1:
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
G::header('location: ../login/login');
die();
break;
}
@@ -67,37 +50,38 @@ switch ($RBAC->userCanAccess( 'PM_CASES' )) {
/* Includes */
//If no variables are submitted and the $_POST variable is empty
if (!isset($_POST['form'])) {
$_POST['form'] = array();
$_POST['form'] = [];
}
/* GET , POST & $_SESSION Vars */
/* Process the info */
$sStatus = 'TO_DO';
foreach ($_POST['form']['TASKS'] as $aValues) {
}
try {
//Load Session variables
$processUid = isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '';
//load data
$oCase = new Cases();
//warning: we are not using the result value of function thisIsTheCurrentUser, so I'm commenting to optimize speed.
//$oCase->thisIsTheCurrentUser( $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'REDIRECT', 'casesListExtJs');
$appFields = $oCase->loadCase( $_SESSION['APPLICATION'] );
$appFields['APP_DATA'] = array_merge( $appFields['APP_DATA'], G::getSystemConstants() );
$appFields = $oCase->loadCase($_SESSION['APPLICATION']);
$appFields['APP_DATA'] = array_merge($appFields['APP_DATA'], G::getSystemConstants());
//cleaning debug variables
$_SESSION['TRIGGER_DEBUG']['DATA'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = Array ();
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = Array ();
$_SESSION['TRIGGER_DEBUG']['DATA'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_NAMES'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_VALUES'] = [];
$_SESSION['TRIGGER_DEBUG']['TRIGGERS_EXECUTION_TIME'] = [];
$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE' );
$triggers = $oCase->loadTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE');
//if there are some triggers to execute
if (sizeof( $triggers ) > 0) {
if (sizeof($triggers) > 0) {
//Execute triggers before derivation
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'BEFORE', $appFields['APP_DATA'] );
$appFields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'BEFORE',
$appFields['APP_DATA']);
//save trigger variables for debugger
$_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][0]['NUM_TRIGGERS'] = sizeof($triggers);
$_SESSION['TRIGGER_DEBUG']['info'][0]['TIME'] = G::toUpper(G::loadTranslation('ID_BEFORE'));
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE');
$_SESSION['TRIGGER_DEBUG']['info'][0]['TRIGGERS_VALUES'] = $triggers;
@@ -110,27 +94,27 @@ try {
unset($appFields['APP_PIN']);
$appFields["DEL_INDEX"] = $_SESSION["INDEX"];
$appFields["TAS_UID"] = $_SESSION["TASK"];
$appFields["USER_UID"] = $_SESSION["USER_LOGGED"];
$appFields["TAS_UID"] = $_SESSION["TASK"];
$appFields["USER_UID"] = $_SESSION["USER_LOGGED"];
$appFields["CURRENT_DYNAFORM"] = "-2";
$appFields["OBJECT_TYPE"] = "ASSIGN_TASK";
$appFields["OBJECT_TYPE"] = "ASSIGN_TASK";
$oCase->updateCase($_SESSION["APPLICATION"], $appFields); //Save data
//Prepare information for the derivation
$oDerivation = new Derivation();
$aCurrentDerivation = array (
$aCurrentDerivation = [
'APP_UID' => $_SESSION['APPLICATION'],
'DEL_INDEX' => $_SESSION['INDEX'],
'APP_STATUS' => $sStatus,
'TAS_UID' => $_SESSION['TASK'],
'ROU_TYPE' => $_POST['form']['ROU_TYPE']
);
$aDataForPrepareInfo = array (
];
$aDataForPrepareInfo = [
'USER_UID' => $_SESSION['USER_LOGGED'],
'APP_UID' => $_SESSION['APPLICATION'],
'DEL_INDEX' => $_SESSION['INDEX']
);
];
//We define some parameters in the before the derivation
//Then this function will be route the case
@@ -154,13 +138,15 @@ try {
}
}
$appFields = $oCase->loadCase( $_SESSION['APPLICATION'] ); //refresh appFields, because in derivations should change some values
$triggers = $oCase->loadTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER' ); //load the triggers after derivation
if (sizeof( $triggers ) > 0) {
$appFields['APP_DATA'] = $oCase->ExecuteTriggers( $_SESSION['TASK'], 'ASSIGN_TASK', - 2, 'AFTER', $appFields['APP_DATA'] ); //Execute triggers after derivation
$appFields = $oCase->loadCase($_SESSION['APPLICATION']); //refresh appFields, because in derivations should change some values
$triggers = $oCase->loadTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2,
'AFTER'); //load the triggers after derivation
if (sizeof($triggers) > 0) {
$appFields['APP_DATA'] = $oCase->ExecuteTriggers($_SESSION['TASK'], 'ASSIGN_TASK', -2, 'AFTER',
$appFields['APP_DATA']); //Execute triggers after derivation
$_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof( $triggers );
$_SESSION['TRIGGER_DEBUG']['info'][1]['NUM_TRIGGERS'] = sizeof($triggers);
$_SESSION['TRIGGER_DEBUG']['info'][1]['TIME'] = G::toUpper(G::loadTranslation('ID_AFTER'));
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_NAMES'] = array_column($triggers, 'TRI_TITLE');
$_SESSION['TRIGGER_DEBUG']['info'][1]['TRIGGERS_VALUES'] = $triggers;
@@ -172,12 +158,12 @@ try {
unset($appFields['APP_PIN']);
$appFields["DEL_INDEX"] = $_SESSION["INDEX"];
$appFields["TAS_UID"] = $_SESSION["TASK"];
$appFields["USER_UID"] = $_SESSION["USER_LOGGED"];
$appFields["TAS_UID"] = $_SESSION["TASK"];
$appFields["USER_UID"] = $_SESSION["USER_LOGGED"];
$appFields["CURRENT_DYNAFORM"] = "-2";
$appFields["OBJECT_TYPE"] = "ASSIGN_TASK";
$appFields["OBJECT_TYPE"] = "ASSIGN_TASK";
$oCase->updateCase( $_SESSION['APPLICATION'], $appFields );
$oCase->updateCase($_SESSION['APPLICATION'], $appFields);
// Send notifications - Start
$oUser = new Users();
@@ -188,20 +174,21 @@ try {
$flagGmail = false;
/*----------------------------------********---------------------------------*/
$licensedFeatures = &PMLicensedFeatures::getSingleton ();
if ($licensedFeatures->verifyfeature ( '7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09' )) {
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$pmGoogle = new PmGoogleApi ();
if ($pmGoogle->getServiceGmailStatus ()) {
if ($pmGoogle->getServiceGmailStatus()) {
$flagGmail = true;
$appDel = new AppDelegation ();
$actualThread = $appDel->Load ( $_SESSION ['APPLICATION'], $_SESSION ['INDEX'] );
$actualThread = $appDel->Load($_SESSION ['APPLICATION'], $_SESSION ['INDEX']);
$appDelPrev = $appDel->LoadParallel ( $_SESSION ['APPLICATION'] );
$appDelPrev = $appDel->LoadParallel($_SESSION ['APPLICATION']);
$Pmgmail = new \ProcessMaker\BusinessModel\Pmgmail ();
foreach ( $appDelPrev as $app ) {
foreach ($appDelPrev as $app) {
if (($app ['DEL_INDEX'] != $_SESSION ['INDEX']) && ($app ['DEL_PREVIOUS'] != $actualThread ['DEL_PREVIOUS'])) {
$Pmgmail->gmailsIfSelfServiceValueBased ( $_SESSION ['APPLICATION'], $app ['DEL_INDEX'], $_POST ['form'] ['TASKS'], $appFields ['APP_DATA'] );
$Pmgmail->gmailsIfSelfServiceValueBased($_SESSION ['APPLICATION'], $app ['DEL_INDEX'],
$_POST ['form'] ['TASKS'], $appFields ['APP_DATA']);
}
}
}
@@ -209,32 +196,42 @@ try {
/*----------------------------------********---------------------------------*/
try {
$oCase->sendNotifications( $_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromData );
$oCase->sendNotifications(
$_SESSION['TASK'],
$_POST['form']['TASKS'],
$appFields['APP_DATA'],
$_SESSION['APPLICATION'],
$_SESSION['INDEX'],
$sFromData
);
} catch (Exception $e) {
G::SendTemporalMessage( G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%' );
G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR') . ' - ' . $e->getMessage(), 'warning',
'string', null, '100%');
}
// Send notifications - End
// Events - Start
$oEvent = new Event();
$oEvent->closeAppEvents( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK'] );
$oCurrentAppDel = AppDelegationPeer::retrieveByPk( $_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1 );
$oEvent->closeAppEvents($processUid, $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']);
$oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1);
$multipleDelegation = false;
// check if there are multiple derivations
if (count( $_POST['form']['TASKS'] ) > 1) {
if (count($_POST['form']['TASKS']) > 1) {
$multipleDelegation = true;
}
// If the case has been delegated
if (isset( $oCurrentAppDel )) {
if (isset($oCurrentAppDel)) {
// if there is just a single derivation the TASK_UID can be set by the delegation data
if (! $multipleDelegation) {
$aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID'] );
if (!$multipleDelegation) {
$aCurrentAppDel = $oCurrentAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'],
$aCurrentAppDel['DEL_INDEX'], $aCurrentAppDel['TAS_UID']);
} else {
// else we need to check every task and create the events if it have any
foreach ($_POST['form']['TASKS'] as $taskDelegated) {
$aCurrentAppDel = $oCurrentAppDel->toArray( BasePeer::TYPE_FIELDNAME );
$oEvent->createAppEvents( $aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'], $aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID'] );
$aCurrentAppDel = $oCurrentAppDel->toArray(BasePeer::TYPE_FIELDNAME);
$oEvent->createAppEvents($aCurrentAppDel['PRO_UID'], $aCurrentAppDel['APP_UID'],
$aCurrentAppDel['DEL_INDEX'], $taskDelegated['TAS_UID']);
}
}
}
@@ -257,16 +254,18 @@ try {
$debuggerAvailable = true;
$casesRedirector = 'casesListExtJsRedirector';
if (isset ( $_SESSION ['user_experience'] ) && $flagGmail === false) {
if (isset ($_SESSION ['user_experience']) && $flagGmail === false) {
$aNextStep ['PAGE'] = $casesRedirector . '?ux=' . $_SESSION ['user_experience'];
$debuggerAvailable = false;
} else if ($flagGmail === true) {
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
} else {
$aNextStep ['PAGE'] = $casesRedirector;
if ($flagGmail === true) {
$aNextStep ['PAGE'] = $casesRedirector . '?gmail=1';
} else {
$aNextStep ['PAGE'] = $casesRedirector;
}
}
if (isset( $_SESSION['PMDEBUGGER'] ) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
if (isset($_SESSION['PMDEBUGGER']) && $_SESSION['PMDEBUGGER'] && $debuggerAvailable) {
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
$loc = 'cases_Step?' . 'breakpoint=triggerdebug';
} else {
@@ -275,26 +274,26 @@ try {
//Triggers After
$isIE = Bootstrap::isIE();
if (isset( $_SESSION['TRIGGER_DEBUG']['ISSET'] ) && !$isIE) {
if (isset($_SESSION['TRIGGER_DEBUG']['ISSET']) && !$isIE) {
if ($_SESSION['TRIGGER_DEBUG']['ISSET'] == 1) {
$oTemplatePower = new TemplatePower( PATH_TPL . 'cases/cases_Step.html' );
$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step.html');
$oTemplatePower->prepare();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'template', '', '', '', $oTemplatePower );
$G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
$_POST['NextStep'] = $loc;
$G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameLoader' );
$G_PUBLISH->AddContent( 'view', 'cases/showDebugFrameBreaker' );
$G_PUBLISH->AddContent('view', 'cases/showDebugFrameLoader');
$G_PUBLISH->AddContent('view', 'cases/showDebugFrameBreaker');
$_SESSION['TRIGGER_DEBUG']['ISSET'] == 0;
G::RenderPage( 'publish', 'blank' );
G::RenderPage('publish', 'blank');
exit();
} else {
unset( $_SESSION['TRIGGER_DEBUG'] );
unset($_SESSION['TRIGGER_DEBUG']);
}
}
//close tab only if IE11
if($isIE && !isset($_SESSION['__OUTLOOK_CONNECTOR__'])) {
if ($isIE && !isset($_SESSION['__OUTLOOK_CONNECTOR__'])) {
$script = "<script type='text/javascript'>
try {
if(top.opener) {
@@ -307,11 +306,11 @@ try {
die($script);
}
G::header( "location: $loc" );
G::header("location: $loc");
} catch (Exception $e) {
$aMessage = array ();
$aMessage = [];
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish', 'blank' );
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
G::RenderPage('publish', 'blank');
}

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);
}
}