Solving conflicts updating with last changes in develop branch

This commit is contained in:
Julio Cesar Laura Avendaño
2020-12-03 20:19:49 +00:00
66 changed files with 3721 additions and 1224 deletions

View File

@@ -6,6 +6,7 @@
* This page define some functions used in the start new case
*
* @link https://wiki.processmaker.com/3.1/Cases#New_Case
* @link https://wiki.processmaker.com/3.2/Web_Entry
*/
use ProcessMaker\Plugins\PluginRegistry;
@@ -179,61 +180,68 @@ function lookinginforContentProcess ($sproUid)
}
function startCase ()
/**
* Start a case and get the next step
*/
function startCase()
{
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_REQUEST = $filter->xssFilterHard($_REQUEST);
/* GET , POST & $_SESSION Vars */
/* unset any variable, because we are starting a new case */
if (isset( $_SESSION['APPLICATION'] )) {
unset( $_SESSION['APPLICATION'] );
// Unset any variable, because we are starting a new case
if (isset($_SESSION['APPLICATION'])) {
unset($_SESSION['APPLICATION']);
}
if (isset( $_SESSION['PROCESS'] )) {
unset( $_SESSION['PROCESS'] );
if (isset($_SESSION['PROCESS'])) {
unset($_SESSION['PROCESS']);
}
if (isset( $_SESSION['TASK'] )) {
unset( $_SESSION['TASK'] );
if (isset($_SESSION['TASK'])) {
unset($_SESSION['TASK']);
}
if (isset( $_SESSION['INDEX'] )) {
unset( $_SESSION['INDEX'] );
if (isset($_SESSION['INDEX'])) {
unset($_SESSION['INDEX']);
}
if (isset( $_SESSION['STEP_POSITION'] )) {
unset( $_SESSION['STEP_POSITION'] );
if (isset($_SESSION['STEP_POSITION'])) {
unset($_SESSION['STEP_POSITION']);
}
/* Process */
try {
$oCase = new Cases();
// Initializing variables
$sequenceType = (!empty($_REQUEST['actionFrom']) && $_REQUEST['actionFrom'] === 'webEntry') ? AppSequence::APP_TYPE_WEB_ENTRY : AppSequence::APP_TYPE_NORMAL;
lookinginforContentProcess( $_POST['processId'] );
// Update CONTENT table
lookinginforContentProcess($_POST['processId']);
$aData = $oCase->startCase( $_REQUEST['taskId'], $_SESSION['USER_LOGGED'] );
$aData = $filter->xssFilterHard($aData);
// Create the new case
$casesInstance = new Cases();
$newCase = $casesInstance->startCase($_REQUEST['taskId'], $_SESSION['USER_LOGGED'], false, [], false, $sequenceType);
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
$_SESSION['INDEX'] = $aData['INDEX'];
$_SESSION['PROCESS'] = $aData['PROCESS'];
// Set session variables
$_SESSION['APPLICATION'] = $newCase['APPLICATION'];
$_SESSION['INDEX'] = $newCase['INDEX'];
$_SESSION['PROCESS'] = $newCase['PROCESS'];
$_SESSION['TASK'] = $_REQUEST['taskId'];
$_SESSION['STEP_POSITION'] = 0;
$_SESSION['CASES_REFRESH'] = true;
$oCase = new Cases();
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
// Get the first step for the new case
$casesInstance = new Cases();
$nextStep = $casesInstance->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'],
$_SESSION['STEP_POSITION']);
$nextStep['PAGE'] = 'open?APP_UID=' . $newCase['APPLICATION'] . '&DEL_INDEX=' . $newCase['INDEX'] . '&action=draft';
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $nextStep;
$aNextStep['PAGE'] = 'open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft';
// Complete required information
$newCase['openCase'] = $nextStep;
$newCase['status'] = 'success';
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
$aData['openCase'] = $aNextStep;
$aData['status'] = 'success';
print (G::json_encode( $aData )) ;
// Print JSON response
print (G::json_encode($newCase));
} catch (Exception $e) {
$aData['status'] = 'failure';
$aData['message'] = $e->getMessage();
print_r( G::json_encode( $aData ) );
$newCase['status'] = 'failure';
$newCase['message'] = $e->getMessage();
print_r(G::json_encode($newCase));
}
}

View File

@@ -1061,6 +1061,9 @@ try {
$tplFile = 'webentry/cases_ScreenDerivation';
$caseId = $currentTask['APP_UID'];
$delIndex = $currentTask['DEL_INDEX'];
// Swap temporary APP_NUMBER
$newAppNumber = $bmWebEntry->swapTemporaryAppNumber($caseId);
$Fields['APP_NUMBER'] = $Fields['APP_DATA']['APP_NUMBER'] = $newAppNumber;
$derivationResponse = PMFDerivateCase($caseId, $delIndex, true);
if ($derivationResponse) {
$webEntryUrl = $bmWebEntry->getCallbackUrlByTask($currentTask['TAS_UID']);

View File

@@ -1,63 +1,63 @@
<?php
/**
* processesList.php
*
* Get an overview information about the all the processes
*
* @link https://wiki.processmaker.com/3.2/Processes
*/
use ProcessMaker\Model\Process;
use ProcessMaker\Util\DateTime;
require_once 'classes/model/Process.php';
$start = isset($_POST['start']) ? $_POST['start'] : 0;
$limit = isset($_POST['limit']) ? $_POST['limit'] : '';
$limit = isset($_POST['limit']) ? $_POST['limit'] : 25;
$dir = isset($_POST['dir']) ? $_POST['dir'] : 'ASC';
$sort = isset($_POST['sort']) ? $_POST['sort'] : '';
$oProcess = new Process();
$oProcess->dir = $dir;
$oProcess->sort = $sort;
$memkey = 'no memcache';
$memcacheUsed = 'not used';
$totalCount = 0;
if (isset($_POST['category']) && $_POST['category'] !== '<reset>') {
if (isset($_POST['processName'])) {
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
} else {
$proData = $oProcess->getAllProcesses($start, $limit, $_POST['category'], null, true, false, $_SESSION["USER_LOGGED"]);
}
} else {
if (isset($_POST['processName'])) {
$memkey = 'processList-' . $start . '-' . $limit . '-' . $_POST['processName'];
$memcacheUsed = 'yes';
$proData = $memcache->get($memkey);
if ($proData === false) {
$proData = $oProcess->getAllProcesses($start, $limit, null, $_POST['processName'], true, false, $_SESSION["USER_LOGGED"]);
$memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
$totalCount = count($proData);
$proData = array_splice($proData, $start, $limit);
$memcacheUsed = 'no';
} else {
$proData = $oProcess->orderMemcache($proData, $start, $limit);
$totalCount = $proData->totalCount;
$proData = $proData->dataMemcache;
}
} else {
$memkey = 'processList-allProcesses-' . $start . '-' . $limit;
$memkeyTotal = $memkey . '-total';
$memcacheUsed = 'yes';
if (($proData = $memcache->get($memkey)) === false || ($totalCount = $memcache->get($memkeyTotal)) === false) {
$proData = $oProcess->getAllProcesses($start, $limit, null, null, true, false, $_SESSION["USER_LOGGED"]);
$totalCount = count($proData);
$proData = array_splice($proData, $start, $limit);
$memcache->set($memkey, $proData, PMmemcached::ONE_HOUR);
$memcache->set($memkeyTotal, $totalCount, PMmemcached::ONE_HOUR);
$memcacheUsed = 'no';
} else {
$proData = $oProcess->orderMemcache($proData, $start, $limit);
$totalCount = $proData->totalCount;
$proData = $proData->dataMemcache;
}
}
$sort = isset($_POST['sort']) ? $_POST['sort'] : 'PRO_CREATE_DATE';
switch ($sort) {
case 'PRO_DEBUG_LABEL':
$sort = 'PRO_DEBUG';
break;
case 'PRO_CREATE_USER_LABEL':
$sort = 'USR_UID';
break;
case 'PRO_STATUS_LABEL':
$sort = 'PRO_STATUS';
break;
case 'PROJECT_TYPE':
$sort = 'PRO_TYPE';
break;
case 'PRO_CATEGORY_LABEL':
$sort = 'PRO_CATEGORY';
break;
default:
// keep the sort value
}
$r = new stdclass();
$r->memkey = htmlspecialchars($memkey);
$r->memcache = $memcacheUsed;
$r->data = \ProcessMaker\Util\DateTime::convertUtcToTimeZone($proData);
$r->totalCount = $totalCount;
$totalCount = 0;
// Get the category uid to search
$catUid = !empty($_POST['category']) ? $_POST['category'] : null;
// Get the process name to search
$process = !empty($_POST['processName']) ? $_POST['processName'] : null;
$usrUid = $_SESSION["USER_LOGGED"];
$proData = Process::getProcessesFilter(
$catUid,
null,
$process,
$usrUid,
$start,
$limit,
$dir,
$sort
);
$response = new stdclass();
$response->data = DateTime::convertUtcToTimeZone($proData);
$response->totalCount = Process::getCounter($usrUid);
echo G::json_encode($response);
echo G::json_encode($r);

View File

@@ -1,6 +1,6 @@
<?php
use ProcessMaker\AuditLog\AuditLog;
use ProcessMaker\Log\AuditLog;
global $RBAC;

View File

@@ -1,6 +1,6 @@
<?php
use ProcessMaker\AuditLog\AuditLog;
use ProcessMaker\Log\AuditLog;
$auditLog = new AuditLog();
$auditLog->setUserLogged($_SESSION["USER_LOGGED"]);

View File

@@ -117,8 +117,8 @@ try {
echo $response;
break;
case 'deleteUser':
Process::convertPrivateProcessesToPublic(json_decode($_POST['private_processes']));
$usrUid = $_POST['USR_UID'];
Process::convertPrivateProcessesToPublicAndUpdateUser(json_decode($_POST['private_processes']), $usrUid);
//Check if the user was defined in a process permissions
$oObjectPermission = new ObjectPermission();
$aProcess = $oObjectPermission->objectPermissionPerUser($usrUid, 1);

View File

@@ -355,7 +355,8 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
data: {
action: 'startCase',
processId: processUid,
taskId: tasUid
taskId: tasUid,
actionFrom: 'webEntry'
},
success: function (data) {
data.TAS_UID = tasUid;