Merged in bugfix/HOR-2887 (pull request #5675)

HOR-2887

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2017-05-25 20:41:24 +00:00
committed by Julio Cesar Laura Avendaño
4 changed files with 37 additions and 42 deletions

View File

@@ -22,6 +22,7 @@ class Home extends Controller
private $clientBrowser; private $clientBrowser;
private $lastSkin; private $lastSkin;
private $usrId;
public function __construct () public function __construct ()
{ {
@@ -39,6 +40,10 @@ class Home extends Controller
$this->userName = isset( $_SESSION['USR_USERNAME'] ) ? $_SESSION['USR_USERNAME'] : ''; $this->userName = isset( $_SESSION['USR_USERNAME'] ) ? $_SESSION['USR_USERNAME'] : '';
$this->userFullName = isset( $_SESSION['USR_FULLNAME'] ) ? $_SESSION['USR_FULLNAME'] : ''; $this->userFullName = isset( $_SESSION['USR_FULLNAME'] ) ? $_SESSION['USR_FULLNAME'] : '';
$this->userRolName = isset( $_SESSION['USR_ROLENAME'] ) ? $_SESSION['USR_ROLENAME'] : ''; $this->userRolName = isset( $_SESSION['USR_ROLENAME'] ) ? $_SESSION['USR_ROLENAME'] : '';
$users = new Users();
$users = $users->load($this->userID);
$this->usrId = $users["USR_ID"];
} }
} }
@@ -261,7 +266,6 @@ class Home extends Controller
// settings vars and rendering // settings vars and rendering
$this->setVar( 'cases', $cases['data'] ); $this->setVar( 'cases', $cases['data'] );
$this->setVar( 'cases_count', $cases['totalCount'] );
$this->setVar( 'title', $title ); $this->setVar( 'title', $title );
$this->setVar( 'noPerms', G::LoadTranslation( 'ID_CASES_NOTES_NO_PERMISSIONS' )); $this->setVar( 'noPerms', G::LoadTranslation( 'ID_CASES_NOTES_NO_PERMISSIONS' ));
$this->setVar( 'appListStart', $this->appListLimit ); $this->setVar( 'appListStart', $this->appListLimit );
@@ -279,6 +283,7 @@ class Home extends Controller
// settings html template // settings html template
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'appListSearch' ); $this->setView( $this->userUxBaseTemplate . PATH_SEP . 'appListSearch' );
// get data
$process = (isset($httpData->process)) ? $httpData->process : null; $process = (isset($httpData->process)) ? $httpData->process : null;
$status = (isset($httpData->status)) ? $httpData->status : null; $status = (isset($httpData->status)) ? $httpData->status : null;
$search = (isset($httpData->search)) ? $httpData->search : null; $search = (isset($httpData->search)) ? $httpData->search : null;
@@ -286,18 +291,16 @@ class Home extends Controller
$user = (isset($httpData->user)) ? $httpData->user : null; $user = (isset($httpData->user)) ? $httpData->user : null;
$dateFrom = (isset($httpData->dateFrom)) ? $httpData->dateFrom : null; $dateFrom = (isset($httpData->dateFrom)) ? $httpData->dateFrom : null;
$dateTo = (isset($httpData->dateTo)) ? $httpData->dateTo : null; $dateTo = (isset($httpData->dateTo)) ? $httpData->dateTo : null;
$processTitle = "";
if (!empty($process)) { if (!empty($process)) {
$processTitle = Process::loadById($process)->getProTitle(); $processTitle = Process::loadById($process)->getProTitle();
} else {
$processTitle = '';
} }
if (!empty($user)) { $userName = "";
if (!empty($user) && $user !== "ALL" && $user !== "CURRENT_USER") {
$userObject = Users::loadById($user); $userObject = Users::loadById($user);
$userName = $userObject->getUsrLastname()." ".$userObject->getUsrFirstname(); $userName = $userObject->getUsrLastname() . " " . $userObject->getUsrFirstname();
} else {
$userName = '';
} }
$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 );
@@ -318,7 +321,6 @@ class Home extends Controller
$this->setVar( 'arraySearch', $arraySearch ); $this->setVar( 'arraySearch', $arraySearch );
$this->setVar( 'cases', $cases['data'] ); $this->setVar( 'cases', $cases['data'] );
$this->setVar( 'cases_count', $cases['totalCount'] );
$this->setVar( 'title', $title ); $this->setVar( 'title', $title );
$this->setVar( 'noPerms', G::LoadTranslation( 'ID_CASES_NOTES_NO_PERMISSIONS' )); $this->setVar( 'noPerms', G::LoadTranslation( 'ID_CASES_NOTES_NO_PERMISSIONS' ));
$this->setVar( 'appListStart', $this->appListLimit ); $this->setVar( 'appListStart', $this->appListLimit );
@@ -369,13 +371,13 @@ class Home extends Controller
$notesLimit = 4; $notesLimit = 4;
switch ($user) { switch ($user) {
case 'CURRENT_USER': case 'CURRENT_USER':
$user = $this->userID; $user = $this->usrId;
break; break;
case 'ALL': case 'ALL':
$user = null; $user = null;
break; break;
case null: case null:
$user = $this->userID; $user = $this->usrId;
break; break;
default: default:
//$user = $this->userID; //$user = $this->userID;
@@ -444,21 +446,15 @@ class Home extends Controller
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
$list = new \ProcessMaker\BusinessModel\Lists(); $swType = $type === "todo" || $type === "draft";
$listName = 'inbox'; if ($swType || $type === "unassigned") {
switch ($type) { //The change is made because the method 'getList()' does not
case 'draft': //support 'USR_UID', this method uses the numeric field 'USR_ID'.
case 'todo': $userObject = Users::loadById($dataList['userId']);
$listName = 'inbox'; $dataList['userId'] = $userObject->getUsrUid();
$cases = $list->getList($listName, $dataList); $listType = $swType ? "inbox" : $type;
break; $list = new \ProcessMaker\BusinessModel\Lists();
case 'unassigned': $cases = $list->getList($listType, $dataList);
$case = new \ProcessMaker\BusinessModel\Cases();
$cases = $case->getList($dataList);
foreach ($cases['data'] as &$value) {
$value = array_change_key_case($value, CASE_UPPER);
}
break;
} }
} else { } else {
/*----------------------------------********---------------------------------*/ /*----------------------------------********---------------------------------*/
@@ -559,31 +555,32 @@ class Home extends Controller
$this->render(); $this->render();
} }
function getUserArray ($action, $userUid, $search = null) function getUserArray($action, $userUid, $search = null)
{ {
global $oAppCache; global $oAppCache;
$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"));
//now get users, just for the Search action //now get users, just for the Search action
switch ($action) { switch ($action) {
case 'search_simple': case 'search_simple':
case 'search': case 'search':
$cUsers = new Criteria( 'workflow' ); $cUsers = new Criteria('workflow');
$cUsers->clearSelectColumns(); $cUsers->clearSelectColumns();
$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_ID);
if (!empty($search)) { if (!empty($search)) {
$cUsers->addOr(UsersPeer::USR_FIRSTNAME, "%$search%", Criteria::LIKE); $cUsers->addOr(UsersPeer::USR_FIRSTNAME, "%$search%", Criteria::LIKE);
$cUsers->addOr(UsersPeer::USR_LASTNAME, "%$search%", Criteria::LIKE); $cUsers->addOr(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_UID'], htmlentities($aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'], ENT_QUOTES, "UTF-8")); $users[] = array($aRow['USR_ID'], htmlentities($aRow['USR_LASTNAME'] . ' ' . $aRow['USR_FIRSTNAME'], ENT_QUOTES, "UTF-8"));
$oDataset->next(); $oDataset->next();
} }
break; break;

View File

@@ -227,9 +227,7 @@ class Cases
{ {
Validator::isArray($dataList, '$dataList'); Validator::isArray($dataList, '$dataList');
if (!isset($dataList["userId"])) { if (!isset($dataList["userId"])) {
throw (new \Exception(\G::LoadTranslation("ID_USER_NOT_EXIST", array('userId','')))); $dataList["userId"] = null;
} else {
Validator::usrUid($dataList["userId"], "userId");
} }
$solrEnabled = false; $solrEnabled = false;

View File

@@ -173,7 +173,7 @@
<body onload="resize()" onresize="resize()" > <body onload="resize()" onresize="resize()" >
<center> <center>
<div class="content-header" style="text-align:left"> <div class="content-header" style="text-align:left">
<h1 style="padding: 10px">{$title} ({$cases_count})</h1> <h1 style="padding: 10px">{$title}</h1>
<ul id="commentlist"> <ul id="commentlist">
{include file='home/applications.html'} {include file='home/applications.html'}
</ul> </ul>

View File

@@ -356,7 +356,7 @@
<center> <center>
<div class="content-header" style="text-align:left"> <div class="content-header" style="text-align:left">
<h1 style="padding: 10px">{$title} ({$cases_count})</h1> <h1 style="padding: 10px">{$title}</h1>
<ul id="commentlist"> <ul id="commentlist">
{include file='home/applications.html'} {include file='home/applications.html'}
</ul> </ul>