From 846bf611ea8f278055bc0b6dc9536feae08ff1b3 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Tue, 11 Sep 2012 14:01:20 -0400 Subject: [PATCH 01/24] BUG 8069 PagedTable for HOME>>DOCUMENTS got ISSUES SOLVED - The same document can be uploaded more than once even if the option overwrite is checked. - Was add this functionality. --- .../methods/appFolder/appFolderAjax.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/workflow/engine/methods/appFolder/appFolderAjax.php b/workflow/engine/methods/appFolder/appFolderAjax.php index 77dec527b..27106931c 100755 --- a/workflow/engine/methods/appFolder/appFolderAjax.php +++ b/workflow/engine/methods/appFolder/appFolderAjax.php @@ -909,12 +909,28 @@ function documentVersionHistory() G::RenderPage ('publish', 'raw'); } +function overwriteFile ($node, $fileName) { + global $RBAC; + require_once ("classes/model/AppFolder.php"); + include_once ("classes/model/AppDocument.php"); + $appDocument = new AppDocument (); + $pMFolder = new AppFolder (); + $user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED']; + $folderContentObj = $pMFolder->getFolderContent ($node, array(), null, null, '', '', $user); + foreach ($folderContentObj['documents'] as $key => $value) { + if ($folderContentObj['documents'][$key]['APP_DOC_FILENAME'] == $fileName) { + $appDocument->remove(trim($folderContentObj['documents'][$key]['APP_DOC_UID']), $folderContentObj['documents'][$key]['DOC_VERSION']); + } + } +} + function uploadExternalDocument() { $response['action']=$_POST['action']. " - ".$_POST['option']; $response['error']="error"; $response['message']="error"; $response['success']=false; + $overwrite = (isset($_REQUEST['overwrite_files']))? $_REQUEST['overwrite_files'] : false; if (isset($_POST["confirm"]) && $_POST["confirm"]=="true") { //G::pr($_FILES); if (isset($_FILES['uploadedFile'])) { @@ -923,6 +939,12 @@ function uploadExternalDocument() $sw_error_exists=isset($_FILES['uploadedFile']['error']); $emptyInstances=0; $quequeUpload=array(); + //overwrite files + if ($overwrite) { + for ($i=0; $i<$uploadedInstances; $i++) { + overwriteFile($_REQUEST['dir'], stripslashes($_FILES['uploadedFile']['name'][$i])); + } + } // upload files & check for errors for ($i=0; $i<$uploadedInstances; $i++) { $errors[$i] = null; From 90d465811aa082214d3d4f7f51abb085da9f65fa Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Tue, 11 Sep 2012 17:12:45 -0400 Subject: [PATCH 02/24] BUG 8069 PagedTable for HOME>>DOCUMENTS got ISSUES SOLVED - The same document can be uploaded more than once even if the option overwrite is checked. - Was add this functionality. --- workflow/engine/methods/appFolder/appFolderAjax.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/workflow/engine/methods/appFolder/appFolderAjax.php b/workflow/engine/methods/appFolder/appFolderAjax.php index 27106931c..e0aefa46c 100755 --- a/workflow/engine/methods/appFolder/appFolderAjax.php +++ b/workflow/engine/methods/appFolder/appFolderAjax.php @@ -913,9 +913,9 @@ function overwriteFile ($node, $fileName) { global $RBAC; require_once ("classes/model/AppFolder.php"); include_once ("classes/model/AppDocument.php"); - $appDocument = new AppDocument (); - $pMFolder = new AppFolder (); - $user = ($RBAC->userCanAccess('PM_ALLCASES') == 1)? '' : $_SESSION['USER_LOGGED']; + $appDocument = new AppDocument(); + $pMFolder = new AppFolder(); + $user = ($RBAC->userCanAccess('PM_ALLCASES') == 1) ? '' : $_SESSION['USER_LOGGED']; $folderContentObj = $pMFolder->getFolderContent ($node, array(), null, null, '', '', $user); foreach ($folderContentObj['documents'] as $key => $value) { if ($folderContentObj['documents'][$key]['APP_DOC_FILENAME'] == $fileName) { @@ -930,8 +930,8 @@ function uploadExternalDocument() $response['error']="error"; $response['message']="error"; $response['success']=false; - $overwrite = (isset($_REQUEST['overwrite_files']))? $_REQUEST['overwrite_files'] : false; - if (isset($_POST["confirm"]) && $_POST["confirm"]=="true") { + $overwrite = (isset($_REQUEST['overwrite_files'])) ? $_REQUEST['overwrite_files'] : false; + if (isset($_POST["confirm"]) && $_POST["confirm"] == "true") { //G::pr($_FILES); if (isset($_FILES['uploadedFile'])) { $uploadedInstances=count($_FILES['uploadedFile']['name']); From 4f3003cbf81fc8a0bc2e30b7421f245907282b4e Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Wed, 12 Sep 2012 09:33:18 -0400 Subject: [PATCH 03/24] BUG 8069 PagedTable for HOME>>DOCUMENTS got ISSUES SOLVED - The same document can be uploaded more than once even if the option overwrite is checked. - Was add this functionality. --- workflow/engine/methods/appFolder/appFolderAjax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/methods/appFolder/appFolderAjax.php b/workflow/engine/methods/appFolder/appFolderAjax.php index e0aefa46c..d958040e9 100755 --- a/workflow/engine/methods/appFolder/appFolderAjax.php +++ b/workflow/engine/methods/appFolder/appFolderAjax.php @@ -912,7 +912,7 @@ function documentVersionHistory() function overwriteFile ($node, $fileName) { global $RBAC; require_once ("classes/model/AppFolder.php"); - include_once ("classes/model/AppDocument.php"); + require_once ("classes/model/AppDocument.php"); $appDocument = new AppDocument(); $pMFolder = new AppFolder(); $user = ($RBAC->userCanAccess('PM_ALLCASES') == 1) ? '' : $_SESSION['USER_LOGGED']; From 75043f1a07cdf6feffd636225920d8dc7e00cac0 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Date: Wed, 12 Sep 2012 11:07:07 -0400 Subject: [PATCH 04/24] BUG 9712 User assignment issue SOLVED - According to the specifications. - Was add reload in the same page. --- workflow/engine/templates/groups/groupsMembers.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/workflow/engine/templates/groups/groupsMembers.js b/workflow/engine/templates/groups/groupsMembers.js index 796a71ad5..32553e1f0 100755 --- a/workflow/engine/templates/groups/groupsMembers.js +++ b/workflow/engine/templates/groups/groupsMembers.js @@ -485,7 +485,17 @@ RemoveAllUsersAction = function(){ //Function DoSearch Available DoSearchA = function(){ - availableGrid.store.load({params: {textFilter: searchTextA.getValue()}}); + numPage = parseInt(bbarpagingAvailable.getPageData().activePage); + availableGrid.store.load( + {params: {textFilter: searchTextA.getValue()}, + callback: function (r, options, success) { + total = parseInt(bbarpagingAvailable.getPageData().total); + if (((numPage-1)*pageSize) >= total) { + numPage--; + } + availableGrid.getBottomToolbar().changePage(numPage); + } + }); }; //Function DoSearch Assigned From 3fc87194725c09d65df58fceab2c903c56d98ba3 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Wed, 12 Sep 2012 14:46:26 -0400 Subject: [PATCH 05/24] BUG 5494 "Request for a web service function to cancel..." SOLVED - New feature - Web Services for pause and unpause case - Added functions "PMFPauseCase, PMFUnpauseCase, WSPauseCase, WSUnpauseCase" in "class.pmFunctions.php" - Added function "pauseCase, unpauseCase" in "class.wsBase.php" - Added functionality for applications using Web Services - Cancel case it's solved in bug 7385 - Function "pauseCase" from "class.pmFunctions.php" has changed its name to "PMFPauseCase" * Available from version 2.0.44 --- workflow/engine/classes/class.pmFunctions.php | 171 ++++++++++++++---- workflow/engine/classes/class.wsBase.php | 106 +++++++++++ workflow/engine/methods/services/pmos2.wsdl | 77 ++++++++ workflow/engine/methods/services/soap2.php | 48 +++++ 4 files changed, 366 insertions(+), 36 deletions(-) diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 14fdd35cc..dd2b7e8d8 100755 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -216,42 +216,6 @@ function literalDate($date, $lang='en') throw $oException; } } -/** - * @method - * - * Pauses a specified case. - * - * @name pauseCase - * @label Pause Case - * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#pauseCase.28.29 - * - * @param string(32) | $sApplicationUID= "" | ID of the case | The unique ID of the case. The UID of the current case can be found in the system variable @@APPLICATION. - * @param string(32) | $iDelegation = 0| Delegation index of the case | The delegation index of the current task in the case. - * @param string(32) | $sUserUID = ""| ID user | The unique ID of the user who will pause the case. - * @param string(32) | $sUnpauseDate = null | Date | Optional parameter. The date in the format 'yyyy-mm-dd' indicating when to unpause the case. - * @return None | $none | None | None - * - */ -function pauseCase($sApplicationUID='', $iDelegation=0, $sUserUID='', $sUnpauseDate=null) -{ - //var_dump($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate);die(':|'); - try { - if ($sApplicationUID == '') { - throw new Exception('The application UID cannot be empty!'); - } - if ($iDelegation == 0) { - throw new Exception('The delegation index cannot be 0!'); - } - if ($sUserUID == '') { - throw new Exception('The user UID cannot be empty!'); - } - G::LoadClass('case'); - $oCase = new Cases(); - $oCase->pauseCase($sApplicationUID, $iDelegation, $sUserUID, $sUnpauseDate); - } catch (Exception $oException) { - throw $oException; - } -} /** * @method * @@ -1232,6 +1196,84 @@ function WSCancelCase($caseUid, $delIndex, $userUid) return $response; } +/** + * @method + * + * Pauses a specified case. + * + * @name WSPauseCase + * @label WS Pause Case + * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSPauseCase.28.29 + * + * @param string(32) | $caseUid | ID of the case | The unique ID of the case. + * @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case. + * @param string(32) | $userUid | ID user | The unique ID of the user who will pause the case. + * @param string(32) | $unpauseDate=null | Date | Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause the case. + * @return array | $response | WS array | A WS Response associative array. + * + */ +function WSPauseCase($caseUid, $delIndex, $userUid, $unpauseDate=null) +{ + $client = WSOpen(); + + $sessionId = $_SESSION["WS_SESSION_ID"]; + + $params = array( + "sessionId" => $sessionId, + "caseUid" => $caseUid, + "delIndex" => $delIndex, + "userUid" => $userUid, + "unpauseDate" => $unpauseDate + ); + + $result = $client->__soapCall("pauseCase", array($params)); + + $response = array(); + $response["status_code"] = $result->status_code; + $response["message"] = $result->message; + $response["time_stamp"] = $result->timestamp; + + return $response; +} + +/** + * @method + * + * Unpause a specified case. + * + * @name WSUnpauseCase + * @label WS Unpause Case + * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#WSUnpauseCase.28.29 + * + * @param string(32) | $caseUid | ID of the case | The unique ID of the case. + * @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case. + * @param string(32) | $userUid | ID user | The unique ID of the user who will unpause the case. + * @return array | $response | WS array | A WS Response associative array. + * + */ +function WSUnpauseCase($caseUid, $delIndex, $userUid) +{ + $client = WSOpen(); + + $sessionId = $_SESSION["WS_SESSION_ID"]; + + $params = array( + "sessionId" => $sessionId, + "caseUid" => $caseUid, + "delIndex" => $delIndex, + "userUid" => $userUid + ); + + $result = $client->__soapCall("unpauseCase", array($params)); + + $response = array(); + $response["status_code"] = $result->status_code; + $response["message"] = $result->message; + $response["time_stamp"] = $result->timestamp; + + return $response; +} + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** Local Services Functions **/ @@ -2345,3 +2387,60 @@ function PMFCancelCase($caseUid, $delIndex, $userUid) } } +/** + * @method + * + * Pauses a specified case. + * + * @name PMFPauseCase + * @label PMF Pauses a specified case. + * + * @param string(32) | $caseUid | ID of the case | The unique ID of the case. + * @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case. + * @param string(32) | $userUid | ID user | The unique ID of the user who will pause the case. + * @param string(32) | $unpauseDate=null | Date | Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause the case. + * @return int | $result | Result of the pause | Returns 1 if the case is paused successfully; otherwise, returns 0 if an error occurred. + * + */ +function PMFPauseCase($caseUid, $delIndex, $userUid, $unpauseDate=null) +{ + G::LoadClass("wsBase"); + + $ws = new wsBase(); + $result = $ws->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate); + + if ($result->status_code == 0) { + return 1; + } else { + return 0; + } +} + +/** + * @method + * + * Unpause a specified case. + * + * @name PMFUnpauseCase + * @label PMF Unpause a specified case. + * + * @param string(32) | $caseUid | ID of the case | The unique ID of the case. + * @param int | $delIndex | Delegation index of the case | The delegation index of the current task in the case. + * @param string(32) | $userUid | ID user | The unique ID of the user who will unpause the case. + * @return int | $result | Result of the unpause | Returns 1 if the case is unpause successfully; otherwise, returns 0 if an error occurred. + * + */ +function PMFUnpauseCase($caseUid, $delIndex, $userUid) +{ + G::LoadClass("wsBase"); + + $ws = new wsBase(); + $result = $ws->unpauseCase($caseUid, $delIndex, $userUid); + + if ($result->status_code == 0) { + return 1; + } else { + return 0; + } +} + diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 2f6fba4fb..e4b85478e 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -2897,5 +2897,111 @@ class wsBase return $result; } } + + /** + * Pause case + * @param string caseUid : ID of the case. + * @param int delIndex : Delegation index of the case. + * @param string userUid : The unique ID of the user who will pause the case. + * @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause + * the case. + * @return $result will return an object + */ + public function pauseCase($caseUid, $delIndex, $userUid, $unpauseDate=null) + { + try { + if (empty($caseUid)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid"); + + return $result; + } + + if (empty($delIndex)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex"); + + return $result; + } + + if (empty($userUid)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid"); + + return $result; + } + + if (!empty($unpauseDate)) { + if (!preg_match("/^\d{4}-\d{2}-\d{2}$/", $unpauseDate)) { + $result = new wsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate"); + + return $result; + } + } + + $case = new Cases(); + $case->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate); + + //Response + $res = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY")); + + $result = array( + "status_code" => $res->status_code, + "message" => $res->message, + "timestamp" => $res->timestamp + ); + + return $result; + } catch (Exception $e) { + $result = wsResponse(100, $e->getMessage()); + + return $result; + } + } + + /** + * Unpause case + * @param string caseUid : ID of the case. + * @param int delIndex : Delegation index of the case. + * @param string userUid : The unique ID of the user who will unpause the case. + * @return $result will return an object + */ + public function unpauseCase($caseUid, $delIndex, $userUid) + { + try { + if (empty($caseUid)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " caseUid"); + + return $result; + } + + if (empty($delIndex)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " delIndex"); + + return $result; + } + + if (empty($userUid)) { + $result = new wsResponse(100, G::LoadTranslation("ID_REQUIRED_FIELD") . " userUid"); + + return $result; + } + + $case = new Cases(); + $case->unpauseCase($caseUid, $delIndex, $userUid); + + //Response + $res = new wsResponse(0, G::LoadTranslation("ID_COMMAND_EXECUTED_SUCCESSFULLY")); + + $result = array( + "status_code" => $res->status_code, + "message" => $res->message, + "timestamp" => $res->timestamp + ); + + return $result; + } catch (Exception $e) { + $result = wsResponse(100, $e->getMessage()); + + return $result; + } + } } diff --git a/workflow/engine/methods/services/pmos2.wsdl b/workflow/engine/methods/services/pmos2.wsdl index d8c65d08d..7203cb817 100755 --- a/workflow/engine/methods/services/pmos2.wsdl +++ b/workflow/engine/methods/services/pmos2.wsdl @@ -761,6 +761,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -965,6 +1004,18 @@ + + + + + + + + + + + + @@ -1111,6 +1162,14 @@ + + + + + + + + @@ -1439,6 +1498,24 @@ + + + + + + + + + + + + + + + + + + diff --git a/workflow/engine/methods/services/soap2.php b/workflow/engine/methods/services/soap2.php index 6c82eb2c0..153687963 100755 --- a/workflow/engine/methods/services/soap2.php +++ b/workflow/engine/methods/services/soap2.php @@ -1102,6 +1102,52 @@ function cancelCase($params) return $result; } +function pauseCase($params) +{ + $result = isValidSession($params->sessionId); + + if ($result->status_code != 0) { + return $result; + } + + if (ifPermission($params->sessionId, "PM_CASES") == 0) { + $result = new wsResponse(2, "You do not have privileges"); + + return $result; + } + + $ws = new wsBase(); + + $result = $ws->pauseCase( + $params->caseUid, + $params->delIndex, + $params->userUid, + ((isset($params->unpauseDate))? $params->unpauseDate : null) + ); + + return $result; +} + +function unpauseCase($params) +{ + $result = isValidSession($params->sessionId); + + if ($result->status_code != 0) { + return $result; + } + + if (ifPermission($params->sessionId, "PM_CASES") == 0) { + $result = new wsResponse(2, "You do not have privileges"); + + return $result; + } + + $ws = new wsBase(); + $result = $ws->unpauseCase($params->caseUid, $params->delIndex, $params->userUid); + + return $result; +} + @@ -1144,5 +1190,7 @@ $server->addFunction("removeUserFromGroup"); $server->addFunction("getCaseNotes"); $server->addFunction("deleteCase"); $server->addFunction("cancelCase"); +$server->addFunction("pauseCase"); +$server->addFunction("unpauseCase"); $server->handle(); From e37010da7316e79ff79d7283ae8e7499090b2551 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Wed, 12 Sep 2012 16:00:28 -0400 Subject: [PATCH 06/24] Fix conflict with the USR_STATUS identifiers on the ExtJs script --- workflow/engine/templates/users/users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index 68ecf22cf..19205691a 100644 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -343,7 +343,7 @@ Ext.onReady(function () { }); var status = new Ext.data.SimpleStore({ - fields: ["USR_STATUS", "status"], + fields: ["USR_STATUS_VALUE", "status"], data: [["ACTIVE", _("ID_ACTIVE")], ["INACTIVE", _("ID_INACTIVE")], ["VACATION", _("ID_VACATION")]] }); @@ -356,7 +356,7 @@ Ext.onReady(function () { mode : 'local', store : status, displayField : 'status', - valueField : 'USR_STATUS', + valueField : 'USR_STATUS_VALUE', width : 120, typeAhead : true, triggerAction : 'all', From 03c30311551db22a3451eec7485cdd91404fa2d1 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Wed, 12 Sep 2012 17:53:42 -0400 Subject: [PATCH 07/24] Fix conflict with the USR_STATUS (editing profile) identifiers on the ExtJs script --- workflow/engine/templates/users/users.js | 1 + 1 file changed, 1 insertion(+) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index 19205691a..eb1f3c1d0 100644 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -1053,6 +1053,7 @@ function saveUser() var confPass = frmDetails.getForm().findField('USR_CNF_PASS').getValue(); if (confPass === newPass) { + Ext.getCmp('USR_STATUS').setDisabled(readMode); Ext.getCmp('frmDetails').getForm().submit({ url : 'usersAjax', params : { From 12e593a36c91b20902c089d8139a86fc8c1d26d1 Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Wed, 12 Sep 2012 18:47:39 -0400 Subject: [PATCH 08/24] BUG 9759 Problema con los estilos del skin classic desde el plugin SOLVED - The layout was not correct - Little change in the layout to fix the display --- workflow/engine/skinEngine/base/layout.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/workflow/engine/skinEngine/base/layout.html b/workflow/engine/skinEngine/base/layout.html index 42b2faf43..c937d8bf9 100644 --- a/workflow/engine/skinEngine/base/layout.html +++ b/workflow/engine/skinEngine/base/layout.html @@ -19,7 +19,7 @@ {if $user_logged neq ''} {$msgVer} {if $switch_interface} - + {/if} {$logout}