HOR-170
This commit is contained in:
@@ -590,6 +590,14 @@ class Ajax
|
||||
$data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME']; //TODO change with the farmated username from environment conf
|
||||
$result->status = 0;
|
||||
$result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
|
||||
|
||||
// Save the note reassign reason
|
||||
if (isset($_POST['NOTE_REASON']) && $_POST['NOTE_REASON'] !== '') {
|
||||
require_once ("classes/model/AppNotes.php");
|
||||
$appNotes = new AppNotes();
|
||||
$noteContent = addslashes($_POST['NOTE_REASON']);
|
||||
$appNotes->postNewNote($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_REASSIGN']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result->status = 1;
|
||||
$result->msg = $e->getMessage();
|
||||
|
||||
@@ -365,7 +365,13 @@ function getReassignList ()
|
||||
);
|
||||
$caseColumns[] = array ('header' => 'Reassigned Uid','dataIndex' => 'TAS_UID','width' => 120,'hidden' => true,'hideable' => false
|
||||
);
|
||||
$caseColumns[] = array ('header' => G::LoadTranslation( 'ID_REASSIGN_TO' ),'dataIndex' => 'APP_REASSIGN_USER','width' => 170
|
||||
$caseColumns[] = array ('header' => G::LoadTranslation( 'ID_ASSIGNED_TO' ),'dataIndex' => 'APP_CURRENT_USER','width' => 170
|
||||
);
|
||||
$caseColumns[] = array ('header' => G::LoadTranslation( 'ID_REASSIGNED_TO' ),'dataIndex' => 'APP_REASSIGN_USER','width' => 170
|
||||
);
|
||||
$caseColumns[] = array ('header' => G::LoadTranslation( 'ID_REASON' ),'dataIndex' => 'NOTE_REASON','width' => 170
|
||||
);
|
||||
$caseColumns[] = array('header' => G::LoadTranslation('ID_NOTIFY'), 'dataIndex' => 'NOTIFY_REASSIGN', 'width' => 100
|
||||
);
|
||||
|
||||
$caseReaderFields = array ();
|
||||
@@ -380,6 +386,7 @@ function getReassignList ()
|
||||
$caseReaderFields[] = array ('name' => 'APP_REASSIGN_USER');
|
||||
$caseReaderFields[] = array ('name' => 'CASE_SUMMARY');
|
||||
$caseReaderFields[] = array ('name' => 'CASE_NOTES_COUNT');
|
||||
$caseReaderFields[] = array ('name' => 'APP_CURRENT_USER');
|
||||
|
||||
return array ('caseColumns' => $caseColumns,'caseReaderFields' => $caseReaderFields,'rowsperpage' => 20,'dateformat' => 'M d, Y'
|
||||
);
|
||||
|
||||
@@ -213,6 +213,14 @@ if ($actionAjax == 'reassignCase') {
|
||||
$result = new stdClass();
|
||||
$result->status = 0;
|
||||
$result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
|
||||
|
||||
// Save the note reassign reason
|
||||
if (isset($_POST['NOTE_REASON']) && $_POST['NOTE_REASON'] !== '') {
|
||||
require_once ("classes/model/AppNotes.php");
|
||||
$appNotes = new AppNotes();
|
||||
$noteContent = addslashes($_POST['NOTE_REASON']);
|
||||
$res = $appNotes->postNewNote($_SESSION['APPLICATION'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_REASSIGN']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$result->status = 1;
|
||||
$result->msg = $e->getMessage();
|
||||
|
||||
@@ -52,6 +52,7 @@ if (empty( $aData )) {
|
||||
// var_dump($sql);
|
||||
if (is_array( $aData )) {
|
||||
$currentCasesReassigned = 0;
|
||||
require_once ("classes/model/AppNotes.php");
|
||||
foreach ($aData as $data) {
|
||||
$oTmpReassignCriteria = $oCasesReassignList;
|
||||
$oTmpReassignCriteria->add( AppCacheViewPeer::APP_UID, $data->APP_UID );
|
||||
@@ -66,6 +67,13 @@ if (is_array( $aData )) {
|
||||
$casesReassignedCount ++;
|
||||
$serverResponse[] = array ('APP_REASSIGN_USER' => $data->APP_REASSIGN_USER,'APP_TITLE' => $data->APP_TITLE,'TAS_TITLE' => $data->APP_TAS_TITLE,'REASSIGNED_CASES' => $currentCasesReassigned
|
||||
);
|
||||
|
||||
// Save the note reassign reason
|
||||
if (isset($data->NOTE_REASON) && $data->NOTE_REASON !== '') {
|
||||
$appNotes = new AppNotes();
|
||||
$noteContent = addslashes($data->NOTE_REASON);
|
||||
$appNotes->postNewNote($row['APP_UID'], $_SESSION['USER_LOGGED'], $noteContent, isset($data->NOTIFY_REASSIGN) ? $data->NOTIFY_REASSIGN : false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$oTmpReassignCriteria = $oCasesReassignList;
|
||||
|
||||
@@ -658,6 +658,26 @@ Ext.onReady ( function() {
|
||||
columns: columns
|
||||
});
|
||||
|
||||
for (var i in reassignColumns) {
|
||||
if (reassignColumns[i].dataIndex === 'APP_REASSIGN_USER') {
|
||||
reassignColumns[i].editor = comboUsersToReassign;
|
||||
}
|
||||
if (reassignColumns[i].dataIndex === 'NOTE_REASON') {
|
||||
reassignColumns[i].editor = new Ext.form.TextArea({allowBlank: false});
|
||||
}
|
||||
if (reassignColumns[i].dataIndex === 'NOTIFY_REASSIGN') {
|
||||
reassignColumns[i].editor = new Ext.form.Checkbox({});
|
||||
reassignColumns[i].renderer = function (v, x, s) {
|
||||
if (s.data.NOTIFY_REASSIGN === true) {
|
||||
return _('ID_YES');
|
||||
}
|
||||
if (s.data.NOTIFY_REASSIGN === true) {
|
||||
return _('ID_NO');
|
||||
}
|
||||
return s.data.NOTIFY_REASSIGN;
|
||||
};
|
||||
}
|
||||
}
|
||||
var reassignCm = new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
sortable: true // columns are sortable by default
|
||||
@@ -1500,12 +1520,16 @@ Ext.onReady ( function() {
|
||||
var rowSelected = Ext.getCmp("grdpnlUsersToReassign").getSelectionModel().getSelected();
|
||||
|
||||
if( rowSelected ) {
|
||||
if (Ext.getCmp('idTextareaReasonCasesList').getValue() === '') {
|
||||
Ext.Msg.alert(_('ID_ALERT'), _('ID_THE_REASON_REASSIGN_EMPTY'));
|
||||
return;
|
||||
}
|
||||
PMExt.confirm(_('ID_CONFIRM'), _('ID_REASSIGN_CONFIRM'), function(){
|
||||
var loadMask = new Ext.LoadMask(winReassignInCasesList.getEl(), {msg: _('ID_PROCESSING')});
|
||||
loadMask.show();
|
||||
Ext.Ajax.request({
|
||||
url : 'casesList_Ajax' ,
|
||||
params : {actionAjax : 'reassignCase', USR_UID: rowSelected.data.USR_UID, APP_UID: APP_UID, DEL_INDEX:DEL_INDEX},
|
||||
params : {actionAjax : 'reassignCase', USR_UID: rowSelected.data.USR_UID, APP_UID: APP_UID, DEL_INDEX:DEL_INDEX, NOTE_REASON: Ext.getCmp('idTextareaReasonCasesList').getValue(), NOTIFY_REASSIGN: Ext.getCmp('idCheckboxReasonCasesList').getValue()},
|
||||
success: function ( result, request ) {
|
||||
var data = Ext.util.JSON.decode(result.responseText);
|
||||
if( data.status == 0 ) {
|
||||
@@ -1661,13 +1685,30 @@ Ext.onReady ( function() {
|
||||
singleSelect: true
|
||||
});
|
||||
|
||||
var textareaReason = new Ext.form.TextArea({
|
||||
id: 'idTextareaReasonCasesList',
|
||||
disabled: true,
|
||||
fieldLabel : _('ID_REASON_REASSIGN'),
|
||||
emptyText: _('ID_REASON_REASSIGN') + '...',
|
||||
enableKeyEvents: true,
|
||||
width: 200
|
||||
});
|
||||
|
||||
var checkboxReason = new Ext.form.Checkbox({
|
||||
id: 'idCheckboxReasonCasesList',
|
||||
disabled: true,
|
||||
fieldLabel : _('ID_NOTIFY_USERS_CASE'),
|
||||
labelSeparator: '',
|
||||
labelStyle: 'margin-left:150px;position:absolute;'
|
||||
});
|
||||
|
||||
var grdpnlUsersToReassign = new Ext.grid.GridPanel({
|
||||
id: "grdpnlUsersToReassign",
|
||||
|
||||
store: storeUsersToReassign,
|
||||
colModel: cmodelUsersToReassign,
|
||||
selModel: smodelUsersToReassign,
|
||||
|
||||
height: 200,
|
||||
columnLines: true,
|
||||
viewConfig: {forceFit: true},
|
||||
enableColumnResize: true,
|
||||
@@ -1721,18 +1762,35 @@ Ext.onReady ( function() {
|
||||
],
|
||||
bbar: pagingUsersToReassign,
|
||||
|
||||
title: ""
|
||||
title: "",
|
||||
listeners: {
|
||||
click: function () {
|
||||
textareaReason.enable();
|
||||
checkboxReason.enable();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
winReassignInCasesList = new Ext.Window({
|
||||
title: '',
|
||||
width: 450,
|
||||
height: 350,
|
||||
layout:'fit',
|
||||
layout:'auto',
|
||||
autoScroll:true,
|
||||
modal: true,
|
||||
resizable: false,
|
||||
maximizable: false,
|
||||
items: [grdpnlUsersToReassign]
|
||||
items: [{
|
||||
xtype: 'fieldset',
|
||||
labelWidth: 130,
|
||||
border: false,
|
||||
items: [
|
||||
textareaReason,
|
||||
checkboxReason
|
||||
]
|
||||
},
|
||||
grdpnlUsersToReassign
|
||||
]
|
||||
});
|
||||
|
||||
winReassignInCasesList.show();
|
||||
@@ -2171,49 +2229,57 @@ Ext.onReady ( function() {
|
||||
if (rs.length < storeReassignCases.totalLength) {
|
||||
Ext.Msg.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_TO_REASSIGN'), function (btn, text) {
|
||||
if (btn == 'yes') {
|
||||
if (!isValidNoteReason(rs)) {
|
||||
return;
|
||||
}
|
||||
ExecReassign();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if (!isValidNoteReason(rs)) {
|
||||
return;
|
||||
}
|
||||
ExecReassign();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function isValidNoteReason(data) {
|
||||
var row, sw = true;
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
row = data[i].data;
|
||||
if (!(row.APP_REASSIGN_USER_UID !== '' && row.NOTE_REASON !== undefined && row.NOTE_REASON !== '')) {
|
||||
sw = false;
|
||||
}
|
||||
}
|
||||
if (!sw) {
|
||||
Ext.Msg.alert(_('ID_ALERT'), _('ID_THE_REASON_REASSIGN_USER_EMPTY'));
|
||||
}
|
||||
return sw;
|
||||
}
|
||||
|
||||
var gridForm = new Ext.FormPanel({
|
||||
id: 'reassign-form',
|
||||
frame: true,
|
||||
border: true,
|
||||
labelAlign: 'left',
|
||||
//title: 'Company data',
|
||||
bodyStyle:'padding:5px',
|
||||
width: 750,
|
||||
|
||||
|
||||
layout: 'column', // Specifies that the items will now be arranged in columns
|
||||
width: 736,
|
||||
items: [{
|
||||
id: 'tasksGrid',
|
||||
columnWidth: 0.60,
|
||||
layout: 'fit',
|
||||
items: {
|
||||
id: 'TasksToReassign',
|
||||
xtype: 'grid',
|
||||
xtype: 'editorgrid',
|
||||
ds: storeReassignCases,
|
||||
cm: reassignCm,
|
||||
sm: new Ext.grid.RowSelectionModel({
|
||||
singleSelect: true
|
||||
/*listeners: {
|
||||
rowselect: function(sm, row, rec) {
|
||||
Ext.getCmp("reassign-form").getForm().loadRecord(rec);
|
||||
}
|
||||
}*/
|
||||
}),
|
||||
//autoExpandColumn: 'company',
|
||||
height: 265,
|
||||
height: 278,
|
||||
title: _('ID_CASES_TO_REASSIGN_TASK_LIST'),
|
||||
border: true,
|
||||
|
||||
listeners: {
|
||||
|
||||
click: function () {
|
||||
rows = this.getSelectionModel().getSelections();
|
||||
var application = '';
|
||||
@@ -2223,54 +2289,26 @@ Ext.onReady ( function() {
|
||||
if (rows.length > 0) {
|
||||
comboUsersToReassign.enable();
|
||||
var ids = '';
|
||||
for(i=0; i<rows.length; i++) {
|
||||
for (var i = 0; i < rows.length; i++) {
|
||||
// filtering duplicate tasks
|
||||
application = rows[i].get('APP_UID');
|
||||
task = rows[i].get('TAS_UID');
|
||||
currentUser = rows[i].get('USR_UID');
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
comboUsersToReassign.clearValue();
|
||||
storeUsersToReassign.removeAll();
|
||||
storeUsersToReassign.setBaseParam('application', application);
|
||||
storeUsersToReassign.setBaseParam('task', task);
|
||||
storeUsersToReassign.setBaseParam('currentUser', currentUser);
|
||||
|
||||
storeUsersToReassign.load();
|
||||
//alert(record.USERS);
|
||||
} // Allow rows to be rendered.
|
||||
|
||||
}
|
||||
}
|
||||
},{
|
||||
columnWidth: 0.4,
|
||||
xtype: 'fieldset',
|
||||
labelWidth: 50,
|
||||
title: _('ID_USER_LIST'),
|
||||
defaults: {width: 200, border:false}, // Default config options for child items
|
||||
defaultType: 'textfield',
|
||||
autoHeight: true,
|
||||
bodyStyle: Ext.isIE ? 'text-align: left;padding:0 0 5px 15px;' : 'text-align: left; padding:10px 5px;',
|
||||
border: false,
|
||||
//style: {
|
||||
// "margin-left": "10px", // when you add custom margin in IE 6...
|
||||
// "margin-right": Ext.isIE6 ? (Ext.isStrict ? "-10px" : "-13px") : "0" // you have to adjust for it somewhere else
|
||||
//},
|
||||
items:
|
||||
[
|
||||
comboUsersToReassign,
|
||||
{
|
||||
xtype: 'fieldset',
|
||||
border : true,
|
||||
defaultType: 'textfield',
|
||||
title: _('ID_INSTRUCTIONS'),
|
||||
autoHeight:true,
|
||||
html: _('ID_INSTRUCTIONS_TEXT')
|
||||
}
|
||||
]
|
||||
}]
|
||||
//renderTo: bd
|
||||
});
|
||||
|
||||
@@ -2603,4 +2641,3 @@ Ext.EventManager.on(window, 'beforeunload', function () {
|
||||
casesNewTab.close();
|
||||
}
|
||||
});
|
||||
| ||||