Merged in develop (pull request #5780)

Develop

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2017-07-04 14:41:49 +00:00
4 changed files with 101 additions and 80 deletions

View File

@@ -103,9 +103,9 @@ class RBAC
'importSkin' => array('PM_SETUP_SKIN'), 'importSkin' => array('PM_SETUP_SKIN'),
'exportSkin' => array('PM_SETUP_SKIN'), 'exportSkin' => array('PM_SETUP_SKIN'),
'deleteSkin' => array('PM_SETUP_SKIN'), 'deleteSkin' => array('PM_SETUP_SKIN'),
'streamSkin' => array('PM_SETUP_SKIN'),
'addTarFolder' => array('PM_SETUP_SKIN'), 'addTarFolder' => array('PM_SETUP_SKIN'),
'copy_skin_folder' => array('PM_SETUP_SKIN'), 'copy_skin_folder' => array('PM_SETUP_SKIN')
'deleteSkin' => array('PM_SETUP_SKIN')
), ),
'processes_DownloadFile.php' => array( 'processes_DownloadFile.php' => array(
'downloadFileHash' => array('PM_FACTORY') 'downloadFileHash' => array('PM_FACTORY')
@@ -127,6 +127,22 @@ class RBAC
'getCaledarList' => array(), 'getCaledarList' => array(),
'getPMVariables' => array(), 'getPMVariables' => array(),
'generateBpmn' => array() 'generateBpmn' => array()
),
'home.php' => array(
'login' => array('PM_LOGIN'),
'index' => array('PM_CASES'),
'indexSingle' => array('PM_CASES'),
'appList' => array('PM_CASES'),
'appAdvancedSearch' => array('PM_ALLCASES'),
'getApps' => array('PM_ALLCASES'),
'getAppsData' => array('PM_ALLCASES'),
'startCase' => array('PM_CASES'),
'error' => array(),
'getUserArray' => array('PM_ALLCASES'),
'getCategoryArray' => array('PM_ALLCASES'),
'getAllUsersArray' => array('PM_ALLCASES'),
'getStatusArray' => array('PM_ALLCASES'),
'getProcessArray' => array('PM_ALLCASES')
) )
); );

View File

@@ -1980,6 +1980,12 @@ class AppSolr
} }
else { else {
foreach ($UnSerializedCaseData as $k => $value) { foreach ($UnSerializedCaseData as $k => $value) {
//This validation is only for the 'checkbox' control for the BPMN forms,
//the request is not made to the database to obtain the control
//associated with the variable so as not to decrease the performance.
if (is_array($value) && count($value) === 1 && isset($value[0]) && !is_object($value[0]) && !is_array($value[0])) {
$value = $value[0];
}
if (! is_array ($value) && ! is_object ($value) && $value != '' && $k != 'SYS_LANG' && $k != 'SYS_SKIN' && $k != 'SYS_SYS') { if (! is_array ($value) && ! is_object ($value) && $value != '' && $k != 'SYS_LANG' && $k != 'SYS_SKIN' && $k != 'SYS_SYS') {
// search the field type in array of dynaform fields // search the field type in array of dynaform fields
if (! empty ($dynaformFieldTypes) && array_key_exists (trim ($k), $dynaformFieldTypes)) { if (! empty ($dynaformFieldTypes) && array_key_exists (trim ($k), $dynaformFieldTypes)) {

View File

@@ -3,7 +3,6 @@
/** /**
* Home controller * Home controller
* *
* @author Erik Amaru Ortiz <erik@colosa.com, aortiz.erik@gmail.com>
* @inherits Controller * @inherits Controller
* @access public * @access public
*/ */
@@ -24,9 +23,15 @@ class Home extends Controller
private $lastSkin; private $lastSkin;
private $usrId; private $usrId;
public function call ($name)
{
global $RBAC;
$RBAC->allows(basename(__FILE__), $name);
parent::call($name);
}
public function __construct () public function __construct ()
{ {
//die($_SESSION['user_experience']);
// setting client browser information // setting client browser information
$this->clientBrowser = G::getBrowser(); $this->clientBrowser = G::getBrowser();
@@ -301,7 +306,22 @@ class Home extends Controller
$userName = $userObject->getUsrLastname() . " " . $userObject->getUsrFirstname(); $userName = $userObject->getUsrLastname() . " " . $userObject->getUsrFirstname();
} }
$cases = $this->getAppsData( $httpData->t, null, null, $user, null, $search, $process, $status, $dateFrom, $dateTo, null, null, 'APP_CACHE_VIEW.APP_NUMBER', $category); $cases = $this->getAppsData(
$httpData->t,
null,
null,
$user,
null,
$search,
$process,
$status,
$dateFrom,
$dateTo,
null,
null,
'APP_CACHE_VIEW.APP_NUMBER',
$category
);
$arraySearch = array($process, $status, $search, $category, $user, $dateFrom, $dateTo ); $arraySearch = array($process, $status, $search, $category, $user, $dateFrom, $dateTo );
// settings vars and rendering // settings vars and rendering
@@ -377,7 +397,11 @@ class Home extends Controller
$user = null; $user = null;
break; break;
case null: case null:
if ($type === 'search') {
$user = null;
} else {
$user = $this->usrId; $user = $this->usrId;
}
break; break;
default: default:
//$user = $this->userID; //$user = $this->userID;
@@ -442,17 +466,34 @@ class Home extends Controller
$dataList['sort'] = $sort; $dataList['sort'] = $sort;
$dataList['category'] = $category; $dataList['category'] = $category;
$dataList['action'] = $type; $dataList['action'] = $type;
$dataList['dir'] = 'DESC';
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
if (true) { if (true) {
//In enterprise version this block of code should always be executed //In enterprise version this block of code should always be executed
//In community version this block of code is deleted and is executed the other //In community version this block of code is deleted and is executed the other
$swType = $type === "todo" || $type === "draft"; $listType = '';
if ($swType || $type === "unassigned") { if (!empty($type)) {
switch ($type) {
case 'todo':
$listType = 'inbox';
break;
case 'draft':
$listType = 'inbox';
break;
case 'unassigned':
$listType = 'unassigned';
break;
case 'search':
$dataList['filterStatus'] = $status;
break;
}
}
if (!empty($listType)) {
//The change is made because the method 'getList()' does not //The change is made because the method 'getList()' does not
//support 'USR_UID', this method uses the numeric field 'USR_ID'. //support 'USR_UID', this method uses the numeric field 'USR_ID'.
$userObject = Users::loadById($dataList['userId']); $userObject = Users::loadById($dataList['userId']);
$dataList['userId'] = $userObject->getUsrUid(); $dataList['userId'] = $userObject->getUsrUid();
$listType = $swType ? "inbox" : $type;
$list = new \ProcessMaker\BusinessModel\Lists(); $list = new \ProcessMaker\BusinessModel\Lists();
$cases = $list->getList($listType, $dataList); $cases = $list->getList($listType, $dataList);
} }
@@ -532,7 +573,6 @@ class Home extends Controller
$oCase = new Cases(); $oCase = new Cases();
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] ); $aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
//../cases/cases_Open?APP_UID={$APP.APP_UID}&DEL_INDEX={$APP.DEL_INDEX}&action=todo
$aNextStep['PAGE'] = '../cases/cases_Open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft'; $aNextStep['PAGE'] = '../cases/cases_Open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft';
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep; $_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
@@ -557,7 +597,9 @@ class Home extends Controller
function getUserArray($action, $userUid, $search = null) function getUserArray($action, $userUid, $search = null)
{ {
global $oAppCache; G::LoadClass("configuration");
$conf = new Configurations();
$confEnvSetting = $conf->getFormats();
$status = array(); $status = array();
$users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER")); $users[] = array("CURRENT_USER", G::LoadTranslation("ID_CURRENT_USER"));
$users[] = array("ALL", G::LoadTranslation("ID_ALL_USERS")); $users[] = array("ALL", G::LoadTranslation("ID_ALL_USERS"));
@@ -571,16 +613,25 @@ class Home extends Controller
$cUsers->addSelectColumn(UsersPeer::USR_UID); $cUsers->addSelectColumn(UsersPeer::USR_UID);
$cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME); $cUsers->addSelectColumn(UsersPeer::USR_FIRSTNAME);
$cUsers->addSelectColumn(UsersPeer::USR_LASTNAME); $cUsers->addSelectColumn(UsersPeer::USR_LASTNAME);
$cUsers->addSelectColumn(UsersPeer::USR_USERNAME);
$cUsers->addSelectColumn(UsersPeer::USR_ID); $cUsers->addSelectColumn(UsersPeer::USR_ID);
if (!empty($search)) { if (!empty($search)) {
$cUsers->addOr(UsersPeer::USR_FIRSTNAME, "%$search%", Criteria::LIKE); $cUsers->add(
$cUsers->addOr(UsersPeer::USR_LASTNAME, "%$search%", Criteria::LIKE); $cUsers->getNewCriterion(UsersPeer::USR_FIRSTNAME, '%' . $search . '%', Criteria::LIKE)->addOr(
$cUsers->getNewCriterion(UsersPeer::USR_LASTNAME, '%' . $search . '%', Criteria::LIKE))
);
} }
$oDataset = UsersPeer::doSelectRS($cUsers); $oDataset = UsersPeer::doSelectRS($cUsers);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();
while ($aRow = $oDataset->getRow()) { while ($aRow = $oDataset->getRow()) {
$users[] = array($aRow['USR_ID'], htmlentities($aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'], ENT_QUOTES, "UTF-8")); $usrFullName = $conf->usersNameFormatBySetParameters(
$confEnvSetting["format"],
$aRow["USR_USERNAME"],
$aRow["USR_FIRSTNAME"],
$aRow["USR_LASTNAME"]
);
$users[] = array($aRow['USR_ID'], htmlentities($usrFullName, ENT_QUOTES, "UTF-8"));
$oDataset->next(); $oDataset->next();
} }
break; break;
@@ -644,66 +695,14 @@ class Home extends Controller
function getStatusArray ($action, $userUid) function getStatusArray ($action, $userUid)
{ {
global $oAppCache; $status = array();
$status = array (); $aStatus = Application::$app_status_values;
$status[] = array ('',G::LoadTranslation( 'ID_ALL_STATUS' )); $status[] = array('', G::LoadTranslation('ID_ALL_STATUS'));
//get the list based in the action provided foreach ($aStatus as $key => $value) {
switch ($action) { if ($action == 'search') {
case 'sent': $status[] = array ($value, G::LoadTranslation( 'ID_CASES_STATUS_' . $key ));
$cStatus = $oAppCache->getSentListProcessCriteria( $userUid ); // a little slow } else {
break; $status[] = array ($key, G::LoadTranslation( 'ID_CASES_STATUS_' . $key ));
case 'simple_search':
case 'search':
$cStatus = new Criteria( 'workflow' );
$cStatus->clearSelectColumns();
$cStatus->setDistinct();
$cStatus->addSelectColumn( ApplicationPeer::APP_STATUS );
$oDataset = ApplicationPeer::doSelectRS( $cStatus );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] )
); //here we can have a translation for the status ( the second param)
$oDataset->next();
}
return $status;
break;
case 'selfservice':
$cStatus = $oAppCache->getUnassignedListCriteria( $userUid );
break;
case 'paused':
$cStatus = $oAppCache->getPausedListCriteria( $userUid );
break;
case 'to_revise':
$cStatus = $oAppCache->getToReviseListCriteria( $userUid );
// $cStatus = $oAppCache->getPausedListCriteria($userUid);
break;
case 'to_reassign':
$cStatus = $oAppCache->getToReassignListCriteria($userUid);
break;
case 'todo':
case 'draft':
case 'gral':
// case 'to_revise' :
default:
return $status;
break;
}
//get the status for this user in this action only for participated, unassigned, paused
// if ( $action != 'todo' && $action != 'draft' && $action != 'to_revise') {
if ($action != 'todo' && $action != 'draft') {
//$cStatus = new Criteria('workflow');
$cStatus->clearSelectColumns();
$cStatus->setDistinct();
$cStatus->addSelectColumn( AppCacheViewPeer::APP_STATUS );
$oDataset = AppCacheViewPeer::doSelectRS( $cStatus );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$status[] = array ($aRow['APP_STATUS'],G::LoadTranslation( 'ID_CASES_STATUS_' . $aRow['APP_STATUS'] ));
//here we can have a translation for the status ( the second param)
$oDataset->next();
} }
} }
return $status; return $status;

View File

@@ -408,7 +408,7 @@ Ext.onReady(function(){
processesGrid = new Ext.grid.GridPanel( { processesGrid = new Ext.grid.GridPanel( {
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
id: 'granularGridPanel', id: 'processesGrid',
height: 500, height: 500,
width:'', width:'',
title : '', title : '',
@@ -1207,7 +1207,7 @@ function exportImportProcessObjects(typeAction)
gridProcessObjects = new Ext.grid.EditorGridPanel( { gridProcessObjects = new Ext.grid.EditorGridPanel( {
region: 'center', region: 'center',
layout: 'fit', layout: 'fit',
id: 'processesGrid', id: 'gridProcessObjects',
height:365, height:365,
width:355, width:355,
title : '', title : '',