From deb711d8fce0bb2b48ced67e9835236cd6253720 Mon Sep 17 00:00:00 2001 From: "Paula V. Quispe" Date: Mon, 11 Apr 2016 15:10:09 -0400 Subject: [PATCH] HOR-736 HOR-736 --- workflow/engine/classes/class.case.php | 24 ++++ .../translations/english/processmaker.en.po | 6 + workflow/engine/data/mssql/insert.sql | 4 +- workflow/engine/data/mysql/insert.sql | 1 + workflow/engine/templates/cases/open.js | 136 +++++++++--------- 5 files changed, 100 insertions(+), 71 deletions(-) diff --git a/workflow/engine/classes/class.case.php b/workflow/engine/classes/class.case.php index d22e01652..b52037cc9 100755 --- a/workflow/engine/classes/class.case.php +++ b/workflow/engine/classes/class.case.php @@ -4108,6 +4108,25 @@ class Cases return $c; } + /* + * Review is an unassigned Case + * + * @name isUnassignedPauseCase + * @param string $sAppUid + * @param string $iDelegation + * @return boolean + */ + public static function isUnassignedPauseCase($sAppUid, $iDelegation){ + $oAppDelegation = new AppDelegation(); + $aFieldsDel = $oAppDelegation->Load($sAppUid, $iDelegation); + $usrUid = $aFieldsDel['USR_UID']; + if($usrUid === ''){ + return true; + } else { + return false; + } + } + /* * pause a Case * @@ -4121,6 +4140,11 @@ class Cases public function pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate = null) { + // Check if the case is unassigned + if($this->isUnassignedPauseCase($sApplicationUID, $iDelegation)){ + throw new Exception( G::LoadTranslation("ID_CASE_NOT_PAUSED", array(G::LoadTranslation("ID_UNASSIGNED_STATUS"))) ); + } + $oApplication = new Application(); $aFields = $oApplication->Load($sApplicationUID); //get the appthread row id ( APP_THREAD_INDEX' ) diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 7168e7357..98445aa1b 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -3973,6 +3973,12 @@ msgstr "No fields found!" msgid "Unassigned" msgstr "Unassigned" +# TRANSLATION +# LABEL/ID_UNASSIGNED_STATUS +#: LABEL/ID_UNASSIGNED_STATUS +msgid "Unassigned Status" +msgstr "Unassigned Status" + # TRANSLATION # LABEL/ID_CLAIM #: LABEL/ID_CLAIM diff --git a/workflow/engine/data/mssql/insert.sql b/workflow/engine/data/mssql/insert.sql index 700d16e8f..4d1c8a24f 100755 --- a/workflow/engine/data/mssql/insert.sql +++ b/workflow/engine/data/mssql/insert.sql @@ -2738,12 +2738,14 @@ SELECT 'LABEL','ID_SELECT_FILE_PMT_IMPORT','en','Please select a .pmt file','201 UNION ALL SELECT 'LABEL','ID_SELECT_FILE_PM_IMPORT','en','Please select a .pm file','2014-01-15' UNION ALL -SELECT 'LABEL','ID_PLEASE_SELECT_PLUGIN','en','Please select the plugin','2014-01-15' +SELECT 'LABEL','ID_PLEASE_SELECT_PLUGIN','en','Please select the plugin','2014-01-15' UNION ALL SELECT 'LABEL','ID_NO_FIELD_FOUND','en','No fields found!','2014-01-15' UNION ALL SELECT 'LABEL','ID_UNASSIGNED','en','Unassigned','2014-01-15' UNION ALL +SELECT 'LABEL','ID_UNASSIGNED_STATUS','en','Unassigned Status','2016-04-11' + UNION ALL SELECT 'LABEL','ID_CLAIM','en','Claim','2014-01-15' UNION ALL SELECT 'LABEL','ID_TABLE_INVALID_SYNTAX','en','Invalid syntax','2014-01-15' diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index 27a10fbea..249749d4d 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -2086,6 +2086,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_PLEASE_SELECT_PLUGIN','en','Please select the plugin','2014-01-15') , ( 'LABEL','ID_NO_FIELD_FOUND','en','No fields found!','2014-01-15') , ( 'LABEL','ID_UNASSIGNED','en','Unassigned','2014-01-15') , +( 'LABEL','ID_UNASSIGNED_STATUS','en','Unassigned Status','2016-04-11') , ( 'LABEL','ID_CLAIM','en','Claim','2014-01-15') , ( 'LABEL','ID_TABLE_INVALID_SYNTAX','en','Invalid syntax','2014-01-15') , ( 'LABEL','ID_NO_PERMISSION_NO_PARTICIPATED','en','You do not have permission to see this case or you have not participated in it.','2014-01-15') , diff --git a/workflow/engine/templates/cases/open.js b/workflow/engine/templates/cases/open.js index 17897a44c..c2c73e959 100755 --- a/workflow/engine/templates/cases/open.js +++ b/workflow/engine/templates/cases/open.js @@ -1315,80 +1315,76 @@ Ext.onReady(function(){ Actions.pauseCase = function() { Ext.Ajax.request({ - url : 'ajaxListener' , - params : {action : 'verifySession'}, - success: function ( result, request ) { + url : 'ajaxListener' , + params : {action : 'verifySession'}, + success: function ( result, request ) { var data = Ext.util.JSON.decode(result.responseText); if( data.lostSession ) { - Ext.Msg.show({ - title: _('ID_ERROR'), - msg: data.message, - animEl: 'elId', - icon: Ext.MessageBox.ERROR, - buttons: Ext.MessageBox.OK, - fn : function(btn) { - try - { - prnt = parent.parent; - top.location = top.location; - } - catch (err) - { - parent.location = parent.location; - } - } - }); + Ext.Msg.show({ + title: _('ID_ERROR'), + msg: data.message, + animEl: 'elId', + icon: Ext.MessageBox.ERROR, + buttons: Ext.MessageBox.OK, + fn : function(btn) { + try{ + prnt = parent.parent; + top.location = top.location; + } catch (err){ + parent.location = parent.location; + } + } + }); } else { - 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; + 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 == '') { + return; + } else { + unpauseDate = unpauseDate.format('Y-m-d'); + } - var unpauseDate = Ext.getCmp('unpauseDate').getValue(); - if( unpauseDate == '') { - //Ext.getCmp('submitPauseCase').setDisabled(true); - return; - } else - //Ext.getCmp('submitPauseCase').enable(); - - unpauseDate = unpauseDate.format('Y-m-d'); - - Ext.getCmp('unpauseFrm').getForm().submit({ - waitTitle : " ", - url:'ajaxListener', - method : 'post', - params : { - action: 'pauseCase', - unpauseDate:unpauseDate, - NOTE_REASON: noteReasonTxt, - NOTIFY_PAUSE: notifyReasonVal - }, - waitMsg:'Pausing Case '+stringReplace("\\: ", "", _APP_NUM)+'...', - timeout : 36000, - success : function(res, req) { - if(req.result.success) { - try { - parent.notify('PAUSE CASE', req.result.msg); - } - catch (e) { - } - location.href = urlToRedirectAfterPause; - } else { - PMExt.error(_('ID_ERROR'), req.result.msg); - } - } - }); - } - }, - failure: function ( result, request) { - if (typeof(result.responseText) != 'undefined') { - Ext.MessageBox.alert( _('ID_FAILED'), result.responseText); - } - } - }); + Ext.getCmp('unpauseFrm').getForm().submit({ + waitTitle : " ", + url:'ajaxListener', + method : 'post', + params : { + action: 'pauseCase', + unpauseDate:unpauseDate, + NOTE_REASON: noteReasonTxt, + NOTIFY_PAUSE: notifyReasonVal + }, + waitMsg:'Pausing Case '+stringReplace("\\: ", "", _APP_NUM)+'...', + timeout : 36000, + success : function(res, req) { + if(req.result.success) { + try { + parent.notify('PAUSE CASE', req.result.msg); + }catch (e) { + } + location.href = urlToRedirectAfterPause; + } else { + PMExt.error(_('ID_ERROR'), req.result.msg); + } + }, + failure: function ( res, req) { + PMExt.error(_('ID_ERROR'), req.result.msg); + } + }); + } + }, + failure: function ( result, request) { + if (typeof(result.responseText) != 'undefined') { + Ext.MessageBox.alert( _('ID_FAILED'), result.responseText); + } + } + }); } Actions.unpauseCase = function()