PM-811 "Process Permission Dynaform y Cases Notes Status..." SOLVED
Issue:
Al definir un ProcessPermission (PAUSED) ya sea para un Usuario o Grupo
no se aplica en el CasesList (el mensaje de alerta de permisos es desplegado)
Cause:
Query mal definido (para Usuarios y Grupos)
Solution:
Se ha mejorado el query involucrado, se agrego variables y validaciones faltantes (DEL_INDEX)
This commit is contained in:
@@ -5090,12 +5090,21 @@ class Cases
|
||||
* function getAllObjectsFrom ($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $ACTION)
|
||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
||||
* @access public
|
||||
* @param Process ID, Application ID, Task ID, User ID, Action
|
||||
* @param Process ID, Application ID, Task ID, User ID, Action, Delegation index
|
||||
* @return Array within all user permitions all objects' types
|
||||
*/
|
||||
public function getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $ACTION = '')
|
||||
public function getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID = "", $USR_UID = "", $ACTION = "", $delIndex = 0)
|
||||
{
|
||||
$aCase = $this->loadCase($APP_UID);
|
||||
|
||||
if ($delIndex != 0) {
|
||||
$appDelay = new AppDelay();
|
||||
|
||||
if ($appDelay->isPaused($APP_UID, $delIndex)) {
|
||||
$aCase["APP_STATUS"] = "PAUSED";
|
||||
}
|
||||
}
|
||||
|
||||
$USER_PERMISSIONS = Array();
|
||||
$GROUP_PERMISSIONS = Array();
|
||||
$RESULT = Array(
|
||||
@@ -5125,30 +5134,26 @@ class Cases
|
||||
)
|
||||
)
|
||||
);
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$rs = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
while ($row = $rs->getRow()) {
|
||||
if (
|
||||
(($aCase['APP_STATUS'] == $row['OP_CASE_STATUS']) ||
|
||||
($row['OP_CASE_STATUS'] == '') ||
|
||||
($row['OP_CASE_STATUS'] == 'ALL')) ||
|
||||
($row['OP_CASE_STATUS'] == '')) {
|
||||
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
|
||||
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
||||
$row["OP_CASE_STATUS"] == $aCase["APP_STATUS"]
|
||||
) {
|
||||
array_push($USER_PERMISSIONS, $row);
|
||||
}
|
||||
$rs->next();
|
||||
}
|
||||
|
||||
//permissions per group
|
||||
G::loadClass('groups');
|
||||
|
||||
$gr = new Groups();
|
||||
$records = $gr->getActiveGroupsForAnUser($USR_UID);
|
||||
|
||||
foreach ($records as $group) {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ObjectPermissionPeer::USR_UID, $group);
|
||||
@@ -5161,20 +5166,22 @@ class Cases
|
||||
)
|
||||
)
|
||||
);
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, 'ALL')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::OP_CASE_STATUS, '0')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$rs = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rs->next()) {
|
||||
array_push($GROUP_PERMISSIONS, $rs->getRow());
|
||||
$row = $rs->getRow();
|
||||
|
||||
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
||||
$row["OP_CASE_STATUS"] == $aCase["APP_STATUS"]
|
||||
) {
|
||||
array_push($GROUP_PERMISSIONS, $row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$PERMISSIONS = array_merge($USER_PERMISSIONS, $GROUP_PERMISSIONS);
|
||||
|
||||
foreach ($PERMISSIONS as $row) {
|
||||
$USER = $row['USR_UID'];
|
||||
$USER_RELATION = $row['OP_USER_RELATION'];
|
||||
@@ -5266,7 +5273,7 @@ class Cases
|
||||
// Message History
|
||||
$RESULT['MSGS_HISTORY'] = array('PERMISSION' => $ACTION);
|
||||
|
||||
$delIndex = array();
|
||||
$arrayDelIndex = array();
|
||||
|
||||
$oCriteria = new Criteria('workflow');
|
||||
if ($USER_RELATION == 1) {
|
||||
@@ -5284,7 +5291,7 @@ class Cases
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$delIndex[] = $aRow['DEL_INDEX'];
|
||||
$arrayDelIndex[] = $aRow["DEL_INDEX"];
|
||||
$oDataset->next();
|
||||
}
|
||||
} else {
|
||||
@@ -5303,11 +5310,11 @@ class Cases
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$delIndex[] = $aRow['DEL_INDEX'];
|
||||
$arrayDelIndex[] = $aRow["DEL_INDEX"];
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
$RESULT['MSGS_HISTORY'] = array_merge(array('DEL_INDEX' => $delIndex), $RESULT['MSGS_HISTORY']);
|
||||
$RESULT["MSGS_HISTORY"] = array_merge(array("DEL_INDEX" => $arrayDelIndex), $RESULT["MSGS_HISTORY"]);
|
||||
break;
|
||||
case 'DYNAFORM':
|
||||
$oCriteria = new Criteria('workflow');
|
||||
@@ -5415,7 +5422,7 @@ class Cases
|
||||
case 'MSGS_HISTORY':
|
||||
// Permission
|
||||
$RESULT['MSGS_HISTORY'] = array('PERMISSION' => $ACTION);
|
||||
$delIndex = array();
|
||||
$arrayDelIndex = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
if ($USER_RELATION == 1) {
|
||||
$oCriteria->add(AppDelegationPeer::APP_UID, $APP_UID);
|
||||
@@ -5430,7 +5437,7 @@ class Cases
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$delIndex[] = $aRow['DEL_INDEX'];
|
||||
$arrayDelIndex[] = $aRow["DEL_INDEX"];
|
||||
$oDataset->next();
|
||||
}
|
||||
} else {
|
||||
@@ -5448,11 +5455,11 @@ class Cases
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$delIndex[] = $aRow['DEL_INDEX'];
|
||||
$arrayDelIndex[] = $aRow["DEL_INDEX"];
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
$RESULT['MSGS_HISTORY'] = array_merge(array('DEL_INDEX' => $delIndex), $RESULT['MSGS_HISTORY']);
|
||||
$RESULT["MSGS_HISTORY"] = array_merge(array("DEL_INDEX" => $arrayDelIndex), $RESULT["MSGS_HISTORY"]);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -34,19 +34,33 @@ class AppProxy extends HttpProxyController
|
||||
print G::json_encode( $response );
|
||||
die();
|
||||
}
|
||||
|
||||
$appUid = null;
|
||||
|
||||
if (isset( $httpData->appUid ) && trim( $httpData->appUid ) != "") {
|
||||
$appUid = $httpData->appUid;
|
||||
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
|
||||
$appUid = trim($httpData->appUid);
|
||||
} else {
|
||||
if (isset( $_SESSION['APPLICATION'] )) {
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
if (isset($_SESSION["APPLICATION"])) {
|
||||
$appUid = $_SESSION["APPLICATION"];
|
||||
}
|
||||
}
|
||||
|
||||
$delIndex = 0;
|
||||
|
||||
if (isset($httpData->delIndex) && trim($httpData->delIndex) != "") {
|
||||
$delIndex = (int)(trim($httpData->delIndex));
|
||||
} else {
|
||||
if (isset($_SESSION["INDEX"])) {
|
||||
$delIndex = (int)($_SESSION["INDEX"]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($appUid)) {
|
||||
throw new Exception(G::LoadTranslation("ID_RESOLVE_APPLICATION_ID"));
|
||||
}
|
||||
|
||||
G::LoadClass( 'case' );
|
||||
$case = new Cases();
|
||||
$caseLoad = '';
|
||||
|
||||
if (!isset($_SESSION['PROCESS']) && !isset($httpData->pro)) {
|
||||
$caseLoad = $case->loadCase($appUid);
|
||||
@@ -70,8 +84,8 @@ class AppProxy extends HttpProxyController
|
||||
//$tasUid = (!isset($httpData->tas)) ? ((isset($_SESSION['TASK'])) ? $_SESSION['TASK'] : '') : $httpData->tas;
|
||||
$usrUid = $_SESSION['USER_LOGGED'];
|
||||
|
||||
$respView = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'VIEW' );
|
||||
$respBlock = $case->getAllObjectsFrom( $proUid, $appUid, $tasUid, $usrUid, 'BLOCK' );
|
||||
$respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "VIEW", $delIndex);
|
||||
$respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "BLOCK", $delIndex);
|
||||
|
||||
if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) {
|
||||
return array ('totalCount' => 0,'notes' => array (),'noPerms' => 1
|
||||
@@ -80,10 +94,6 @@ class AppProxy extends HttpProxyController
|
||||
|
||||
//require_once ("classes/model/AppNotes.php");
|
||||
|
||||
if (! isset( $appUid )) {
|
||||
throw new Exception( G::LoadTranslation('ID_RESOLVE_APPLICATION_ID' ) );
|
||||
}
|
||||
|
||||
$usrUid = isset( $_SESSION['USER_LOGGED'] ) ? $_SESSION['USER_LOGGED'] : "";
|
||||
$appNotes = new AppNotes();
|
||||
$response = $appNotes->getNotesList( $appUid, '', $httpData->start, $httpData->limit );
|
||||
|
||||
@@ -13,7 +13,7 @@ function closeCaseNotesWindow(){
|
||||
}
|
||||
}
|
||||
|
||||
function openCaseNotesWindow(appUid1, modalSw, appTitle, proUid, taskUid)
|
||||
function openCaseNotesWindow(appUid1, delIndex, modalSw, appTitle, proUid, taskUid)
|
||||
{
|
||||
Ext.MessageBox.show({
|
||||
msg: _('ID_CASE_NOTES_LOADING'),
|
||||
@@ -26,6 +26,7 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle, proUid, taskUid)
|
||||
|
||||
Ext.QuickTips.init();
|
||||
appUid = !appUid1 ? "": appUid1;
|
||||
delIndex = (!delIndex)? 0: delIndex;
|
||||
proUid = !proUid ? "": proUid;
|
||||
taskUid = !taskUid ? "": taskUid;
|
||||
|
||||
@@ -33,7 +34,7 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle, proUid, taskUid)
|
||||
var loadSize=10;
|
||||
|
||||
storeNotes = new Ext.data.JsonStore({
|
||||
url : '../appProxy/getNotesList?appUid='+appUid+'&pro='+proUid+'&tas='+taskUid,
|
||||
url: "../appProxy/getNotesList?appUid=" + appUid + "&delIndex=" + delIndex + "&pro=" + proUid + "&tas=" + taskUid,
|
||||
root: 'notes',
|
||||
totalProperty: 'totalCount',
|
||||
fields: ['USR_USERNAME','USR_FIRSTNAME','USR_LASTNAME','USR_FULL_NAME','NOTE_DATE','NOTE_CONTENT', 'USR_UID', 'user'],
|
||||
@@ -79,12 +80,12 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle, proUid, taskUid)
|
||||
icon: Ext.MessageBox.ERROR,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
fn : function(btn) {
|
||||
try
|
||||
try
|
||||
{
|
||||
prnt = parent.parent;
|
||||
top.location = top.location;
|
||||
}
|
||||
catch (err)
|
||||
catch (err)
|
||||
{
|
||||
parent.location = parent.location;
|
||||
}
|
||||
@@ -393,12 +394,12 @@ function sendNote()
|
||||
icon : Ext.MessageBox.ERROR,
|
||||
buttons : Ext.Msg.OK,
|
||||
fn : function(btn) {
|
||||
try
|
||||
try
|
||||
{
|
||||
prnt = parent.parent;
|
||||
top.location = top.location;
|
||||
}
|
||||
catch (err)
|
||||
catch (err)
|
||||
{
|
||||
parent.location = parent.location;
|
||||
}
|
||||
@@ -618,12 +619,12 @@ var openSummaryWindow = function(appUid, delIndex, action)
|
||||
icon : Ext.MessageBox.ERROR,
|
||||
buttons : Ext.Msg.OK,
|
||||
fn : function(btn) {
|
||||
try
|
||||
try
|
||||
{
|
||||
prnt = parent.parent;
|
||||
top.location = top.location;
|
||||
}
|
||||
catch (err)
|
||||
catch (err)
|
||||
{
|
||||
parent.location = parent.location;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,8 @@ function caseNotes(){
|
||||
var caseTitle = (rowModel.data.APP_TITLE) ? rowModel.data.APP_TITLE : rowModel.data.APP_UID;
|
||||
var task = (typeof(rowModel.json.TAS_UID) != 'undefined') ? rowModel.json.TAS_UID : '';
|
||||
var proid = (typeof(rowModel.json.PRO_UID) != 'undefined') ? rowModel.json.PRO_UID : '';
|
||||
openCaseNotesWindow(appUid,true,caseTitle,proid,task);
|
||||
|
||||
openCaseNotesWindow(appUid, delIndex, true, caseTitle, proid, task);
|
||||
}else{
|
||||
msgBox(_('ID_INFORMATION'), _('ID_SELECT_ONE_AT_LEAST') );
|
||||
}
|
||||
@@ -545,12 +546,13 @@ Ext.onReady ( function() {
|
||||
};
|
||||
|
||||
function renderNote(val,p,r) {
|
||||
pro = r.json.PRO_UID;
|
||||
tas = r.json.TAS_UID;
|
||||
appUid = r.data['APP_UID'];
|
||||
title = Ext.util.Format.htmlEncode(r.data['APP_TITLE']);
|
||||
var pro = r.json.PRO_UID;
|
||||
var tas = r.json.TAS_UID;
|
||||
var appUid = r.data.APP_UID;
|
||||
var delIndex = r.data.DEL_INDEX;
|
||||
var title = Ext.util.Format.htmlEncode(r.data.APP_TITLE);
|
||||
|
||||
return '<img src="/images/ext/default/s.gif" class="x-tree-node-icon ICON_CASES_NOTES" unselectable="off" id="extdd-17" onClick="openCaseNotesWindow(\''+appUid+'\', true, \''+title+'\', \''+pro+'\', \''+tas+'\')">';
|
||||
return "<img src=\"/images/ext/default/s.gif\" class=\"x-tree-node-icon ICON_CASES_NOTES\" unselectable=\"off\" id=\"extdd-17\" onClick=\"openCaseNotesWindow(\'" + appUid + "\', " + delIndex + ", true, \'" + title + "\', \'" + pro + "\', \'" + tas + "\');\" />";
|
||||
}
|
||||
|
||||
//Render Full Name
|
||||
|
||||
Reference in New Issue
Block a user