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'];
}
// 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 ) {
foreach($appUids as $i=>$appUid)
$oCase->cancelCase($appUid, $delIndexes[$i], $_SESSION['USER_LOGGED']);
@@ -497,6 +506,15 @@ class Ajax
$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);
$app = new Application();
$caseData = $app->load($APP_UID);

View File

@@ -401,6 +401,15 @@ switch (($_POST['action'])?$_POST['action']:$_REQUEST['action']) {
G::RenderPage('publish', 'raw');
break;
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'];
$oCase = new Cases();
if (isset($_POST['APP_UID']) && isset($_POST['DEL_INDEX'])) {

View File

@@ -177,38 +177,100 @@ function deleteCase() {
function pauseCase(date){
rowModel = grid.getSelectionModel().getSelected();
unpauseDate = date.format('Y-m-d');
Ext.Msg.confirm(
_('ID_CONFIRM'),
_('ID_PAUSE_CASE_TO_DATE') +' '+date.format('M j, Y')+'?',
function(btn, text){
if ( btn == 'yes' ) {
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();
},
params: {action:'pauseCase', unpausedate:unpauseDate, APP_UID:rowModel.data.APP_UID, DEL_INDEX: rowModel.data.DEL_INDEX}
});
if(rowModel) {
unpauseDate = date.format('Y-m-d');
var msgPause = new Ext.Window({
//layout:'fit',
width:500,
plain: true,
modal: true,
title: _('ID_CONFIRM'),
}
}
);
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()
{
PMExt.confirm(_('ID_CONFIRM'), _('ID_CONFIRM_CANCEL_CASE'), function(){
Ext.Ajax.request({
url : 'ajaxListener' ,
params : {action : 'cancelCase'},
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);
}
});
var msgCancel = new Ext.Window({
width:500,
plain: true,
modal: true,
title: _('ID_CONFIRM'),
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_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()
@@ -602,10 +656,11 @@ Ext.onReady(function(){
var fieldset = {
xtype : 'fieldset',
autoHeight : true,
labelWidth: 150,
//autoHeight : true,
defaults : {
width : 170,
xtype:'label',
xtype:'label',
labelStyle : 'padding: 0px;',
style: 'font-weight: bold'
},
@@ -620,7 +675,21 @@ Ext.onReady(function(){
allowBlank: false,
value: 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 : [
{
@@ -640,7 +709,7 @@ Ext.onReady(function(){
var frm = new Ext.FormPanel( {
id: 'unpauseFrm',
labelAlign : 'right',
bodyStyle : 'padding:5px 5px 0',
//bodyStyle : 'padding:5px 5px 0',
width : 250,
items : [fieldset]
});
@@ -648,8 +717,8 @@ Ext.onReady(function(){
var win = new Ext.Window({
title: 'Pause Case',
width: 340,
height: 170,
width: 370,
height: 230,
layout:'fit',
autoScroll:true,
modal: true,
@@ -661,6 +730,13 @@ Ext.onReady(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();
if( unpauseDate == '') {
@@ -672,7 +748,7 @@ Ext.onReady(function(){
unpauseDate = unpauseDate.format('Y-m-d');
Ext.getCmp('unpauseFrm').getForm().submit({
url:'ajaxListener?action=pauseCase&unpauseDate=' + unpauseDate,
url:'ajaxListener?action=pauseCase&unpauseDate=' + unpauseDate + paramsNote,
waitMsg:'Pausing Case '+parent._CASE_TITLE+'...',
timeout : 36000,
success : function(res, req) {