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

View File

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

View File

@@ -173,7 +173,7 @@
<body onload="resize()" onresize="resize()" >
<center>
<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">
{include file='home/applications.html'}
</ul>

View File

@@ -356,7 +356,7 @@
<center>
<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">
{include file='home/applications.html'}
</ul>