HOR-4484
This commit is contained in:
@@ -1438,88 +1438,96 @@ function checkTree($uidOriginFolder, $uidNewFolder)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload documents
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function uploadExternalDocument()
|
||||
{
|
||||
$response['action']=$_POST['action']. " - ".$_POST['option'];
|
||||
$response['error']="error";
|
||||
$response['message']="error";
|
||||
$response['success']=false;
|
||||
$response = [];
|
||||
$response['action'] = $_POST['action'] . " - " . $_POST['option'];
|
||||
$response['error'] = "error";
|
||||
$response['message'] = "error";
|
||||
$response['success'] = false;
|
||||
$overwrite = (isset($_REQUEST['overwrite_files'])) ? $_REQUEST['overwrite_files'] : false;
|
||||
if (isset($_POST["confirm"]) && $_POST["confirm"] == "true") {
|
||||
if (isset($_FILES['uploadedFile'])) {
|
||||
$uploadedInstances=count($_FILES['uploadedFile']['name']);
|
||||
$sw_error=false;
|
||||
$sw_error_exists=isset($_FILES['uploadedFile']['error']);
|
||||
$emptyInstances=0;
|
||||
$quequeUpload=array();
|
||||
$uploadedInstances = count($_FILES['uploadedFile']['name']);
|
||||
$sw_error = false;
|
||||
$sw_error_exists = isset($_FILES['uploadedFile']['error']);
|
||||
$emptyInstances = 0;
|
||||
$quequeUpload = [];
|
||||
//overwrite files
|
||||
if ($overwrite) {
|
||||
for ($i=0; $i<$uploadedInstances; $i++) {
|
||||
for ($i = 0; $i < $uploadedInstances; $i++) {
|
||||
overwriteFile($_REQUEST['dir'], stripslashes($_FILES['uploadedFile']['name'][$i]));
|
||||
}
|
||||
}
|
||||
// upload files & check for errors
|
||||
for ($i=0; $i<$uploadedInstances; $i++) {
|
||||
$errors = [];
|
||||
for ($i = 0; $i < $uploadedInstances; $i++) {
|
||||
$errors[$i] = null;
|
||||
$tmp = $_FILES['uploadedFile']['tmp_name'][$i];
|
||||
$items[$i] = stripslashes($_FILES['uploadedFile']['name'][$i]);
|
||||
if ($sw_error_exists) {
|
||||
$up_err = $_FILES['uploadedFile']['error'][$i];
|
||||
} else {
|
||||
$up_err=(file_exists($tmp)?0:4);
|
||||
$up_err = (file_exists($tmp) ? 0 : 4);
|
||||
}
|
||||
if ($items[$i]=="" || $up_err==4) {
|
||||
if ($items[$i] == "" || $up_err == 4) {
|
||||
$emptyInstances++;
|
||||
continue;
|
||||
}
|
||||
if ($up_err==1 || $up_err==2) {
|
||||
$errors[$i]='miscfilesize';
|
||||
if ($up_err == 1 || $up_err == 2) {
|
||||
$errors[$i] = 'miscfilesize';
|
||||
$sw_error = true;
|
||||
continue;
|
||||
}
|
||||
if ($up_err==3) {
|
||||
$errors[$i]='miscfilepart';
|
||||
$sw_error=true;
|
||||
if ($up_err == 3) {
|
||||
$errors[$i] = 'miscfilepart';
|
||||
$sw_error = true;
|
||||
continue;
|
||||
}
|
||||
if (!@is_uploaded_file($tmp)) {
|
||||
$errors[$i]='uploadfile';
|
||||
$sw_error=true;
|
||||
$errors[$i] = 'uploadfile';
|
||||
$sw_error = true;
|
||||
continue;
|
||||
}
|
||||
//The uplaoded files seems to be correct and ready to be uploaded. Add to the Queque
|
||||
$fileInfo=array("tempName"=>$tmp,"fileName"=>$items[$i]);
|
||||
$quequeUpload[]=$fileInfo;
|
||||
$fileInfo = ["tempName" => $tmp, "fileName" => $items[$i]];
|
||||
$quequeUpload[] = $fileInfo;
|
||||
}
|
||||
} elseif (isset($_POST['selitems'])) {
|
||||
$response="";
|
||||
$response['msg']= "correct reload";
|
||||
$response['success']=true;
|
||||
$response['msg'] = "correct reload";
|
||||
$response['success'] = true;
|
||||
if (isset($_REQUEST['option']) && isset($_REQUEST['copyMove'])) {
|
||||
if ($_REQUEST['option'] == 'directory' && $_REQUEST['copyMove'] == 'all') {
|
||||
$response['action'] = $_POST['action']. " - ".$_POST['option'];
|
||||
$response['error'] = "Complete";
|
||||
$response['message']= str_replace("Execute", "", $_POST['action']). " ". "Complete";
|
||||
$response['success']= 'success';
|
||||
$response['node'] = '';
|
||||
$_POST ['node'] = "";
|
||||
$newFolderUid = checkTree($_REQUEST['dir'], ($_REQUEST['new_dir'] == 'root')? '/' : $_REQUEST['new_dir']);
|
||||
$response['action'] = $_POST['action'] . " - " . $_POST['option'];
|
||||
$response['error'] = "Complete";
|
||||
$response['message'] = str_replace("Execute", "", $_POST['action']) . " " . "Complete";
|
||||
$response['success'] = 'success';
|
||||
$response['node'] = '';
|
||||
$_POST ['node'] = "";
|
||||
$newFolderUid = checkTree(
|
||||
$_REQUEST['dir'],
|
||||
($_REQUEST['new_dir'] == 'root') ? '/' : $_REQUEST['new_dir']
|
||||
);
|
||||
}
|
||||
$_POST['selitems'] = array();
|
||||
$_POST['selitems'] = [];
|
||||
} else {
|
||||
$oAppDocument = new AppDocument();
|
||||
$appDocument = new AppDocument();
|
||||
if (isset($_POST['selitems']) && is_array($_POST['selitems'])) {
|
||||
foreach ($_POST['selitems'] as $docId) {
|
||||
$arrayDocId = explode('_', $docId);
|
||||
$docInfo=$oAppDocument->load($arrayDocId[0]);
|
||||
$docInfo['FOLDER_UID'] = $_POST['new_dir'];
|
||||
$docInfo = $appDocument->load($arrayDocId[0]);
|
||||
$docInfo['FOLDER_UID'] = $_POST['new_dir'];
|
||||
$docInfo['APP_DOC_CREATE_DATE'] = date('Y-m-d H:i:s');
|
||||
$oAppDocument->update($docInfo);
|
||||
$appDocument->update($docInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//G::pr($quequeUpload);
|
||||
|
||||
//Read. Instance Document classes
|
||||
if (!empty($quequeUpload)) {
|
||||
@@ -1535,148 +1543,144 @@ function uploadExternalDocument()
|
||||
exit();
|
||||
}
|
||||
}
|
||||
$docUid=$_POST['docUid'];
|
||||
$appDocUid=isset($_POST['APP_DOC_UID'])?$_POST['APP_DOC_UID']:"";
|
||||
$docVersion=isset($_POST['docVersion'])?$_POST['docVersion']:"";
|
||||
$actionType=isset($_POST['actionType'])?$_POST['actionType']:"";
|
||||
$folderId=$_POST['dir']==""?"/":$_POST['dir'];
|
||||
$appId=$_POST['appId'];
|
||||
$docType=isset($_POST['docType'])?$_GET['docType']:"INPUT";
|
||||
$docUid = $_POST['docUid'];
|
||||
$appDocUid = isset($_POST['APP_DOC_UID']) ? $_POST['APP_DOC_UID'] : "";
|
||||
$docVersion = isset($_POST['docVersion']) ? $_POST['docVersion'] : "";
|
||||
$actionType = isset($_POST['actionType']) ? $_POST['actionType'] : "";
|
||||
$folderId = $_POST['dir'] == "" ? "/" : $_POST['dir'];
|
||||
$appId = $_POST['appId'];
|
||||
$docType = isset($_POST['docType']) ? $_GET['docType'] : "INPUT";
|
||||
//save info
|
||||
|
||||
$oInputDocument = new InputDocument();
|
||||
$inputDocument = new InputDocument();
|
||||
if ($docUid != -1) {
|
||||
$aID = $oInputDocument->load($docUid);
|
||||
$aID = $inputDocument->load($docUid);
|
||||
} else {
|
||||
$oFolder=new AppFolder();
|
||||
$folderStructure=$oFolder->getFolderStructure($folderId);
|
||||
$aID=array('INP_DOC_DESTINATION_PATH'=>$folderStructure['PATH']);
|
||||
$folder = new AppFolder();
|
||||
$folderStructure = $folder->getFolderStructure($folderId);
|
||||
$aID = ['INP_DOC_DESTINATION_PATH' => $folderStructure['PATH']];
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Get the Custom Folder ID (create if necessary)
|
||||
$oFolder=new AppFolder();
|
||||
if ($docUid!=-1) {
|
||||
//krumo("jhl");
|
||||
$folderId=$oFolder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId);
|
||||
$folder = new AppFolder();
|
||||
if ($docUid != -1) {
|
||||
$folderId = $folder->createFromPath($aID['INP_DOC_DESTINATION_PATH'], $appId);
|
||||
//Tags
|
||||
$fileTags=$oFolder->parseTags($aID['INP_DOC_TAGS'], $appId);
|
||||
$fileTags = $folder->parseTags($aID['INP_DOC_TAGS'], $appId);
|
||||
} else {
|
||||
$folderId=$folderId;
|
||||
$fileTags="EXTERNAL";
|
||||
$folderId = $folderId;
|
||||
$fileTags = "EXTERNAL";
|
||||
}
|
||||
foreach ($quequeUpload as $key => $fileObj) {
|
||||
$oAppDocument = new AppDocument();
|
||||
$appDocument = new AppDocument();
|
||||
switch ($actionType) {
|
||||
case "R":
|
||||
//replace
|
||||
$aFields = array(
|
||||
'APP_DOC_UID' => $appDocUid,
|
||||
'APP_UID' => $appId,
|
||||
'DOC_VERSION' => $docVersion,
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$fields = [
|
||||
'APP_DOC_UID' => $appDocUid,
|
||||
'APP_UID' => $appId,
|
||||
'DOC_VERSION' => $docVersion,
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$_POST['form']['APP_DOC_COMMENT'] : '',
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
$oAppDocument->update($aFields);
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
];
|
||||
$appDocument->update($fields);
|
||||
break;
|
||||
case "NV":
|
||||
//New Version
|
||||
$aFields = array(
|
||||
'APP_DOC_UID' => $appDocUid,
|
||||
'APP_UID' => $appId,
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$fields = [
|
||||
'APP_DOC_UID' => $appDocUid,
|
||||
'APP_UID' => $appId,
|
||||
'DEL_INDEX' => 1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$_POST['form']['APP_DOC_COMMENT'] : '',
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
$oAppDocument->create($aFields);
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
];
|
||||
$appDocument->create($fields);
|
||||
break;
|
||||
default:
|
||||
//New
|
||||
$aFields = array(
|
||||
'APP_UID' => $appId,
|
||||
'DEL_INDEX' => isset($_SESSION['INDEX'])?$_SESSION['INDEX']:1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$fields = [
|
||||
'APP_UID' => $appId,
|
||||
'DEL_INDEX' => isset($_SESSION['INDEX']) ? $_SESSION['INDEX'] : 1,
|
||||
'USR_UID' => $_SESSION['USER_LOGGED'],
|
||||
'DOC_UID' => $docUid,
|
||||
'APP_DOC_TYPE' => $docType,
|
||||
'APP_DOC_CREATE_DATE' => date('Y-m-d H:i:s'),
|
||||
'APP_DOC_COMMENT' => isset($_POST['form']['APP_DOC_COMMENT']) ?
|
||||
$_POST['form']['APP_DOC_COMMENT'] : '',
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
$oAppDocument->create($aFields);
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $fileObj['fileName'],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
];
|
||||
$appDocument->create($fields);
|
||||
break;
|
||||
}
|
||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
$iDocVersion = $oAppDocument->getDocVersion();
|
||||
$appDocUid = $appDocument->getAppDocUid();
|
||||
$docVersion = $appDocument->getDocVersion();
|
||||
|
||||
$info = pathinfo($oAppDocument->getAppDocFilename());
|
||||
$info = pathinfo($appDocument->getAppDocFilename());
|
||||
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
||||
//save the file
|
||||
//if (!empty($_FILES['form'])) {
|
||||
//if ($_FILES['form']['error']['APP_DOC_FILENAME'] == 0) {
|
||||
$sPathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
|
||||
$file = G::getPathFromFileUID($appId, $sAppDocUid);
|
||||
$sPathName .= $file[0];
|
||||
$sFileName = $file[1] . "_" . $iDocVersion . '.' . $ext;
|
||||
$pathName = PATH_DOCUMENT . G::getPathFromUID($appId) . PATH_SEP;
|
||||
$file = G::getPathFromFileUID($appId, $appDocUid);
|
||||
$pathName .= $file[0];
|
||||
$sFileName = $file[1] . "_" . $docVersion . '.' . $ext;
|
||||
|
||||
G::uploadFile($fileObj['tempName'], $sPathName, $sFileName); //upload
|
||||
G::uploadFile($fileObj['tempName'], $pathName, $sFileName); //upload
|
||||
|
||||
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
if ($oPluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
|
||||
$oData['APP_UID'] = $appId;
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
if ($pluginRegistry->existsTrigger(PM_UPLOAD_DOCUMENT) && class_exists('uploadDocumentData')) {
|
||||
$oData['APP_UID'] = $appId;
|
||||
$documentData = new uploadDocumentData(
|
||||
$appId,
|
||||
$_SESSION['USER_LOGGED'],
|
||||
$sPathName . $sFileName,
|
||||
$pathName . $sFileName,
|
||||
$fileObj['fileName'],
|
||||
$sAppDocUid
|
||||
$appDocUid
|
||||
);
|
||||
//$oPluginRegistry->executeTriggers (PM_UPLOAD_DOCUMENT , $documentData);
|
||||
//unlink ($sPathName . $sFileName);
|
||||
}
|
||||
//end plugin
|
||||
if ($sw_error) {
|
||||
// there were errors
|
||||
$err_msg="";
|
||||
for ($i=0; $i<$uploadedInstances; $i++) {
|
||||
if ($errors[$i]==null) {
|
||||
$err_msg = "";
|
||||
for ($i = 0; $i < $uploadedInstances; $i++) {
|
||||
if ($errors[$i] == null) {
|
||||
continue;
|
||||
}
|
||||
$err_msg .= $items[$i]." : ".$errors[$i]."\n";
|
||||
$err_msg .= $items[$i] . " : " . $errors[$i] . "\n";
|
||||
}
|
||||
$response['error']=$err_msg;
|
||||
$response['message']=$err_msg;
|
||||
$response['success']=false;
|
||||
} elseif ($emptyInstances==$uploadedInstances) {
|
||||
$response['error']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
|
||||
$response['message']= G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
|
||||
$response['success']=false;
|
||||
$response['error'] = $err_msg;
|
||||
$response['message'] = $err_msg;
|
||||
$response['success'] = false;
|
||||
} elseif ($emptyInstances == $uploadedInstances) {
|
||||
$response['error'] = G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
|
||||
$response['message'] = G::LoadTranslation('ID_UPLOAD_LEAST_FILE');
|
||||
$response['success'] = false;
|
||||
} else {
|
||||
$response['error']= G::LoadTranslation('ID_UPLOAD_COMPLETE');
|
||||
$response['message']="Upload complete";
|
||||
$response['success']=true;
|
||||
$response['error'] = G::LoadTranslation('ID_UPLOAD_COMPLETE');
|
||||
$response['message'] = "Upload complete";
|
||||
$response['success'] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,35 +25,38 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == "verifySession") {
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
} else {
|
||||
//When the user has session we will to validate the permissions over other actions
|
||||
/** Action: Reassign from openCase */
|
||||
global $RBAC;
|
||||
$proUid = $_SESSION['PROCESS'];
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
$tasUid = $_SESSION['TASK'];
|
||||
$proUid = isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '';
|
||||
$appUid = isset($_SESSION['APPLICATION']) ? $_SESSION['APPLICATION'] : '';
|
||||
$tasUid = isset($_SESSION['TASK']) ? $_SESSION['TASK'] : '';
|
||||
|
||||
$response = new stdclass();
|
||||
$cases = new BmCases();
|
||||
$userAuthorization = $cases->userAuthorization(
|
||||
$RBAC->aUserInfo['USER_INFO']['USR_UID'],
|
||||
$proUid,
|
||||
$appUid,
|
||||
['PM_REASSIGNCASE', 'PM_REASSIGNCASE_SUPERVISOR'],
|
||||
['REASSIGN_MY_CASES' => ''],
|
||||
true,
|
||||
$tasUid
|
||||
);
|
||||
$userAuthorization = [];
|
||||
if (!empty($proUid) && !empty($appUid)) {
|
||||
$cases = new BmCases();
|
||||
$userAuthorization = $cases->userAuthorization(
|
||||
$RBAC->aUserInfo['USER_INFO']['USR_UID'],
|
||||
$proUid,
|
||||
$appUid,
|
||||
['PM_REASSIGNCASE', 'PM_REASSIGNCASE_SUPERVISOR'],
|
||||
['REASSIGN_MY_CASES' => ''],
|
||||
true,
|
||||
$tasUid
|
||||
);
|
||||
|
||||
if (
|
||||
$userAuthorization['rolesPermissions']['PM_REASSIGNCASE'] ||
|
||||
($userAuthorization['rolesPermissions']['PM_REASSIGNCASE_SUPERVISOR'] && $userAuthorization['supervisor']) ||
|
||||
in_array($appUid, $userAuthorization['objectPermissions']['REASSIGN_MY_CASES'])
|
||||
) {
|
||||
$response->reassigncase = true;
|
||||
$response->message = '';
|
||||
} else {
|
||||
$response->reassigncase = false;
|
||||
$response->message = G::LoadTranslation('ID_NOT_ABLE_REASSIGN');
|
||||
if (
|
||||
$userAuthorization['rolesPermissions']['PM_REASSIGNCASE'] ||
|
||||
($userAuthorization['rolesPermissions']['PM_REASSIGNCASE_SUPERVISOR'] && $userAuthorization['supervisor']) ||
|
||||
in_array($appUid, $userAuthorization['objectPermissions']['REASSIGN_MY_CASES'])
|
||||
) {
|
||||
$response->reassigncase = true;
|
||||
$response->message = '';
|
||||
}
|
||||
}
|
||||
$response->reassigncase = false;
|
||||
$response->message = G::LoadTranslation('ID_NOT_ABLE_REASSIGN');
|
||||
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Cases as ClassesCases;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
|
||||
$actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null;
|
||||
@@ -7,7 +8,10 @@ $actionAjax = isset($_REQUEST['actionAjax']) ? $_REQUEST['actionAjax'] : null;
|
||||
switch ($actionAjax) {
|
||||
case 'historyGridList_JXP':
|
||||
global $G_PUBLISH;
|
||||
$criteria = Cases::getTransferHistoryCriteria($_SESSION['APPLICATION']);
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
$case = new ClassesCases();
|
||||
$fields = $case->loadCase($appUid);
|
||||
$criteria = Cases::getTransferHistoryCriteria($fields['APP_NUMBER']);
|
||||
|
||||
$dataSet = GulliverBasePeer::doSelectRs($criteria);
|
||||
$totalCount = $dataSet->getRecordCount();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* cases_Derivate.php
|
||||
*
|
||||
*/
|
||||
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
G::SendTemporalMessage('ID_LOGIN_AGAIN', 'warning', 'labels');
|
||||
die('<script type="text/javascript">
|
||||
@@ -62,6 +63,27 @@ try {
|
||||
$processUid = isset($_SESSION['PROCESS']) ? $_SESSION['PROCESS'] : '';
|
||||
//load data
|
||||
$oCase = new Cases();
|
||||
// check if a task was already derivated
|
||||
if (isset($_SESSION["APPLICATION"])
|
||||
&& isset($_SESSION["INDEX"])) {
|
||||
$_SESSION['LAST_DERIVATED_APPLICATION'] = isset($_SESSION['LAST_DERIVATED_APPLICATION'])?$_SESSION['LAST_DERIVATED_APPLICATION']:'';
|
||||
$_SESSION['LAST_DERIVATED_INDEX'] = isset($_SESSION['LAST_DERIVATED_INDEX'])?$_SESSION['LAST_DERIVATED_INDEX']:'';
|
||||
if ($_SESSION["APPLICATION"] === $_SESSION['LAST_DERIVATED_APPLICATION']
|
||||
&& $_SESSION["INDEX"] === $_SESSION['LAST_DERIVATED_INDEX']) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', [G::LoadTranslation('ID_REOPEN')]));
|
||||
} else {
|
||||
$appDel = new AppDelegation();
|
||||
if ($appDel->alreadyRouted($_SESSION["APPLICATION"], $_SESSION['INDEX'])) {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', [G::LoadTranslation('ID_REOPEN')]));
|
||||
} else {
|
||||
$_SESSION['LAST_DERIVATED_APPLICATION'] = $_SESSION["APPLICATION"];
|
||||
$_SESSION['LAST_DERIVATED_INDEX'] = $_SESSION["INDEX"];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation('ID_INVALID_APPLICATION_ID_MSG', [G::LoadTranslation('ID_REOPEN')]));
|
||||
}
|
||||
|
||||
//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']);
|
||||
|
||||
@@ -1,26 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* cases_Resume.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.
|
||||
*/
|
||||
|
||||
use ProcessMaker\BusinessModel\Task as BusinessModelTask;
|
||||
|
||||
/* Permissions */
|
||||
switch ($RBAC->userCanAccess('PM_CASES')) {
|
||||
case - 2:
|
||||
@@ -155,14 +136,19 @@ if ($Fields['APP_STATUS'] != 'COMPLETED') {
|
||||
$FieldsPar = $Fields;
|
||||
foreach ($parallel as $row) {
|
||||
$FieldsPar['TAS_UID'] = $row['TAS_UID'];
|
||||
$aTask = $objTask->load($row['TAS_UID']);
|
||||
$FieldsPar['TAS_TITLE'] = $aTask['TAS_TITLE'];
|
||||
$task = $objTask->load($row['TAS_UID']);
|
||||
$FieldsPar['TAS_TITLE'] = $task['TAS_TITLE'];
|
||||
$FieldsPar['USR_UID'] = $row['USR_UID'];
|
||||
if (isset($row['USR_UID']) && !empty($row['USR_UID'])) {
|
||||
$aUser = $objUser->loadDetails($row['USR_UID']);
|
||||
$FieldsPar['CURRENT_USER'] = $aUser['USR_FULLNAME'];
|
||||
$user = $objUser->loadDetails($row['USR_UID']);
|
||||
$FieldsPar['CURRENT_USER'] = $user['USR_FULLNAME'];
|
||||
} else {
|
||||
$FieldsPar['CURRENT_USER'] = '';
|
||||
$dummyTaskTypes = BusinessModelTask::getDummyTypes();
|
||||
if (!in_array($task["TAS_TYPE"], $dummyTaskTypes)) {
|
||||
$FieldsPar['CURRENT_USER'] = G::LoadTranslation('ID_TITLE_UNASSIGNED');
|
||||
} else {
|
||||
$FieldsPar['CURRENT_USER'] = '';
|
||||
}
|
||||
}
|
||||
$FieldsPar['DEL_DELEGATE_DATE'] = $row['DEL_DELEGATE_DATE'];
|
||||
$FieldsPar['DEL_INIT_DATE'] = $row['DEL_INIT_DATE'];
|
||||
|
||||
@@ -133,7 +133,7 @@ if (!$sw_file_exists) {
|
||||
$res['message'] = $info['basename'] . $ver . '.' . $ext;
|
||||
print G::json_encode($res);
|
||||
} else {
|
||||
$nameFile = $info['basename'] . $ver . '.' . $ext;
|
||||
$nameFile = G::inflect($info['basename'] . $ver) . '.' . $ext;
|
||||
$licensedFeatures = PMLicensedFeatures::getSingleton();
|
||||
$downloadStatus = false;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
@@ -158,7 +158,7 @@ if (!$sw_file_exists) {
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (!$downloadStatus) {
|
||||
G::streamFile($realPath, $download, G::inflect($nameFile)); //download
|
||||
G::streamFile($realPath, $download, $nameFile); //download
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* authentication.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.
|
||||
*
|
||||
*/
|
||||
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
@@ -229,16 +206,6 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||
//Update User Time Zone
|
||||
if (isset($_POST['form']['BROWSER_TIME_ZONE'])) {
|
||||
$user = new Users();
|
||||
$user->update(['USR_UID' => $_SESSION['USER_LOGGED'], 'USR_TIME_ZONE' => $_POST['form']['BROWSER_TIME_ZONE']]);
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//Set User Time Zone
|
||||
$user = UsersPeer::retrieveByPK($_SESSION['USER_LOGGED']);
|
||||
|
||||
@@ -263,20 +230,7 @@ try {
|
||||
|
||||
if ($timeZoneOffset === false || $timeZoneOffset != (int)($_POST['form']['BROWSER_TIME_ZONE_OFFSET'])) {
|
||||
$_SESSION['__TIME_ZONE_FAILED__'] = true;
|
||||
$_SESSION['USR_USERNAME'] = $usr;
|
||||
$_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) {
|
||||
$d = serialize(['u' => $usr, 'p' => $pwd, 'm' => '', 'timeZoneFailed' => 1, 'userTimeZone' => $_SESSION['USR_TIME_ZONE'], 'browserTimeZone' => $_SESSION['BROWSER_TIME_ZONE'],'USER_LANG' => $lang]);
|
||||
$urlLogin = $urlLogin . '?d=' . base64_encode($d);
|
||||
}
|
||||
|
||||
G::header('Location: ' . $urlLogin);
|
||||
exit(0);
|
||||
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)$_POST['form']['BROWSER_TIME_ZONE_OFFSET'], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,16 +30,6 @@ try {
|
||||
|
||||
$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('', '', config("system.workspace"));
|
||||
|
||||
//Set User Time Zone
|
||||
@@ -85,43 +75,8 @@ try {
|
||||
}
|
||||
|
||||
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);
|
||||
$_SESSION['__TIME_ZONE_FAILED__'] = true;
|
||||
$_SESSION['BROWSER_TIME_ZONE'] = $dateTime->getTimeZoneIdByTimeZoneOffset((int)$_POST['form']['BROWSER_TIME_ZONE_OFFSET'], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,25 +163,6 @@ if (isset($_SESSION['USER_LOGGED'])) {
|
||||
}
|
||||
//end log
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$timeZoneFailed = false;
|
||||
|
||||
if (isset($_SESSION['__TIME_ZONE_FAILED__']) && $_SESSION['__TIME_ZONE_FAILED__']) {
|
||||
$timeZoneFailed = true;
|
||||
$userUsername = $_SESSION['USR_USERNAME'];
|
||||
$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 {
|
||||
$lang = SYS_LANG;
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//start new session
|
||||
@session_destroy();
|
||||
session_start();
|
||||
@@ -223,39 +204,6 @@ if (in_array(G::encryptOld($licenseManager->result), array('38afd7ae34bd5e3e6fc1
|
||||
die();
|
||||
}
|
||||
|
||||
if ($timeZoneFailed) {
|
||||
$dateTime = new \ProcessMaker\Util\DateTime();
|
||||
|
||||
$userTimeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($userTimeZone);
|
||||
$browserTimeZoneOffset = $dateTime->getTimeZoneOffsetByTimeZoneId($browserTimeZone);
|
||||
|
||||
$userUtcOffset = $dateTime->getUtcOffsetByTimeZoneOffset($userTimeZoneOffset);
|
||||
$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' => $userUsername,
|
||||
'USR_PASSWORD' => $userPassword,
|
||||
'USR_TIME_ZONE' => '(UTC ' . $userUtcOffset . ') ' . $userTimeZone,
|
||||
'BROWSER_TIME_ZONE' => $browserTimeZone,
|
||||
'USER_LANG' => $lang,
|
||||
'URL' => $url
|
||||
];
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login' . PATH_SEP . 'TimeZoneAlert', '', $arrayData, SYS_URI . 'login/authentication.php');
|
||||
|
||||
G::RenderPage('publish');
|
||||
exit(0);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//translation
|
||||
|
||||
@@ -31,10 +31,7 @@ if ($browserSupported==false) {
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (isset($_POST['form']['USER_ENV'])) {
|
||||
@session_destroy();
|
||||
session_start();
|
||||
$_SESSION['sysLogin'] = $_POST['form'];
|
||||
if (isset ($_POST['form']['USER_ENV'])) {
|
||||
$data = base64_encode(serialize($_POST));
|
||||
$url = sprintf('/sys%s/%s/%s/login/sysLoginVerify?d=%s', $_POST['form']['USER_ENV'], SYS_LANG, SYS_SKIN, $data);
|
||||
G::header("location: $url");
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* sysLoginVerify.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 (array_key_exists("d", $_GET)) {
|
||||
$str = base64_decode($_GET["d"]);
|
||||
if (preg_match('/^a:[0-9]+:{/', $str) && !preg_match('/(^|;|{|})O:\+?[0-9]+:"/', $str)) {
|
||||
@@ -34,9 +10,5 @@ if (array_key_exists("d", $_GET)) {
|
||||
if (!isset($_POST)) {
|
||||
G::header('location: /sys/' . $lang . '/' . SYS_SKIN . '/' . 'login/login');
|
||||
}
|
||||
if (isset($_SESSION['sysLogin'])) {
|
||||
$_POST['form'] = $_SESSION['sysLogin'];
|
||||
}
|
||||
|
||||
require_once 'authentication.php';
|
||||
|
||||
|
||||
15
workflow/engine/methods/login/updateTimezone.php
Normal file
15
workflow/engine/methods/login/updateTimezone.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
// Update the selected timezone for the user
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('oq3S29xemxEZXJpZEIzN01qenJUaStSekY4cTdJVm5vbWtVM0d4S2lJSS9qUT0=')) {
|
||||
// Update User Time Zone
|
||||
if (isset($_POST['form']['BROWSER_TIME_ZONE'])) {
|
||||
$user = new Users();
|
||||
$user->update(['USR_UID' => $_SESSION['USER_LOGGED'], 'USR_TIME_ZONE' => $_POST['form']['BROWSER_TIME_ZONE']]);
|
||||
$_SESSION['USR_TIME_ZONE'] = $_POST['form']['BROWSER_TIME_ZONE'];
|
||||
unset($_SESSION['__TIME_ZONE_FAILED__'], $_SESSION['BROWSER_TIME_ZONE']);
|
||||
}
|
||||
|
||||
// Redirect to origin page
|
||||
G::header('Location: ' . $_SERVER['HTTP_REFERER']);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ $G_PUBLISH = new Publisher();
|
||||
if ($noShowTitle == 0) {
|
||||
$G_PUBLISH->AddContent( 'smarty', 'cases/cases_title', '', '', $aFields );
|
||||
}
|
||||
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'tracker/tracker_TransferHistory', Cases::getTransferHistoryCriteria( $_SESSION['APPLICATION'] ), array () );
|
||||
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'tracker/tracker_TransferHistory', Cases::getTransferHistoryCriteria($aFields['APP_NUMBER']), []);
|
||||
|
||||
$bpmn = new ProcessMaker\Project\Bpmn();
|
||||
$flagIsBpmn = ($bpmn->exists($_SESSION["PROCESS"]))? true : false;
|
||||
|
||||
Reference in New Issue
Block a user