BUG 8984 "PMFNewCaseImpersonate(), WSNewCaseImpersonate() and..." SOLVED
- The PMFNewCaseImpersonate(), WSNewCaseImpersonate() and newCaseImpersonate() web service, do not return the UID and number of the new case like PMFNewCase(), WSNewCase() and newCase() - It improved the code of the PMFNewCaseImpersonate method, for to returns the UID of case, as PMFNewCase - It improved the code of the WSNewCaseImpersonate method, for to returns the UID of case, as WSNewCase - Corrections made in the methods "Simple Trigger Web Services", including the files involved
This commit is contained in:
@@ -386,24 +386,37 @@ function evaluateFunction($aGrid, $sExpresion) {
|
||||
* @return string | $unique ID | Unique Id |The unique ID for the initiated session.
|
||||
*
|
||||
*/
|
||||
function WSLogin($user, $pass, $endpoint='') {
|
||||
$client = wSOpen(true);
|
||||
$params = array('userid'=>$user, 'password'=>$pass);
|
||||
$result = $client->__SoapCall('login', array($params));
|
||||
function WSLogin($user, $pass, $endpoint = "") {
|
||||
$client = WSOpen(true);
|
||||
|
||||
$params = array("userid" => $user, "password" => $pass);
|
||||
|
||||
$result = $client->__soapCall("login", array($params));
|
||||
|
||||
if($result->status_code == 0) {
|
||||
if($endpoint != '') {
|
||||
if(isset($_SESSION['WS_SESSION_ID']))
|
||||
$_SESSION['WS_END_POINT'] = $endpoint;
|
||||
if ($result->status_code == 0) {
|
||||
if ($endpoint != "") {
|
||||
if (isset($_SESSION["WS_SESSION_ID"])) {
|
||||
$_SESSION["WS_END_POINT"] = $endpoint;
|
||||
}
|
||||
}
|
||||
if(isset($_SESSION['WS_SESSION_ID']))
|
||||
return $_SESSION['WS_SESSION_ID'] = $result->message;
|
||||
/*
|
||||
if (isset($_SESSION["WS_SESSION_ID"]))
|
||||
return $_SESSION["WS_SESSION_ID"] = $result->message;
|
||||
else
|
||||
return $result->message;
|
||||
} else {
|
||||
if(isset($_SESSION['WS_SESSION_ID']))
|
||||
unset($_SESSION['WS_SESSION_ID']);
|
||||
$wp = (trim($pass) != "")?'YES':'NO';
|
||||
*/
|
||||
|
||||
$_SESSION["WS_SESSION_ID"] = $result->message;
|
||||
|
||||
return $result->message;
|
||||
}
|
||||
else {
|
||||
if (isset($_SESSION["WS_SESSION_ID"])) {
|
||||
unset($_SESSION["WS_SESSION_ID"]);
|
||||
}
|
||||
|
||||
$wp = (trim($pass) != "")? "YES" : "NO";
|
||||
|
||||
throw new Exception("WSAccess denied! for user $user with password $wp");
|
||||
}
|
||||
}
|
||||
@@ -421,16 +434,20 @@ function WSLogin($user, $pass, $endpoint='') {
|
||||
* @return Object Client | $client | SoapClient object | A SoapClient object. If unable to establish a connection, returns NULL.
|
||||
*
|
||||
*/
|
||||
function WSOpen($force=false) {
|
||||
if(isset($_SESSION['WS_SESSION_ID']) || $force) {
|
||||
if( !isset ($_SESSION['WS_END_POINT']) ) {
|
||||
$defaultEndpoint = 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].'/sys'.SYS_SYS.'/en/green/services/wsdl';
|
||||
function WSOpen($force = false) {
|
||||
if (isset($_SESSION["WS_SESSION_ID"]) || $force) {
|
||||
if (!isset($_SESSION["WS_END_POINT"])) {
|
||||
$defaultEndpoint = "http://" . $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . "/sys" . SYS_SYS . "/en/classic/services/wsdl2";
|
||||
}
|
||||
$endpoint = isset( $_SESSION['WS_END_POINT'] ) ? $_SESSION['WS_END_POINT'] : $defaultEndpoint;
|
||||
$client = new SoapClient( $endpoint );
|
||||
|
||||
$endpoint = isset($_SESSION["WS_END_POINT"])? $_SESSION["WS_END_POINT"] : $defaultEndpoint;
|
||||
|
||||
$client = new SoapClient($endpoint);
|
||||
|
||||
return $client;
|
||||
} else {
|
||||
throw new Exception('WS session is not open');
|
||||
}
|
||||
else {
|
||||
throw new Exception("WS session is not open");
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -449,29 +466,31 @@ function WSOpen($force=false) {
|
||||
function WSTaskCase($caseId) {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
|
||||
$params = array('sessionId'=>$sessionId, 'caseId'=>$caseId);
|
||||
$result = $client->__soapCall('taskCase', array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->taskCases)) {
|
||||
foreach ( $result->taskCases as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId, "caseId" => $caseId);
|
||||
|
||||
$result = $client->__soapCall("taskCase", array($params));
|
||||
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->taskCases)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->taskCases)) {
|
||||
foreach ($result->taskCases as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->taskCases)) {
|
||||
$rows[$i] = array("guid" => $result->taskCases->guid, "name" => $result->taskCases->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -490,28 +509,31 @@ function WSTaskCase($caseId) {
|
||||
function WSTaskList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('TaskList', array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->tasks)) {
|
||||
foreach ( $result->tasks as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("TaskList", array($params));
|
||||
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->tasks)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->tasks)) {
|
||||
foreach ($result->tasks as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->tasks)) {
|
||||
$rows[$i] = array("guid" => $result->tasks->guid, "name" => $result->tasks->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -529,28 +551,31 @@ function WSTaskList() {
|
||||
function WSUserList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('UserList', array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->users)) {
|
||||
foreach ( $result->users as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("UserList", array($params));
|
||||
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->users)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->users)) {
|
||||
foreach ($result->users as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->users)) {
|
||||
$rows[$i] = array("guid" => $result->users->guid, "name" => $result->users->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -568,28 +593,31 @@ function WSUserList() {
|
||||
function WSGroupList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('GroupList', array($params));
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("GroupList", array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->groups)) {
|
||||
foreach ( $result->groups as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->groups)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->groups)) {
|
||||
foreach ($result->groups as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->groups)) {
|
||||
$rows[$i] = array("guid" => $result->groups->guid, "name" => $result->groups->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
@@ -608,27 +636,31 @@ function WSGroupList() {
|
||||
function WSRoleList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('RoleList', array($params));
|
||||
$i = 1;
|
||||
if(isset ($result->roles)) {
|
||||
foreach ( $result->roles as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("RoleList", array($params));
|
||||
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->roles)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->roles)) {
|
||||
foreach ($result->roles as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->roles)) {
|
||||
$rows[$i] = array("guid" => $result->roles->guid, "name" => $result->roles->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -647,29 +679,31 @@ function WSRoleList() {
|
||||
function WSCaseList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('CaseList', array($params));
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("CaseList", array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->cases)) {
|
||||
foreach ( $result->cases as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->cases)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->cases)) {
|
||||
foreach ($result->cases as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->cases)) {
|
||||
$rows[$i] = array("guid" => $result->cases->guid, "name" => $result->cases->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -687,28 +721,31 @@ function WSCaseList() {
|
||||
function WSProcessList() {
|
||||
$client = WSOpen();
|
||||
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId );
|
||||
$result = $client->__SoapCall('ProcessList', array($params));
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId);
|
||||
|
||||
$result = $client->__soapCall("ProcessList", array($params));
|
||||
|
||||
$i = 1;
|
||||
if(isset ($result->processes)) {
|
||||
foreach ( $result->processes as $key=> $item) {
|
||||
if ( isset ($item->item) ) {
|
||||
foreach ( $item->item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
} else {
|
||||
foreach ( $item as $index=> $val ) {
|
||||
if ( $val->key == 'guid' ) $guid = $val->value;
|
||||
if ( $val->key == 'name' ) $name = $val->value;
|
||||
}
|
||||
$rows = array();
|
||||
$i = 0;
|
||||
|
||||
if (isset($result->processes)) {
|
||||
//Processing when it is an array
|
||||
if (is_array($result->processes)) {
|
||||
foreach ($result->processes as $key => $obj) {
|
||||
$rows[$i] = array("guid" => $obj->guid, "name" => $obj->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//Processing when it is an object //1 row
|
||||
if (is_object($result->processes)) {
|
||||
$rows[$i] = array("guid" => $result->processes->guid, "name" => $result->processes->name);
|
||||
$i = $i + 1;
|
||||
}
|
||||
|
||||
$rows[$i++] = array ( 'guid' => $guid, 'name' => $name );
|
||||
}
|
||||
}
|
||||
|
||||
return $rows;
|
||||
}
|
||||
/**
|
||||
@@ -785,18 +822,27 @@ function PMFSendMessage($caseId, $sFrom, $sTo, $sCc, $sBcc, $sSubject, $sTemplat
|
||||
*/
|
||||
function WSSendVariables($caseId, $name1, $value1, $name2, $value2) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$variables[1]->name = $name1;
|
||||
$variables[1]->value = $value1;
|
||||
$variables[2]->name = $name2;
|
||||
$variables[2]->value = $value2;
|
||||
$params = array('sessionId'=>$sessionId, 'caseId'=>$caseId, 'variables'=>$variables);
|
||||
$result = $client->__SoapCall('SendVariables', array($params));
|
||||
$v1 = new stdClass();
|
||||
$v1->name = $name1;
|
||||
$v1->value = $value1;
|
||||
|
||||
$v2 = new stdClass();
|
||||
$v2->name = $name2;
|
||||
$v2->value = $value2;
|
||||
|
||||
$variables = array($v1, $v2);
|
||||
|
||||
$params = array("sessionId" => $sessionId, "caseId" => $caseId, "variables" => $variables);
|
||||
|
||||
$result = $client->__soapCall("SendVariables", array($params));
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -816,14 +862,17 @@ function WSSendVariables($caseId, $name1, $value1, $name2, $value2) {
|
||||
*/
|
||||
function WSDerivateCase($caseId, $delIndex) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$params = array('sessionId'=>$sessionId, 'caseId'=>$caseId, 'delIndex'=>$delIndex );
|
||||
$result = $client->__SoapCall('DerivateCase', array($params));
|
||||
$params = array("sessionId" => $sessionId, "caseId" => $caseId, "delIndex" => $delIndex);
|
||||
|
||||
$result = $client->__soapCall("DerivateCase", array($params));
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -846,19 +895,29 @@ function WSDerivateCase($caseId, $delIndex) {
|
||||
*/
|
||||
function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $value2) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$variables[1]->name = $name1;
|
||||
$variables[1]->value = $value1;
|
||||
$variables[2]->name = $name2;
|
||||
$variables[2]->value = $value2;
|
||||
$v1 = new stdClass();
|
||||
$v1->name = $name1;
|
||||
$v1->value = $value1;
|
||||
|
||||
$v2 = new stdClass();
|
||||
$v2->name = $name2;
|
||||
$v2->value = $value2;
|
||||
|
||||
$variables = array($v1, $v2);
|
||||
|
||||
$params = array('sessionId'=>$sessionId, 'processId'=>$processId, 'userId'=>$userId, 'variables'=>$variables );
|
||||
$result = $client->__SoapCall('NewCaseImpersonate', array($params));
|
||||
$params = array("sessionId" => $sessionId, "processId" => $processId, "userId" => $userId, "variables" => $variables);
|
||||
|
||||
$result = $client->__soapCall("NewCaseImpersonate", array($params));
|
||||
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
$fields["case_id"] = $result->caseId;
|
||||
$fields["case_number"] = $result->caseNumber;
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -882,19 +941,28 @@ function WSNewCaseImpersonate($processId, $userId, $name1, $value1, $name2, $val
|
||||
*/
|
||||
function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$variables[1]->name = $name1;
|
||||
$variables[1]->value = $value1;
|
||||
$variables[2]->name = $name2;
|
||||
$variables[2]->value = $value2;
|
||||
$v1 = new stdClass();
|
||||
$v1->name = $name1;
|
||||
$v1->value = $value1;
|
||||
|
||||
$v2 = new stdClass();
|
||||
$v2->name = $name2;
|
||||
$v2->value = $value2;
|
||||
|
||||
$variables = array($v1, $v2);
|
||||
|
||||
$params = array('sessionId'=>$sessionId, 'processId'=>$processId, 'taskId'=>$taskId, 'variables'=>$variables );
|
||||
$result = $client->__SoapCall('NewCase', array($params));
|
||||
$params = array("sessionId" => $sessionId, "processId" => $processId, "taskId" => $taskId, "variables" => $variables);
|
||||
|
||||
$result = $client->__soapCall("NewCase", array($params));
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
$fields["case_id"] = $result->caseId;
|
||||
$fields["case_number"] = $result->caseNumber;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -914,14 +982,17 @@ function WSNewCase($processId, $taskId, $name1, $value1, $name2, $value2) {
|
||||
*/
|
||||
function WSAssignUserToGroup($userId, $groupId) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
|
||||
$params = array('sessionId'=>$sessionId, 'userId'=>$userId, 'groupId'=>$groupId);
|
||||
$result = $client->__SoapCall('AssignUserToGroup', array($params));
|
||||
$params = array("sessionId" => $sessionId, "userId" => $userId, "groupId" => $groupId);
|
||||
|
||||
$result = $client->__soapCall("AssignUserToGroup", array($params));
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -944,13 +1015,16 @@ function WSAssignUserToGroup($userId, $groupId) {
|
||||
*/
|
||||
function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role) {
|
||||
$client = WSOpen();
|
||||
$sessionId = $_SESSION['WS_SESSION_ID'];
|
||||
$params = array('sessionId'=>$sessionId, 'userId'=>$userId, 'firstname'=>$firstname, 'lastname'=>$lastname, 'email'=>$email, 'role'=>$role, 'password'=>$password);
|
||||
$result = $client->__SoapCall('CreateUser', array($params));
|
||||
|
||||
$sessionId = $_SESSION["WS_SESSION_ID"];
|
||||
$params = array("sessionId" => $sessionId, "userId" => $userId, "firstname" => $firstname, "lastname" => $lastname, "email" => $email, "role" => $role, "password" => $password);
|
||||
|
||||
$result = $client->__soapCall("CreateUser", array($params));
|
||||
|
||||
$fields['status_code'] = $result->status_code;
|
||||
$fields['message'] = $result->message;
|
||||
$fields['time_stamp'] = $result->timestamp;
|
||||
$fields["status_code"] = $result->status_code;
|
||||
$fields["message"] = $result->message;
|
||||
$fields["time_stamp"] = $result->timestamp;
|
||||
|
||||
return $fields;
|
||||
}
|
||||
/**
|
||||
@@ -966,9 +1040,10 @@ function WSCreateUser($userId, $password, $firstname, $lastname, $email, $role)
|
||||
*
|
||||
*/
|
||||
function WSGetSession() {
|
||||
if(isset($_SESSION['WS_SESSION_ID'])) {
|
||||
return $_SESSION['WS_SESSION_ID'];
|
||||
} else {
|
||||
if (isset($_SESSION["WS_SESSION_ID"])) {
|
||||
return $_SESSION["WS_SESSION_ID"];
|
||||
}
|
||||
else {
|
||||
throw new Exception("SW session is not open!");
|
||||
}
|
||||
}
|
||||
@@ -1469,13 +1544,15 @@ function PMFDerivateCase($caseId, $delIndex, $bExecuteTriggersBeforeAssignment =
|
||||
*
|
||||
*/
|
||||
function PMFNewCaseImpersonate($processId, $userId, $variables) {
|
||||
G::LoadClass('wsBase');
|
||||
$ws = new wsBase ();
|
||||
G::LoadClass("wsBase");
|
||||
|
||||
$ws = new wsBase();
|
||||
$result = $ws->newCaseImpersonate($processId, $userId, $variables);
|
||||
|
||||
if($result->status_code == 0) {
|
||||
return 1;
|
||||
} else {
|
||||
if ($result->status_code == 0) {
|
||||
return $result->caseId;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1366,15 +1366,21 @@ class wsBase
|
||||
return $result;
|
||||
}
|
||||
|
||||
$case = $oCase->startCase($tasks[0]['TAS_UID'], $userId);
|
||||
$caseId = $case['APPLICATION'];
|
||||
$case = $oCase->startCase($tasks[0]['TAS_UID'], $userId);
|
||||
$caseId = $case['APPLICATION'];
|
||||
$caseNumber = $case['CASE_NUMBER'];
|
||||
|
||||
$oldFields = $oCase->loadCase( $caseId );
|
||||
|
||||
$oldFields['APP_DATA'] = array_merge( $oldFields['APP_DATA'], $Fields);
|
||||
|
||||
$up_case = $oCase->updateCase($caseId, $oldFields);
|
||||
|
||||
$result = new wsResponse (0, G::loadTranslation ('ID_COMMAND_EXECUTED_SUCCESSFULLY'));
|
||||
|
||||
$result->caseId = $caseId;
|
||||
$result->caseNumber = $caseNumber;
|
||||
|
||||
return $result;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -349,6 +349,17 @@
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="newCaseImpersonateResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="status_code" type="xs:integer"/>
|
||||
<xs:element name="message" type="xs:string"/>
|
||||
<xs:element name="timestamp" type="xs:string"/>
|
||||
<xs:element name="caseId" minOccurs="0" type="xs:string"/>
|
||||
<xs:element name="caseNumber" minOccurs="0" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:complexType name="routeListStruct">
|
||||
<xs:sequence>
|
||||
<xs:element name="userId" type="xs:string"/>
|
||||
@@ -743,6 +754,9 @@
|
||||
<message name="newCaseImpersonateRequest">
|
||||
<part name="parameters" element="xs0:newCaseImpersonateRequest"/>
|
||||
</message>
|
||||
<message name="newCaseImpersonateResponse">
|
||||
<part name="parameters" element="xs0:newCaseImpersonateResponse"/>
|
||||
</message>
|
||||
<message name="routeCaseRequest">
|
||||
<part name="parameters" element="xs0:routeCaseRequest"/>
|
||||
</message>
|
||||
@@ -891,7 +905,7 @@
|
||||
</operation>
|
||||
<operation name="newCaseImpersonate">
|
||||
<input message="xs0:newCaseImpersonateRequest"/>
|
||||
<output message="xs0:pmResponse"/>
|
||||
<output message="xs0:newCaseImpersonateResponse"/>
|
||||
</operation>
|
||||
<operation name="routeCase">
|
||||
<input message="xs0:routeCaseRequest"/>
|
||||
@@ -1096,7 +1110,7 @@
|
||||
</output>
|
||||
</operation>
|
||||
<operation name="newCaseImpersonate">
|
||||
<soap12:operation soapAction="urn:newCase" soapActionRequired="true" style="document"/>
|
||||
<soap12:operation soapAction="urn:newCaseImpersonate" soapActionRequired="true" style="document"/>
|
||||
<input>
|
||||
<soap12:body use="literal"/>
|
||||
</input>
|
||||
|
||||
@@ -505,56 +505,72 @@
|
||||
return $res->getPayloadArray ( );
|
||||
}
|
||||
|
||||
function NewCaseImpersonate( $params ) {
|
||||
function NewCaseImpersonate($params) {
|
||||
$vsResult = isValidSession($params->sessionId);
|
||||
if( $vsResult->status_code !== 0 ){
|
||||
|
||||
if ($vsResult->status_code !== 0) {
|
||||
return $vsResult;
|
||||
}
|
||||
|
||||
if( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
|
||||
$result = new wsResponse (2, "You do not have privileges");
|
||||
if (ifPermission($params->sessionId, "PM_CASES") == 0) {
|
||||
$result = new wsResponse(2, "You do not have privileges");
|
||||
return $result;
|
||||
}
|
||||
|
||||
$ws = new wsBase ();
|
||||
///////
|
||||
$variables = $params->variables;
|
||||
foreach ( $variables as $key=>$val ){
|
||||
$name = $val->name;
|
||||
$value = $val->value;
|
||||
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
|
||||
|
||||
$field = array();
|
||||
|
||||
if (is_object($variables)) {
|
||||
$field[$variables->name] = $variables->value;
|
||||
}
|
||||
$params->variables = $Fields;
|
||||
else {
|
||||
if (is_array($variables)) {
|
||||
foreach ($variables as $index => $obj) {
|
||||
if (is_object($obj) && isset($obj->name) && isset($obj->value)) {
|
||||
$field[$obj->name] = $obj->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$params->variables = $field;
|
||||
|
||||
///////
|
||||
$ws = new wsBase();
|
||||
$res = $ws->newCaseImpersonate($params->processId, $params->userId, $params->variables);
|
||||
return $res->getPayloadArray ( ) ;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
function NewCase( $params ) {
|
||||
|
||||
G::LoadClass('sessions');
|
||||
function NewCase($params) {
|
||||
G::LoadClass("sessions");
|
||||
|
||||
$vsResult = isValidSession($params->sessionId);
|
||||
if( $vsResult->status_code !== 0 ){
|
||||
|
||||
if ($vsResult->status_code !== 0) {
|
||||
return $vsResult;
|
||||
}
|
||||
|
||||
if ( ifPermission( $params->sessionId, 'PM_CASES') == 0 ){
|
||||
$result = new wsResponse (2, "You do not have privileges");
|
||||
if (ifPermission($params->sessionId, "PM_CASES") == 0) {
|
||||
$result = new wsResponse(2, "You do not have privileges");
|
||||
return $result;
|
||||
}
|
||||
|
||||
$oSessions = new Sessions();
|
||||
$session = $oSessions->getSessionUser($params->sessionId);
|
||||
$userId = $session['USR_UID'];
|
||||
$variables = $params->variables;
|
||||
$oSession = new Sessions();
|
||||
$session = $oSession->getSessionUser($params->sessionId);
|
||||
$userId = $session["USR_UID"];
|
||||
$variables = $params->variables;
|
||||
|
||||
/* this code is for previous version of ws, and apparently this will work for grids inside the variables..
|
||||
if (!isset($params->variables) ) {
|
||||
$variables = array();
|
||||
$Fields = array();
|
||||
$field = array();
|
||||
}
|
||||
else {
|
||||
if ( is_object ($variables) ) {
|
||||
$Fields[ $variables->name ]= $variables->value ;
|
||||
$field[ $variables->name ]= $variables->value ;
|
||||
}
|
||||
|
||||
if ( is_array ( $variables) ) {
|
||||
@@ -563,7 +579,7 @@
|
||||
$value = $val->value;
|
||||
if (!is_object($val->value))
|
||||
{
|
||||
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
|
||||
eval('$field[ ' . $val->name . ' ]= $val->value ;');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -573,7 +589,7 @@
|
||||
if (isset($val1->value)) {
|
||||
if (is_array($val1->value->item)) {
|
||||
foreach ($val1->value->item as $key2 => $val2) {
|
||||
$Fields[$val->name][$i][$val2->key] = $val2->value;
|
||||
$field[$val->name][$i][$val2->key] = $val2->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -586,26 +602,28 @@
|
||||
}
|
||||
*/
|
||||
$variables = $params->variables;
|
||||
|
||||
$field = array();
|
||||
|
||||
|
||||
if ( is_object ($variables) ) {
|
||||
$Fields[ $variables->name ]= $variables->value ;
|
||||
if (is_object($variables)) {
|
||||
$field[$variables->name]= $variables->value;
|
||||
}
|
||||
if ( is_array ( $variables) ) {
|
||||
foreach ( $variables as $key=>$val ) {
|
||||
if (!is_object($val->value)){
|
||||
eval('$Fields[ ' . $val->name . ' ]= $val->value ;');
|
||||
if (is_array($variables)) {
|
||||
foreach ($variables as $key => $val) {
|
||||
if (!is_object($val->value)) {
|
||||
eval("\$field[" . $val->name . "]= \$val->value;");
|
||||
}
|
||||
}
|
||||
}
|
||||
$params->variables = $Fields;
|
||||
$ws = new wsBase ();
|
||||
|
||||
$params->variables = $field;
|
||||
$ws = new wsBase();
|
||||
$res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables);
|
||||
|
||||
######################################################################
|
||||
# we need to register the case id for a stored session variable. like a normal Session.
|
||||
######################################################################
|
||||
$oSessions->registerGlobal('APPLICATION', $res->caseId);
|
||||
$oSession->registerGlobal("APPLICATION", $res->caseId);
|
||||
######################################################################
|
||||
|
||||
return $res;
|
||||
|
||||
Reference in New Issue
Block a user