Commit 164d84ffbf38a5fe4cedd0dc70742e15096ccabb
1 parent
6bffcce9
WSA-128
"Add functionality to get workflows" Fixed: Added get_workflows(session) method and appropriate typedefs to return list of active workflows (wraps KTAPI function get_workflows) Committed By: Martin Kirsten Reviewed By: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8579 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
52 additions
and
0 deletions
ktwebservice/webservice.php
| @@ -473,6 +473,20 @@ class KTWebService | @@ -473,6 +473,20 @@ class KTWebService | ||
| 473 | 'message'=>'string', | 473 | 'message'=>'string', |
| 474 | 'transitions' => "{urn:$this->namespace}kt_workflow_transitions" | 474 | 'transitions' => "{urn:$this->namespace}kt_workflow_transitions" |
| 475 | ); | 475 | ); |
| 476 | + | ||
| 477 | + $this->__typedef["{urn:$this->namespace}kt_workflows_array"] = | ||
| 478 | + array( | ||
| 479 | + array( | ||
| 480 | + 'workflow' => 'string' | ||
| 481 | + ) | ||
| 482 | + ); | ||
| 483 | + | ||
| 484 | + $this->__typedef["{urn:$this->namespace}kt_workflows_response"] = | ||
| 485 | + array( | ||
| 486 | + 'status_code' => 'int', | ||
| 487 | + 'message' => 'string', | ||
| 488 | + 'workflows' => "{urn:$this->namespace}kt_workflows_array" | ||
| 489 | + ); | ||
| 476 | 490 | ||
| 477 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = | 491 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = |
| 478 | array( | 492 | array( |
| @@ -1108,6 +1122,12 @@ class KTWebService | @@ -1108,6 +1122,12 @@ class KTWebService | ||
| 1108 | array('in' => array('session_id'=>'string' ), | 1122 | array('in' => array('session_id'=>'string' ), |
| 1109 | 'out' => array( 'return' => "{urn:$this->namespace}kt_document_types_response" ), | 1123 | 'out' => array( 'return' => "{urn:$this->namespace}kt_document_types_response" ), |
| 1110 | ); | 1124 | ); |
| 1125 | + | ||
| 1126 | + // get_workflows | ||
| 1127 | + $this->__dispatch_map['get_workflows'] = | ||
| 1128 | + array('in' => array('session_id'=>'string' ), | ||
| 1129 | + 'out' => array( 'return' => "{urn:$this->namespace}kt_workflows_response" ), | ||
| 1130 | + ); | ||
| 1111 | 1131 | ||
| 1112 | // get_document_link_types | 1132 | // get_document_link_types |
| 1113 | $this->__dispatch_map['get_document_link_types'] = | 1133 | $this->__dispatch_map['get_document_link_types'] = |
| @@ -3439,6 +3459,38 @@ class KTWebService | @@ -3439,6 +3459,38 @@ class KTWebService | ||
| 3439 | 3459 | ||
| 3440 | return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | 3460 | return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 3441 | } | 3461 | } |
| 3462 | + | ||
| 3463 | + /** | ||
| 3464 | + * Returns a list of available workflows | ||
| 3465 | + * | ||
| 3466 | + * @param string $session_id | ||
| 3467 | + * @return kt_response | ||
| 3468 | + */ | ||
| 3469 | + function get_workflows($session_id) | ||
| 3470 | + { | ||
| 3471 | + $this->debug("get_workflows('$session_id')"); | ||
| 3472 | + $kt = &$this->get_ktapi($session_id ); | ||
| 3473 | + if (is_array($kt)) | ||
| 3474 | + { | ||
| 3475 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $kt); | ||
| 3476 | + } | ||
| 3477 | + | ||
| 3478 | + $response = KTWebService::_status(KTWS_ERR_PROBLEM); | ||
| 3479 | + | ||
| 3480 | + $result = $kt->get_workflows(); | ||
| 3481 | + if (PEAR::isError($result)) | ||
| 3482 | + { | ||
| 3483 | + $response['message']= $result->getMessage(); | ||
| 3484 | + $this->debug("get_workflows - " . $result->getMessage(), $session_id); | ||
| 3485 | + | ||
| 3486 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $response); | ||
| 3487 | + } | ||
| 3488 | + | ||
| 3489 | + $response['status_code']= KTWS_SUCCESS; | ||
| 3490 | + $response['workflows']= $result; | ||
| 3491 | + | ||
| 3492 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $response); | ||
| 3493 | + } | ||
| 3442 | 3494 | ||
| 3443 | /** | 3495 | /** |
| 3444 | * Returns a list of available transitions on a give document with a workflow. | 3496 | * Returns a list of available transitions on a give document with a workflow. |