diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index 42f2f3636..72be39056 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -19,10 +19,10 @@ class AppProxy extends HttpProxyController { require_once ( "classes/model/AppNotes.php" ); $appUid = null; - + if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; - } + } else { if (isset($_SESSION['APPLICATION'])) { $appUid = $_SESSION['APPLICATION']; @@ -36,7 +36,7 @@ class AppProxy extends HttpProxyController $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; $appNotes = new AppNotes(); $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); - + return $response['array']; } @@ -45,16 +45,16 @@ class AppProxy extends HttpProxyController * @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION']) * @return array containg the case notes */ - function postNote($httpData) + function postNote($httpData) { //extract(getExtJSParams()); if (isset($httpData->appUid) && trim($httpData->appUid) != "") { $appUid = $httpData->appUid; - } + } else { $appUid = $_SESSION['APPLICATION']; } - + if (!isset($appUid)) { throw new Exception('Can\'t resolve the Apllication ID for this request.'); } @@ -67,10 +67,10 @@ class AppProxy extends HttpProxyController $result = $appNotes->postNewNote($appUid, $usrUid, $noteContent, false); - // Disabling the controller response because we handle a special behavior + //Disabling the controller response because we handle a special behavior $this->setSendResponse(false); - //send the response to client + //Send the response to client @ini_set('implicit_flush', 1); ob_start(); echo G::json_encode($result); @@ -79,26 +79,31 @@ class AppProxy extends HttpProxyController @ob_end_flush(); ob_implicit_flush(1); - //send notification in background - $noteRecipientsList = array(); - G::LoadClass('case'); - $oCase = new Cases(); + //Send notification in background + if (intval($httpData->swSendMail) == 1) { + G::LoadClass("case"); - $p = $oCase->getUsersParticipatedInCase($appUid); - foreach($p['array'] as $key => $userParticipated){ - $noteRecipientsList[] = $key; + $oCase = new Cases(); + + $p = $oCase->getUsersParticipatedInCase($appUid); + $noteRecipientsList = array(); + + foreach ($p["array"] as $key => $userParticipated) { + $noteRecipientsList[] = $key; + } + + $noteRecipients = implode(",", $noteRecipientsList); + $noteContent = stripslashes($noteContent); + + $appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients); } - $noteRecipients = implode(",", $noteRecipientsList); - $noteContent = stripslashes($noteContent); - - $appNotes->sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients); } /** * request to open the case summary * @param string $httpData->appUid * @param string $httpData->delIndex - * @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid + * @return object bool $result->succes, string $result->message(is an exception was thrown), string $result->dynUid */ function requestOpenSummary($httpData) { @@ -125,7 +130,7 @@ class AppProxy extends HttpProxyController $applicationFields = $case->loadCase($httpData->appUid, $httpData->delIndex); $process = new Process(); $processData = $process->load($applicationFields['PRO_UID']); - + if (isset($processData['PRO_DYNAFORMS']['PROCESS'])) { $this->dynUid = $processData['PRO_DYNAFORMS']['PROCESS']; } @@ -141,7 +146,7 @@ class AppProxy extends HttpProxyController /** * get the case summary data - * @param string $httpData->appUid + * @param string $httpData->appUid * @param string $httpData->delIndex * @return array containg the case summary data */ @@ -186,7 +191,7 @@ class AppProxy extends HttpProxyController // note added by krlos pacha carlos[at]colosa[dot]com //getting this field if it doesn't exist. Related 7994 bug $taskData['TAS_TITLE'] = (array_key_exists('TAS_TITLE', $taskData))?$taskData['TAS_TITLE']:Content::Load("TAS_TITLE", "", $applicationFields['TAS_UID'], SYS_LANG); - + $data[] = array('label'=>$labels['TAS_TITLE'] , 'value' => $taskData['TAS_TITLE'], 'section'=>$labels['TITLE2']); $data[] = array('label'=>$labels['CURRENT_USER'] , 'value' => $currentUser, 'section'=>$labels['TITLE2']); $data[] = array('label'=>$labels['DEL_DELEGATE_DATE'] , 'value' => $applicationFields['DEL_DELEGATE_DATE'],'section'=>$labels['TITLE2']); @@ -199,3 +204,4 @@ class AppProxy extends HttpProxyController } } + diff --git a/workflow/engine/templates/app/main.js b/workflow/engine/templates/app/main.js index 41b0f1ad0..4eae22080 100644 --- a/workflow/engine/templates/app/main.js +++ b/workflow/engine/templates/app/main.js @@ -5,6 +5,8 @@ var appUid; var title; var summaryWindowOpened = false; +var toolTipChkSendMail; + function closeCaseNotesWindow(){ if(Ext.get("caseNotesWindowPanel")){ Ext.get("caseNotesWindowPanel").destroy(); @@ -119,7 +121,7 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle) caseNotesWindow = new Ext.Window({ title: _('ID_CASES_NOTES'), //Title of the Window id: 'caseNotesWindowPanel', //ID of the Window Panel - width:300, //Width of the Window + width: 350, //Width of the Window resizable: true, //Resize of the Window, if false - it cannot be resized closable: true, //Hide close button of the Window modal: modalSw, //When modal:true it make the window modal and mask everything behind it when displayed @@ -153,7 +155,7 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle) xtype : 'textarea', id : 'caseNoteText', name : 'caseNoteText', - width : 280, + width : 330, grow : true, height : 40, growMin: 40, @@ -171,6 +173,13 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle) ], rowtbar: [ [ + { + xtype: "checkbox", + id: "chkSendMail", + name: "chkSendMail", + checked: true, + boxLabel: _("ID_CASE_NOTES_LABEL_SEND") + }, '->', '500', ' ', @@ -220,6 +229,14 @@ function openCaseNotesWindow(appUid1, modalSw, appTitle) } }); + toolTipChkSendMail = new Ext.ToolTip({ + dismissDelay: 3000, //auto hide after 3 seconds + title: _("ID_CASE_NOTES_HINT_SEND"), + //html "", + //text: "", + width: 200 + }); + newNoteAreaActive = false; caseNotesWindow.show(); newNoteHandler(); @@ -253,17 +270,21 @@ function newNoteHandler() Ext.getCmp('addCancelBtn').setIcon('/images/comment_add.gif'); caseNotesWindow.getTopToolbar().hide(); - Ext.getCmp('sendBtn').hide(); + Ext.getCmp("chkSendMail").hide(); + Ext.getCmp("sendBtn").hide(); document.getElementById('countChar').style.display = 'none'; caseNotesWindow.doLayout(); } else { + toolTipChkSendMail.initTarget("chkSendMail"); + Ext.getCmp('addCancelBtn').setText(''); Ext.getCmp('addCancelBtn').setTooltip({title: _('ID_CASES_NOTES_CANCEL')}); Ext.getCmp('addCancelBtn').setIcon('/images/cancel.png'); caseNotesWindow.getTopToolbar().show(); - Ext.getCmp('sendBtn').show(); + Ext.getCmp("chkSendMail").show(); + Ext.getCmp("sendBtn").show(); document.getElementById('countChar').style.display = 'block'; Ext.getCmp('caseNoteText').focus(); Ext.getCmp('caseNoteText').reset(); @@ -290,8 +311,9 @@ function sendNote() Ext.Ajax.request({ url : '../appProxy/postNote' , params : { - appUid : appUid, - noteText: noteText + appUid: appUid, + noteText: noteText, + swSendMail: (Ext.getCmp("chkSendMail").checked == true)? 1 : 0 }, success: function ( result, request ) { var data = Ext.util.JSON.decode(result.responseText); @@ -427,7 +449,7 @@ var openSummaryWindow = function(appUid, delIndex) summaryWindowOpened = false; }, failure: function (result, request) { - summaryWindowOpened = false; + summaryWindowOpened = false; } }); } @@ -463,3 +485,4 @@ Ext.Panel.prototype.onRender = function(ct, position) { } } } +