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();