HOR-1019 "Add option to force the ABE user to login..." SOLVED
Issue:
Add option to force the ABE user to login in ProcessMaker before executing Action
Cause:
Nuevo requerimiento
Solution:
Se implemento la opcion "Force user login" (Back-end y Front-end)
This commit is contained in:
@@ -260,7 +260,7 @@ try {
|
||||
$_SESSION['USR_PASSWORD'] = $pwd;
|
||||
|
||||
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']), false);
|
||||
|
||||
$_SESSION['URL'] = (isset($_POST['form']['URL']))? $_POST['form']['URL'] : ((isset($_REQUEST['u']))? $_REQUEST['u'] : '');
|
||||
$_SESSION['USER_LANG'] = $lang;
|
||||
|
||||
if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) {
|
||||
|
||||
144
workflow/engine/methods/login/authenticationSso.php
Normal file
144
workflow/engine/methods/login/authenticationSso.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
global $G_PUBLISH;
|
||||
|
||||
try {
|
||||
if ($RBAC->singleSignOn) {
|
||||
$_SESSION['__USER_LOGGED_SSO__'] = $RBAC->userObj->fields['USR_UID'];
|
||||
$_SESSION['__USR_USERNAME_SSO__'] = $RBAC->userObj->fields['USR_USERNAME'];
|
||||
} else {
|
||||
if (!isset($_SESSION['__USER_LOGGED_SSO__'])) {
|
||||
$u = '';
|
||||
|
||||
if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') {
|
||||
$u = $_POST['form']['URL'];
|
||||
} else {
|
||||
if (isset($_GET['u']) && $_GET['u'] != '') {
|
||||
$u = $_GET['u'];
|
||||
}
|
||||
}
|
||||
|
||||
header(
|
||||
'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN .
|
||||
'/login/login' . (($u != '')? '?u=' . $u : '')
|
||||
);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
$userUid = (isset($_SESSION['USER_LOGGED']))? $_SESSION['USER_LOGGED'] : ((isset($_SESSION['__USER_LOGGED_SSO__']))? $_SESSION['__USER_LOGGED_SSO__'] : '');
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||
//Update User Time Zone
|
||||
if (isset($_POST['form']['BROWSER_TIME_ZONE'])) {
|
||||
$user = new Users();
|
||||
$user->update(['USR_UID' => $userUid, 'USR_TIME_ZONE' => $_POST['form']['BROWSER_TIME_ZONE']]);
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
|
||||
//Set User Time Zone
|
||||
$user = UsersPeer::retrieveByPK($userUid);
|
||||
|
||||
if (!is_null($user)) {
|
||||
$userTimeZone = $user->getUsrTimeZone();
|
||||
|
||||
if (trim($userTimeZone) == '') {
|
||||
$userTimeZone = $arraySystemConfiguration['time_zone'];
|
||||
}
|
||||
|
||||
$_SESSION['USR_TIME_ZONE'] = $userTimeZone;
|
||||
}
|
||||
|
||||
//Get default user location
|
||||
if (isset($_POST['form']['URL']) && $_POST['form']['URL'] != '') {
|
||||
$location = $_POST['form']['URL'];
|
||||
} else {
|
||||
if (isset($_GET['u']) && $_GET['u'] != '') {
|
||||
$location = $_GET['u'];
|
||||
} else {
|
||||
$userProperty = new UsersProperties();
|
||||
|
||||
$location = $userProperty->redirectTo($userUid);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||
if ((int)($arraySystemConfiguration['system_utc_time_zone'])) {
|
||||
$dateTime = new \ProcessMaker\Util\DateTime();
|
||||
|
||||
$timeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($_SESSION['USR_TIME_ZONE']);
|
||||
$browserTimeZoneOffset = 0;
|
||||
|
||||
if (isset($_POST['form']['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
$browserTimeZoneOffset = (int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET']);
|
||||
} else {
|
||||
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
$browserTimeZoneOffset = (int)($_GET['BROWSER_TIME_ZONE_OFFSET']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($timeZoneOffset === false || $timeZoneOffset != $browserTimeZoneOffset) {
|
||||
$userUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($timeZoneOffset);
|
||||
$browserUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($browserTimeZoneOffset);
|
||||
|
||||
$arrayTimeZoneId = $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset);
|
||||
|
||||
array_unshift($arrayTimeZoneId, 'false');
|
||||
array_walk(
|
||||
$arrayTimeZoneId,
|
||||
function (&$value, $key, $parameter)
|
||||
{
|
||||
$value = ['TZ_UID' => $value, 'TZ_NAME' => '(UTC ' . $parameter . ') ' . $value];
|
||||
},
|
||||
$browserUtcOffset
|
||||
);
|
||||
|
||||
$_SESSION['_DBArray'] = ['TIME_ZONE' => $arrayTimeZoneId];
|
||||
|
||||
$arrayData = [
|
||||
'USR_USERNAME' => '',
|
||||
'USR_PASSWORD' => '',
|
||||
'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $_SESSION['USR_TIME_ZONE'],
|
||||
'BROWSER_TIME_ZONE' => $dateTime->getTimeZoneIdByTimeZoneOffset($browserTimeZoneOffset, false),
|
||||
'USER_LANG' => SYS_LANG,
|
||||
'URL' => $location
|
||||
];
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent(
|
||||
'xmlform',
|
||||
'xmlform',
|
||||
'login' . PATH_SEP . 'TimeZoneAlert',
|
||||
'',
|
||||
$arrayData, SYS_URI . 'login/authenticationSso.php'
|
||||
);
|
||||
|
||||
G::RenderPage('publish');
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
setcookie('singleSignOn', '1', time() + (24 * 60 * 60), '/');
|
||||
|
||||
$_SESSION['USER_LOGGED'] = $_SESSION['__USER_LOGGED_SSO__'];
|
||||
$_SESSION['USR_USERNAME'] = $_SESSION['__USR_USERNAME_SSO__'];
|
||||
|
||||
unset($_SESSION['__USER_LOGGED_SSO__'], $_SESSION['__USR_USERNAME_SSO__']);
|
||||
|
||||
G::header('Location: ' . $location);
|
||||
} catch (Exception $e) {
|
||||
$arrayData = [];
|
||||
$arrayData['MESSAGE'] = $e->getMessage();
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $arrayData);
|
||||
|
||||
G::RenderPage('publish');
|
||||
}
|
||||
@@ -148,6 +148,8 @@ if (isset($_SESSION['__TIME_ZONE_FAILED__']) && $_SESSION['__TIME_ZONE_FAILED__'
|
||||
$userPassword = $_SESSION['USR_PASSWORD'];
|
||||
$userTimeZone = $_SESSION['USR_TIME_ZONE'];
|
||||
$browserTimeZone = $_SESSION['BROWSER_TIME_ZONE'];
|
||||
$url = $_SESSION['URL'];
|
||||
|
||||
if(isset($_SESSION['USER_LANG'])){
|
||||
$lang = $_SESSION['USER_LANG'];
|
||||
}else{
|
||||
@@ -220,7 +222,8 @@ if ($timeZoneFailed) {
|
||||
'USR_PASSWORD' => $userPassword,
|
||||
'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $userTimeZone,
|
||||
'BROWSER_TIME_ZONE' => $browserTimeZone,
|
||||
'USER_LANG' => $lang
|
||||
'USER_LANG' => $lang,
|
||||
'URL' => $url
|
||||
];
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
@@ -1,121 +1,151 @@
|
||||
<?php
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
// since all the request parameters using this script are encrypted
|
||||
// using the URL_KEY the probability of injecting any kind of code using
|
||||
// this entry point are only possible knowing the aforementioned key.
|
||||
switch (G::decrypt(urldecode(utf8_encode($_REQUEST['ACTION'])), URL_KEY)) {
|
||||
case 'processABE' :
|
||||
$G_PUBLISH = new Publisher();
|
||||
try {
|
||||
// Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
}
|
||||
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
// since all the request parameters using this script are encrypted
|
||||
// using the URL_KEY the probability of injecting any kind of code using
|
||||
// this entry point are only possible knowing the aforementioned key.
|
||||
switch (G::decrypt(urldecode(utf8_encode($_REQUEST['ACTION'])), URL_KEY)) {
|
||||
case 'processABE' :
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
try {
|
||||
G::LoadClass('case');
|
||||
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
$_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY);
|
||||
$_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY);
|
||||
$_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY);
|
||||
$_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY);
|
||||
$_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY);
|
||||
|
||||
G::LoadClass('case');
|
||||
|
||||
$cases = new Cases();
|
||||
$caseFieldsABE = $cases->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
|
||||
if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) {
|
||||
$dataField = array();
|
||||
$dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE'];
|
||||
$caseFieldsABE ['APP_DATA'] = array_merge($caseFieldsABE ['APP_DATA'], $dataField);
|
||||
|
||||
$dataResponses = array();
|
||||
$dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER'];
|
||||
$dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR'];
|
||||
$dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']);
|
||||
$dataResponses['ABE_RES_STATUS'] = 'PENDING';
|
||||
$dataResponses['ABE_RES_MESSAGE'] = '';
|
||||
|
||||
try {
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
//Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
}
|
||||
|
||||
$cases->updateCase($_REQUEST['APP_UID'], $caseFieldsABE);
|
||||
|
||||
G::LoadClass('wsBase');
|
||||
|
||||
$ws = new wsBase();
|
||||
|
||||
$result = $ws->derivateCase($caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true);
|
||||
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
|
||||
|
||||
if ($code != 0) {
|
||||
throw new Exception('An error occurred while the application was being processed.<br /><br />
|
||||
Error code: ' . $result->status_code . '<br />
|
||||
Error message: ' . $result->message . '<br /><br />');
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
|
||||
// Update
|
||||
$dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR');
|
||||
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message);
|
||||
|
||||
try {
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
$message = '<strong>The answer has been submited. Thank you</strong>';
|
||||
|
||||
//Save Cases Notes
|
||||
G::LoadClass('actionsByEmailUtils');
|
||||
|
||||
$dataAbeRequests = loadAbeRequest($_REQUEST['ABER']);
|
||||
$dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']);
|
||||
|
||||
if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) {
|
||||
$response = new stdclass();
|
||||
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
|
||||
$response->appUid = $_REQUEST['APP_UID'];
|
||||
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
|
||||
|
||||
postNote($response);
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
$dataAbeRequests['ABE_REQ_ANSWERED'] = 1;
|
||||
$code == 0 ? uploadAbeRequest($dataAbeRequests) : '';
|
||||
} else {
|
||||
$message = '<strong>The response has already been sent.</strong>';
|
||||
$_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY);
|
||||
$_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY);
|
||||
$_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY);
|
||||
$_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY);
|
||||
$_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY);
|
||||
|
||||
$case = new Cases();
|
||||
$actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
|
||||
$actionsByEmail->verifyLogin($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
|
||||
$caseFieldsABE = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
|
||||
if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) {
|
||||
$dataField = [];
|
||||
$dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE'];
|
||||
$caseFieldsABE ['APP_DATA'] = array_merge($caseFieldsABE ['APP_DATA'], $dataField);
|
||||
|
||||
$dataResponses = [];
|
||||
$dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER'];
|
||||
$dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR'];
|
||||
$dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']);
|
||||
$dataResponses['ABE_RES_STATUS'] = 'PENDING';
|
||||
$dataResponses['ABE_RES_MESSAGE'] = '';
|
||||
|
||||
try {
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$case->updateCase($_REQUEST['APP_UID'], $caseFieldsABE);
|
||||
|
||||
G::LoadClass('wsBase');
|
||||
|
||||
$ws = new wsBase();
|
||||
|
||||
$result = $ws->derivateCase(
|
||||
$caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true
|
||||
);
|
||||
|
||||
$code = (is_array($result))? $result['status_code'] : $result->status_code;
|
||||
|
||||
if ($code != 0) {
|
||||
throw new Exception(
|
||||
'An error occurred while the application was being processed.<br /><br />
|
||||
Error code: ' . $result->status_code . '<br />
|
||||
Error message: ' . $result->message . '<br /><br />'
|
||||
);
|
||||
}
|
||||
|
||||
//Update
|
||||
$dataResponses['ABE_RES_STATUS'] = ($code == 0)? 'SENT' : 'ERROR';
|
||||
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0)? '-' : $result->message;
|
||||
|
||||
try {
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$message = '<strong>The answer has been submited. Thank you</strong>';
|
||||
|
||||
//Save Cases Notes
|
||||
G::LoadClass('actionsByEmailUtils');
|
||||
|
||||
$dataAbeRequests = loadAbeRequest($_REQUEST['ABER']);
|
||||
$dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']);
|
||||
|
||||
if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) {
|
||||
$response = new stdClass();
|
||||
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
|
||||
$response->appUid = $_REQUEST['APP_UID'];
|
||||
$response->noteText = 'Check the information that was sent for the receiver: ' .
|
||||
$dataAbeRequests['ABE_REQ_SENT_TO'];
|
||||
|
||||
postNote($response);
|
||||
}
|
||||
|
||||
$dataAbeRequests['ABE_REQ_ANSWERED'] = 1;
|
||||
$code == 0 ? uploadAbeRequest($dataAbeRequests) : '';
|
||||
} else {
|
||||
$message = '<strong>The response has already been sent.</strong>';
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message));
|
||||
} catch (Exception $e) {
|
||||
$G_PUBLISH->AddContent(
|
||||
'xmlform',
|
||||
'xmlform',
|
||||
'login/showMessage',
|
||||
'',
|
||||
['MESSAGE' => $e->getMessage() . 'Please contact to your system administrator.']
|
||||
);
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message));
|
||||
} catch (Exception $error) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage() . 'Please contact to your system administrator.'));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
|
||||
break;
|
||||
G::RenderPage('publish', 'blank');
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript" src="/js/maborak/core/maborak.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
location.assign(location.href + "&BROWSER_TIME_ZONE_OFFSET=" + getBrowserTimeZoneOffset());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
@@ -1,63 +1,93 @@
|
||||
<?php
|
||||
if (isset($_GET['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
global $G_PUBLISH;
|
||||
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
try {
|
||||
// Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
try {
|
||||
G::LoadClass('case');
|
||||
G::LoadClass('pmDynaform');
|
||||
|
||||
//Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
$case = new Cases();
|
||||
$actionsByEmail = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
|
||||
$applicationUid = G::decrypt($_REQUEST['APP_UID'], URL_KEY);
|
||||
$delIndex = G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY);
|
||||
|
||||
$actionsByEmail->verifyLogin($applicationUid, $delIndex);
|
||||
|
||||
$caseFields = $case->loadCase($applicationUid, $delIndex);
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$criteria->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$criteria->add(DynaformPeer::DYN_UID, G::decrypt($_REQUEST['DYN_UID'], URL_KEY));
|
||||
$result = DynaformPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$configuration = $result->getRow();
|
||||
|
||||
$action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' .
|
||||
$_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER'];
|
||||
|
||||
$record = [];
|
||||
$record['DYN_CONTENT'] = $configuration['DYN_CONTENT'];
|
||||
$record['PRO_UID'] = $configuration['PRO_UID'];
|
||||
$record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY);
|
||||
$record['APP_UID'] = $_REQUEST['APP_UID'];
|
||||
$record['DEL_INDEX'] = $_REQUEST['DEL_INDEX'];
|
||||
$record['ABER'] = $_REQUEST['ABER'];
|
||||
$record['APP_DATA'] = $caseFields['APP_DATA'];
|
||||
|
||||
if (is_null($caseFields['DEL_FINISH_DATE'])) {
|
||||
$a = new pmDynaform($record);
|
||||
|
||||
$a->printABE($action,$record);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent(
|
||||
'xmlform',
|
||||
'xmlform',
|
||||
'login/showInfo',
|
||||
'',
|
||||
['MESSAGE' => '<strong>The form has already been filled and sent.</strong>']
|
||||
);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', ['MESSAGE' => $e->getMessage()]);
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
G::LoadClass('case');
|
||||
G::LoadClass('pmDynaform');
|
||||
|
||||
$cases = new Cases();
|
||||
$caseFields = $cases->loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY));
|
||||
|
||||
//
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$criteria->addSelectColumn(DynaformPeer::PRO_UID);
|
||||
$criteria->add(DynaformPeer::DYN_UID, G::decrypt($_REQUEST['DYN_UID'], URL_KEY));
|
||||
$result = DynaformPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$configuration = $result->getRow();
|
||||
|
||||
$action = 'ActionsByEmailDataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER'];
|
||||
$record['DYN_CONTENT'] = $configuration['DYN_CONTENT'];
|
||||
$record['PRO_UID'] = $configuration['PRO_UID'];
|
||||
$record['CURRENT_DYNAFORM'] = G::decrypt($_REQUEST['DYN_UID'], URL_KEY);
|
||||
$record['APP_UID'] = $_REQUEST['APP_UID'];
|
||||
$record['DEL_INDEX'] = $_REQUEST['DEL_INDEX'];
|
||||
$record['ABER'] = $_REQUEST['ABER'];
|
||||
$record['APP_DATA'] = $caseFields['APP_DATA'];
|
||||
if (is_null($caseFields['DEL_FINISH_DATE'])) {
|
||||
$a = new pmDynaform($record);
|
||||
$a->printABE($action,$record);
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => '<strong>The form has already been filled and sent.</strong>'));
|
||||
}
|
||||
} catch (Exception $error) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $error->getMessage()));
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
} else {
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<script type="text/javascript" src="/js/maborak/core/maborak.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
location.assign(location.href + "&BROWSER_TIME_ZONE_OFFSET=" + getBrowserTimeZoneOffset());
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user