BUG 4763 Add notes when pause or cancel case SOLVED

- I add field textarea for comment the pause or cancel
- I add field checkbox for notify to case users the pause or cancel
This commit is contained in:
Brayan Osmar Pereyra Suxo
2012-07-25 16:54:54 -04:00
parent fbdf3b1eec
commit c921867292
4 changed files with 218 additions and 53 deletions

View File

@@ -440,6 +440,15 @@ class Ajax
$DEL_INDEX = $_SESSION['INDEX']; $DEL_INDEX = $_SESSION['INDEX'];
} }
// Save the note pause reason
if ($_POST['NOTE_REASON'] != '') {
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$noteContent = addslashes($_POST['NOTE_REASON']);
$appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']);
}
// End save
if( $multiple ) { if( $multiple ) {
foreach($appUids as $i=>$appUid) foreach($appUids as $i=>$appUid)
$oCase->cancelCase($appUid, $delIndexes[$i], $_SESSION['USER_LOGGED']); $oCase->cancelCase($appUid, $delIndexes[$i], $_SESSION['USER_LOGGED']);
@@ -497,6 +506,15 @@ class Ajax
$DEL_INDEX = $_SESSION['INDEX']; $DEL_INDEX = $_SESSION['INDEX'];
} }
// Save the note pause reason
if ($_REQUEST['NOTE_REASON'] != '') {
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$noteContent = addslashes($_REQUEST['NOTE_REASON']);
$appNotes->postNewNote($APP_UID, $_SESSION['USER_LOGGED'], $noteContent, $_REQUEST['NOTIFY_PAUSE']);
}
// End save
$oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate); $oCase->pauseCase($APP_UID, $DEL_INDEX, $_SESSION['USER_LOGGED'], $unpauseDate);
$app = new Application(); $app = new Application();
$caseData = $app->load($APP_UID); $caseData = $app->load($APP_UID);

View File

@@ -401,6 +401,15 @@ switch (($_POST['action'])?$_POST['action']:$_REQUEST['action']) {
G::RenderPage('publish', 'raw'); G::RenderPage('publish', 'raw');
break; break;
case 'pauseCase': case 'pauseCase':
// Save the note pause reason
if ($_POST['NOTE_REASON'] != '') {
require_once ( "classes/model/AppNotes.php" );
$appNotes = new AppNotes();
$noteContent = addslashes($_POST['NOTE_REASON']);
$result = $appNotes->postNewNote($_POST['APP_UID'], $_SESSION['USER_LOGGED'], $noteContent, $_POST['NOTIFY_PAUSE']);
}
// End save
$unpauseDate = $_POST['unpausedate']; $unpauseDate = $_POST['unpausedate'];
$oCase = new Cases(); $oCase = new Cases();
if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) { if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {

View File

@@ -177,38 +177,100 @@ function deleteCase() {
function pauseCase(date){ function pauseCase(date){
rowModel = grid.getSelectionModel().getSelected(); rowModel = grid.getSelectionModel().getSelected();
unpauseDate = date.format('Y-m-d');
Ext.Msg.confirm( if(rowModel) {
_('ID_CONFIRM'), unpauseDate = date.format('Y-m-d');
_('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'?', var msgPause = new Ext.Window({
function(btn, text){ //layout:'fit',
if ( btn == 'yes' ) { width:500,
Ext.MessageBox.show({ msg: _('ID_PROCESSING'), wait:true,waitConfig: {interval:200} }); plain: true,
Ext.Ajax.request({ modal: true,
url: 'cases_Ajax', title: _('ID_CONFIRM'),
success: function(response) {
try {
parent.updateCasesView();
}
catch (e) {
// Nothing to do
}
Ext.MessageBox.hide();
try {
parent.updateCasesTree();
}
catch (e) {
// Nothing to do
}
Ext.MessageBox.hide();
},
params: {action:'pauseCase', unpausedate:unpauseDate, APP_UID:rowModel.data.APP_UID, DEL_INDEX: rowModel.data.DEL_INDEX}
});
} items: [
} new Ext.FormPanel({
); labelAlign: 'top',
labelWidth: 75,
border: false,
frame: true,
items: [
{
html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'? </div> <br/>'
},
{
xtype: 'textarea',
id: 'noteReason',
fieldLabel: _('ID_CASE_PAUSE_REASON'),
name: 'noteReason',
width: 450,
height: 50
},
{
id: 'notifyReason',
xtype:'checkbox',
name: 'notifyReason',
hideLabel: true,
boxLabel: _('ID_NOTIFY_USERS_CASE'),
}
],
buttonAlign: 'center',
buttons: [{
text: 'Ok',
handler: function(){
if (Ext.getCmp('noteReason').getValue() != '') {
var noteReasonTxt = _('ID_CASE_PAUSE_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
} else {
var noteReasonTxt = '';
}
var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0;
Ext.MessageBox.show({ msg: _('ID_PROCESSING'), wait:true,waitConfig: {interval:200} });
Ext.Ajax.request({
url: 'cases_Ajax',
success: function(response) {
try {
parent.updateCasesView();
}
catch (e) {
// Nothing to do
}
Ext.MessageBox.hide();
try {
parent.updateCasesTree();
}
catch (e) {
// Nothing to do
}
Ext.MessageBox.hide();
msgPause.close();
},
params: {action:'pauseCase', unpausedate:unpauseDate, APP_UID:rowModel.data.APP_UID, DEL_INDEX: rowModel.data.DEL_INDEX, NOTE_REASON: noteReasonTxt, NOTIFY_PAUSE: notifyReasonVal}
});
}
},{
text: 'Cancel', //COCHATRA
handler: function(){
msgPause.close();
}
}]
})
]
});
msgPause.show(this);
} else {
Ext.Msg.show({
title:'',
msg: _('ID_NO_SELECTION_WARNING'),
buttons: Ext.Msg.INFO,
fn: function(){},
animEl: 'elId',
icon: Ext.MessageBox.INFO,
buttons: Ext.MessageBox.OK
});
}
} }

View File

@@ -465,23 +465,77 @@ Ext.onReady(function(){
Actions.cancelCase = function() Actions.cancelCase = function()
{ {
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_CANCEL_CASE'), function(){ var msgCancel = new Ext.Window({
Ext.Ajax.request({ width:500,
url : 'ajaxListener' , plain: true,
params : {action : 'cancelCase'}, modal: true,
success: function ( result, request ) { title: _('ID_CONFIRM'),
try { items: [
parent.notify('', 'The case ' + parent._CASE_TITLE + ' was cancelled!'); new Ext.FormPanel({
} labelAlign: 'top',
catch (e) { labelWidth: 75,
} border: false,
location.href = 'casesListExtJs'; frame: true,
}, items: [
failure: function ( result, request) { {
Ext.MessageBox.alert('Failed', result.responseText); html: '<div align="center" style="font: 14px tahoma,arial,helvetica,sans-serif">' + _('ID_CONFIRM_CANCEL_CASE')+'? </div> <br/>'
} },
}); {
xtype: 'textarea',
id: 'noteReason',
fieldLabel: _('ID_CASE_CANCEL_REASON'),
name: 'noteReason',
width: 450,
height: 50
},
{
id: 'notifyReason',
xtype:'checkbox',
name: 'notifyReason',
hideLabel: true,
boxLabel: _('ID_NOTIFY_USERS_CASE'),
}
],
buttonAlign: 'center',
buttons: [{
text: 'Ok',
handler: function(){
if (Ext.getCmp('noteReason').getValue() != '') {
var noteReasonTxt = _('ID_CASE_CANCEL_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
} else {
var noteReasonTxt = '';
}
var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0;
Ext.MessageBox.show({ msg: _('ID_PROCESSING'), wait:true,waitConfig: {interval:200} });
Ext.Ajax.request({
url : 'ajaxListener' ,
params : {action : 'cancelCase', NOTE_REASON: noteReasonTxt, NOTIFY_PAUSE: notifyReasonVal},
success: function ( result, request ) {
try {
parent.notify('', 'The case ' + parent._CASE_TITLE + ' was cancelled!');
}
catch (e) {
}
location.href = 'casesListExtJs';
},
failure: function ( result, request) {
Ext.MessageBox.alert('Failed', result.responseText);
}
});
}
},{
text: 'Cancel',
handler: function(){
msgCancel.close();
}
}]
})
]
}); });
msgCancel.show(this);
} }
Actions.getUsersToReassign = function() Actions.getUsersToReassign = function()
@@ -602,7 +656,8 @@ Ext.onReady(function(){
var fieldset = { var fieldset = {
xtype : 'fieldset', xtype : 'fieldset',
autoHeight : true, labelWidth: 150,
//autoHeight : true,
defaults : { defaults : {
width : 170, width : 170,
xtype:'label', xtype:'label',
@@ -620,7 +675,21 @@ Ext.onReady(function(){
allowBlank: false, allowBlank: false,
value: filterDate, value: filterDate,
minValue: filterDate minValue: filterDate
}) }),
{
xtype: 'textarea',
id: 'noteReason',
fieldLabel: _('ID_CASE_PAUSE_REASON'),
name: 'noteReason',
width: 170,
height: 50
},
{
id: 'notifyReason',
xtype:'checkbox',
name: 'notifyReason',
fieldLabel: _('ID_NOTIFY_USERS_CASE'),
}
], ],
buttons : [ buttons : [
{ {
@@ -640,7 +709,7 @@ Ext.onReady(function(){
var frm = new Ext.FormPanel( { var frm = new Ext.FormPanel( {
id: 'unpauseFrm', id: 'unpauseFrm',
labelAlign : 'right', labelAlign : 'right',
bodyStyle : 'padding:5px 5px 0', //bodyStyle : 'padding:5px 5px 0',
width : 250, width : 250,
items : [fieldset] items : [fieldset]
}); });
@@ -648,8 +717,8 @@ Ext.onReady(function(){
var win = new Ext.Window({ var win = new Ext.Window({
title: 'Pause Case', title: 'Pause Case',
width: 340, width: 370,
height: 170, height: 230,
layout:'fit', layout:'fit',
autoScroll:true, autoScroll:true,
modal: true, modal: true,
@@ -661,6 +730,13 @@ Ext.onReady(function(){
Actions.pauseCase = function() Actions.pauseCase = function()
{ {
if (Ext.getCmp('noteReason').getValue() != '') {
var noteReasonTxt = _('ID_CASE_PAUSE_LABEL_NOTE') + ' ' + Ext.getCmp('noteReason').getValue();
} else {
var noteReasonTxt = '';
}
var notifyReasonVal = Ext.getCmp('notifyReason').getValue() == true ? 1 : 0;
var paramsNote = '&NOTE_REASON=' + noteReasonTxt + '&NOTIFY_PAUSE=' + notifyReasonVal;
var unpauseDate = Ext.getCmp('unpauseDate').getValue(); var unpauseDate = Ext.getCmp('unpauseDate').getValue();
if( unpauseDate == '') { if( unpauseDate == '') {
@@ -672,7 +748,7 @@ Ext.onReady(function(){
unpauseDate = unpauseDate.format('Y-m-d'); unpauseDate = unpauseDate.format('Y-m-d');
Ext.getCmp('unpauseFrm').getForm().submit({ Ext.getCmp('unpauseFrm').getForm().submit({
url:'ajaxListener?action=pauseCase&unpauseDate=' + unpauseDate, url:'ajaxListener?action=pauseCase&unpauseDate=' + unpauseDate + paramsNote,
waitMsg:'Pausing Case '+parent._CASE_TITLE+'...', waitMsg:'Pausing Case '+parent._CASE_TITLE+'...',
timeout : 36000, timeout : 36000,
success : function(res, req) { success : function(res, req) {