diff --git a/ktwebservice/webservice.php b/ktwebservice/webservice.php index 40df507..877bd69 100644 --- a/ktwebservice/webservice.php +++ b/ktwebservice/webservice.php @@ -473,6 +473,20 @@ class KTWebService 'message'=>'string', 'transitions' => "{urn:$this->namespace}kt_workflow_transitions" ); + + $this->__typedef["{urn:$this->namespace}kt_workflows_array"] = + array( + array( + 'workflow' => 'string' + ) + ); + + $this->__typedef["{urn:$this->namespace}kt_workflows_response"] = + array( + 'status_code' => 'int', + 'message' => 'string', + 'workflows' => "{urn:$this->namespace}kt_workflows_array" + ); $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = array( @@ -1108,6 +1122,12 @@ class KTWebService array('in' => array('session_id'=>'string' ), 'out' => array( 'return' => "{urn:$this->namespace}kt_document_types_response" ), ); + + // get_workflows + $this->__dispatch_map['get_workflows'] = + array('in' => array('session_id'=>'string' ), + 'out' => array( 'return' => "{urn:$this->namespace}kt_workflows_response" ), + ); // get_document_link_types $this->__dispatch_map['get_document_link_types'] = @@ -3439,6 +3459,38 @@ class KTWebService return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); } + + /** + * Returns a list of available workflows + * + * @param string $session_id + * @return kt_response + */ + function get_workflows($session_id) + { + $this->debug("get_workflows('$session_id')"); + $kt = &$this->get_ktapi($session_id ); + if (is_array($kt)) + { + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $kt); + } + + $response = KTWebService::_status(KTWS_ERR_PROBLEM); + + $result = $kt->get_workflows(); + if (PEAR::isError($result)) + { + $response['message']= $result->getMessage(); + $this->debug("get_workflows - " . $result->getMessage(), $session_id); + + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $response); + } + + $response['status_code']= KTWS_SUCCESS; + $response['workflows']= $result; + + return new SOAP_Value('return',"{urn:$this->namespace}kt_workflows_response", $response); + } /** * Returns a list of available transitions on a give document with a workflow.