Commit a0305acaf193f9af4530718c13d32a022fb0bd39
1 parent
3b03a498
WSA-89
"When calling add_document_with_metadata, notification for add and update are created." Fixed. Not the best solution, but now we remove the duplicate message. WSA-91 "error with move_document: Cannot assign object of type Dowco.KTWrapper.atlantic_kt.kt_response to an object of type Dowco.KTWrapper.atlantic_kt.kt_document_detail." Fixed. WSA-92 "get error when calling move_folder: An existing connection was forcibly closed by the remote host" Fixed. WSA-93 "Add integration/oem no so that integrators may associate a custom document reference" Implemented. Committed By: Conrad Vermeulen Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7860 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
187 additions
and
24 deletions
ktwebservice/webservice.php
| ... | ... | @@ -69,6 +69,7 @@ if (defined('HAS_SEARCH_FUNCTIONALITY')) |
| 69 | 69 | // TODO: redo metadata encoding |
| 70 | 70 | // TODO: unit tests - metadata - test return values in selectin - list/tree |
| 71 | 71 | // TODO: ktwsapi/php must be made compatible with v2/v3 |
| 72 | +// TODO: subscriptions/notifications | |
| 72 | 73 | |
| 73 | 74 | // NOTE: some features are not implemented yet. most expected for v3. e.g. oem_document_no, custom_document_no, download($version)., get_metadata($version) |
| 74 | 75 | |
| ... | ... | @@ -555,6 +556,34 @@ class KTWebService |
| 555 | 556 | ); |
| 556 | 557 | } |
| 557 | 558 | |
| 559 | + $this->__typedef["{urn:$this->namespace}kt_document_collection"] = | |
| 560 | + array( | |
| 561 | + array( | |
| 562 | + 'item' => "{urn:$this->namespace}kt_document_detail" | |
| 563 | + ) | |
| 564 | + ); | |
| 565 | + | |
| 566 | + $this->__typedef["{urn:$this->namespace}kt_document_collection_response"] = | |
| 567 | + array( | |
| 568 | + 'status_code' => 'int', | |
| 569 | + 'message' => 'string', | |
| 570 | + 'collection' => "{urn:$this->namespace}kt_document_collection" | |
| 571 | + ); | |
| 572 | + | |
| 573 | + $this->__typedef["{urn:$this->namespace}kt_folder_collection"] = | |
| 574 | + array( | |
| 575 | + array( | |
| 576 | + 'item' => "{urn:$this->namespace}kt_folder_detail" | |
| 577 | + ) | |
| 578 | + ); | |
| 579 | + | |
| 580 | + $this->__typedef["{urn:$this->namespace}kt_folder_collection_response"] = | |
| 581 | + array( | |
| 582 | + 'status_code' => 'int', | |
| 583 | + 'message' => 'string', | |
| 584 | + 'collection' => "{urn:$this->namespace}kt_folder_collection" | |
| 585 | + ); | |
| 586 | + | |
| 558 | 587 | $this->__typedef["{urn:$this->namespace}kt_document_version_history"] = |
| 559 | 588 | array( |
| 560 | 589 | array( |
| ... | ... | @@ -642,6 +671,12 @@ class KTWebService |
| 642 | 671 | $this->__dispatch_map['get_folder_detail']['in'] = array('session_id' => 'string', 'folder_id' => 'int', 'create'=>'boolean' ); |
| 643 | 672 | } |
| 644 | 673 | |
| 674 | + // get_documents_by_oem_no | |
| 675 | + $this->__dispatch_map['get_documents_by_oem_no'] = | |
| 676 | + array('in' => array('session_id' => 'string', 'oem_no' => 'string', 'detail' => 'string'), | |
| 677 | + 'out' => array('return' => "{urn:$this->namespace}kt_document_collection_response"), | |
| 678 | + ); | |
| 679 | + | |
| 645 | 680 | // get_folder_detail_by_name |
| 646 | 681 | $this->__dispatch_map['get_folder_detail_by_name'] = |
| 647 | 682 | array('in' => array('session_id' => 'string', 'folder_name' => 'string' ), |
| ... | ... | @@ -712,12 +747,23 @@ class KTWebService |
| 712 | 747 | 'out' => array('return' => "{urn:$this->namespace}kt_response" ), |
| 713 | 748 | ); |
| 714 | 749 | |
| 750 | + if ($this->version >= 2) | |
| 751 | + { | |
| 752 | + $this->__dispatch_map['copy_folder']['out'] = array('return' => "{urn:$this->namespace}kt_folder_detail" ); | |
| 753 | + } | |
| 754 | + | |
| 715 | 755 | // move_folder |
| 716 | 756 | $this->__dispatch_map['move_folder'] = |
| 717 | 757 | array('in' => array('session_id'=>'string','source_id'=>'int','target_id'=>'int','reason' =>'string'), |
| 718 | 758 | 'out' => array('return' => "{urn:$this->namespace}kt_response" ), |
| 719 | 759 | ); |
| 720 | 760 | |
| 761 | + if ($this->version >= 2) | |
| 762 | + { | |
| 763 | + $this->__dispatch_map['move_folder']['out'] = array('return' => "{urn:$this->namespace}kt_folder_detail" ); | |
| 764 | + } | |
| 765 | + | |
| 766 | + | |
| 721 | 767 | // get_document_detail |
| 722 | 768 | $this->__dispatch_map['get_document_detail'] = array( |
| 723 | 769 | 'in' => array('session_id' => 'string', 'document_id' => 'int' ), |
| ... | ... | @@ -914,7 +960,10 @@ class KTWebService |
| 914 | 960 | ); |
| 915 | 961 | if ($this->version >= 2) |
| 916 | 962 | { |
| 917 | - $this->__dispatch_map['copy_document']['out'] = array( 'return' => "{urn:$this->namespace}kt_document_detail" ); | |
| 963 | + $this->__dispatch_map['copy_document'] = | |
| 964 | + array('in' => array('session_id'=>'string','document_id'=>'int','folder_id'=>'int','reason'=>'string', 'options'=>'string' ), | |
| 965 | + 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ), | |
| 966 | + ); | |
| 918 | 967 | } |
| 919 | 968 | |
| 920 | 969 | // move_document |
| ... | ... | @@ -924,7 +973,10 @@ class KTWebService |
| 924 | 973 | ); |
| 925 | 974 | if ($this->version >= 2) |
| 926 | 975 | { |
| 927 | - $this->__dispatch_map['move_document']['out'] = array( 'return' => "{urn:$this->namespace}kt_document_detail" ); | |
| 976 | + $this->__dispatch_map['move_document'] = | |
| 977 | + array('in' => array('session_id'=>'string','document_id'=>'int','folder_id'=>'int','reason'=>'string', 'options'=>'string'), | |
| 978 | + 'out' => array( 'return' => "{urn:$this->namespace}kt_document_detail" ), | |
| 979 | + ); | |
| 928 | 980 | } |
| 929 | 981 | |
| 930 | 982 | // rename_document_title |
| ... | ... | @@ -1493,9 +1545,15 @@ class KTWebService |
| 1493 | 1545 | { |
| 1494 | 1546 | $this->debug("copy_folder('$session_id',$source_id,$target_id,'$reason')"); |
| 1495 | 1547 | $kt = &$this->get_ktapi($session_id ); |
| 1548 | + | |
| 1549 | + $responseType = 'kt_response'; | |
| 1550 | + if ($this->version >= 2) | |
| 1551 | + { | |
| 1552 | + $responseType = 'kt_folder_detail'; | |
| 1553 | + } | |
| 1496 | 1554 | if (is_array($kt)) |
| 1497 | 1555 | { |
| 1498 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | |
| 1556 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); | |
| 1499 | 1557 | } |
| 1500 | 1558 | |
| 1501 | 1559 | $response = KTWebService::_status(KTWS_ERR_INVALID_FOLDER); |
| ... | ... | @@ -1505,7 +1563,7 @@ class KTWebService |
| 1505 | 1563 | { |
| 1506 | 1564 | $response['message'] = $src_folder->getMessage(); |
| 1507 | 1565 | $this->debug("copy_folder - cannot get source folderid $source_id - " . $src_folder->getMessage(), $session_id); |
| 1508 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1566 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1509 | 1567 | } |
| 1510 | 1568 | |
| 1511 | 1569 | $tgt_folder = &$kt->get_folder_by_id($target_id); |
| ... | ... | @@ -1514,7 +1572,7 @@ class KTWebService |
| 1514 | 1572 | $response['message'] = $tgt_folder->getMessage(); |
| 1515 | 1573 | $this->debug("copy_folder - cannot get target folderid $target_id - " . $tgt_folder->getMessage(), $session_id); |
| 1516 | 1574 | |
| 1517 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1575 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1518 | 1576 | } |
| 1519 | 1577 | |
| 1520 | 1578 | $result= $src_folder->copy($tgt_folder, $reason); |
| ... | ... | @@ -1524,12 +1582,23 @@ class KTWebService |
| 1524 | 1582 | $response['message'] = $result->getMessage(); |
| 1525 | 1583 | $this->debug("copy_folder - copy to target folder - " . $result->getMessage(), $session_id); |
| 1526 | 1584 | |
| 1527 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1585 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1586 | + } | |
| 1587 | + | |
| 1588 | + if ($this->version >=2) | |
| 1589 | + { | |
| 1590 | + | |
| 1591 | + $sourceName = $src_folder->get_folder_name(); | |
| 1592 | + $targetPath = $tgt_folder->get_full_path(); | |
| 1593 | + | |
| 1594 | + $response = $this->get_folder_detail_by_name($session_id, $targetPath . '/' . $sourceName); | |
| 1595 | + | |
| 1596 | + return $response; | |
| 1528 | 1597 | } |
| 1529 | 1598 | |
| 1530 | 1599 | $response['status_code']= KTWS_SUCCESS; |
| 1531 | 1600 | |
| 1532 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1601 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1533 | 1602 | } |
| 1534 | 1603 | |
| 1535 | 1604 | /** |
| ... | ... | @@ -1545,9 +1614,14 @@ class KTWebService |
| 1545 | 1614 | { |
| 1546 | 1615 | $this->debug("move_folder('$session_id',$source_id,$target_id,'$reason')"); |
| 1547 | 1616 | $kt = &$this->get_ktapi($session_id ); |
| 1617 | + $responseType = 'kt_response'; | |
| 1618 | + if ($this->version >= 2) | |
| 1619 | + { | |
| 1620 | + $responseType = 'kt_folder_detail'; | |
| 1621 | + } | |
| 1548 | 1622 | if (is_array($kt)) |
| 1549 | 1623 | { |
| 1550 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | |
| 1624 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); | |
| 1551 | 1625 | } |
| 1552 | 1626 | |
| 1553 | 1627 | $response = KTWebService::_status(KTWS_ERR_INVALID_FOLDER); |
| ... | ... | @@ -1557,7 +1631,7 @@ class KTWebService |
| 1557 | 1631 | { |
| 1558 | 1632 | $response['message'] = $src_folder->getMessage(); |
| 1559 | 1633 | $this->debug("move_folder - cannot get source folder $source_id - " . $src_folder->getMessage(), $session_id); |
| 1560 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1634 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1561 | 1635 | } |
| 1562 | 1636 | |
| 1563 | 1637 | $tgt_folder = &$kt->get_folder_by_id($target_id); |
| ... | ... | @@ -1565,7 +1639,7 @@ class KTWebService |
| 1565 | 1639 | { |
| 1566 | 1640 | $response['message'] = $tgt_folder->getMessage(); |
| 1567 | 1641 | $this->debug("move_folder - cannot get target folder $target_id - " . $tgt_folder->getMessage(), $session_id); |
| 1568 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1642 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1569 | 1643 | } |
| 1570 | 1644 | |
| 1571 | 1645 | $result = $src_folder->move($tgt_folder, $reason); |
| ... | ... | @@ -1574,12 +1648,20 @@ class KTWebService |
| 1574 | 1648 | $response['status_code'] = KTWS_ERR_PROBLEM; |
| 1575 | 1649 | $response['message'] = $result->getMessage(); |
| 1576 | 1650 | $this->debug("move_folder - cannot move folder - " . $result->getMessage(), $session_id); |
| 1577 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1651 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1652 | + } | |
| 1653 | + | |
| 1654 | + if ($this->version >=2) | |
| 1655 | + { | |
| 1656 | + | |
| 1657 | + $response = $this->get_folder_detail($session_id, $source_id); | |
| 1658 | + | |
| 1659 | + return $response; | |
| 1578 | 1660 | } |
| 1579 | 1661 | |
| 1580 | 1662 | $response['status_code']= KTWS_SUCCESS; |
| 1581 | 1663 | |
| 1582 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 1664 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 1583 | 1665 | } |
| 1584 | 1666 | |
| 1585 | 1667 | /** |
| ... | ... | @@ -1908,6 +1990,11 @@ class KTWebService |
| 1908 | 1990 | } |
| 1909 | 1991 | |
| 1910 | 1992 | $document = $kt->get_document_by_id($document_id); |
| 1993 | + $result = $document->removeUpdateNotification(); | |
| 1994 | + if (PEAR::isError($result)) | |
| 1995 | + { | |
| 1996 | + // not much we can do, maybe just log! | |
| 1997 | + } | |
| 1911 | 1998 | $result = $document->mergeWithLastMetadataVersion(); |
| 1912 | 1999 | if (PEAR::isError($result)) |
| 1913 | 2000 | { |
| ... | ... | @@ -1942,6 +2029,13 @@ class KTWebService |
| 1942 | 2029 | } |
| 1943 | 2030 | |
| 1944 | 2031 | $document = $kt->get_document_by_id($document_id); |
| 2032 | + $result = $document->removeUpdateNotification(); | |
| 2033 | + if (PEAR::isError($result)) | |
| 2034 | + { | |
| 2035 | + // not much we can do, maybe just log! | |
| 2036 | + } | |
| 2037 | + | |
| 2038 | + | |
| 1945 | 2039 | $result = $document->mergeWithLastMetadataVersion(); |
| 1946 | 2040 | if (PEAR::isError($result)) |
| 1947 | 2041 | { |
| ... | ... | @@ -1951,6 +2045,45 @@ class KTWebService |
| 1951 | 2045 | return $update_result; |
| 1952 | 2046 | } |
| 1953 | 2047 | |
| 2048 | + | |
| 2049 | + /** | |
| 2050 | + * Find documents matching the document oem (integration) no | |
| 2051 | + * | |
| 2052 | + * @param string $session_id | |
| 2053 | + * @param string $oem_no | |
| 2054 | + * @param string $detail | |
| 2055 | + * @return kt_document_collection_response | |
| 2056 | + */ | |
| 2057 | + function get_documents_by_oem_no($session_id, $oem_no, $detail) | |
| 2058 | + { | |
| 2059 | + $this->debug("get_documents_by_oem_no('$session_id','$oem_no', '$detail')"); | |
| 2060 | + $kt = &$this->get_ktapi($session_id ); | |
| 2061 | + if (is_array($kt)) | |
| 2062 | + { | |
| 2063 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_collection_response", $kt); | |
| 2064 | + } | |
| 2065 | + | |
| 2066 | + $documents = $kt->get_documents_by_oem_no($oem_no); | |
| 2067 | + | |
| 2068 | + $collection = array(); | |
| 2069 | + foreach($documents as $documentId) | |
| 2070 | + { | |
| 2071 | + $detail = $this->get_document_detail($session_id, $documentId, $detail); | |
| 2072 | + if ($detail->value['status_code'] != 0) | |
| 2073 | + { | |
| 2074 | + continue; | |
| 2075 | + } | |
| 2076 | + $collection[] = $detail->value; | |
| 2077 | + } | |
| 2078 | + | |
| 2079 | + $response=array(); | |
| 2080 | + $response['status_code'] = KTWS_SUCCESS; | |
| 2081 | + $response['message'] = empty($collection)?_kt('No documents were found matching the specified document no'):''; | |
| 2082 | + $response['collection'] = new SOAP_Value('collection',"{urn:$this->namespace}kt_document_collection", $collection); | |
| 2083 | + | |
| 2084 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_collection_response", $response); | |
| 2085 | + } | |
| 2086 | + | |
| 1954 | 2087 | /** |
| 1955 | 2088 | * Adds a document to the repository. |
| 1956 | 2089 | * |
| ... | ... | @@ -2088,6 +2221,11 @@ class KTWebService |
| 2088 | 2221 | } |
| 2089 | 2222 | |
| 2090 | 2223 | $document = $kt->get_document_by_id($document_id); |
| 2224 | + $result = $document->removeUpdateNotification(); | |
| 2225 | + if (PEAR::isError($result)) | |
| 2226 | + { | |
| 2227 | + // not much we can do, maybe just log! | |
| 2228 | + } | |
| 2091 | 2229 | $result = $document->mergeWithLastMetadataVersion(); |
| 2092 | 2230 | if (PEAR::isError($result)) |
| 2093 | 2231 | { |
| ... | ... | @@ -2121,6 +2259,11 @@ class KTWebService |
| 2121 | 2259 | } |
| 2122 | 2260 | |
| 2123 | 2261 | $document = $kt->get_document_by_id($document_id); |
| 2262 | + $result = $document->removeUpdateNotification(); | |
| 2263 | + if (PEAR::isError($result)) | |
| 2264 | + { | |
| 2265 | + // not much we can do, maybe just log! | |
| 2266 | + } | |
| 2124 | 2267 | $result = $document->mergeWithLastMetadataVersion(); |
| 2125 | 2268 | if (PEAR::isError($result)) |
| 2126 | 2269 | { |
| ... | ... | @@ -2583,14 +2726,19 @@ class KTWebService |
| 2583 | 2726 | * @param string $newfilename |
| 2584 | 2727 | * @return kt_document_detail |
| 2585 | 2728 | */ |
| 2586 | - function copy_document($session_id,$document_id,$folder_id,$reason,$newtitle,$newfilename) | |
| 2729 | + function copy_document($session_id,$document_id,$folder_id,$reason,$newtitle=null,$newfilename=null) | |
| 2587 | 2730 | { |
| 2588 | 2731 | $this->debug("copy_document('$session_id',$document_id,$folder_id,'$reason','$newtitle','$newfilename')"); |
| 2589 | 2732 | |
| 2733 | + $responseType = 'kt_response'; | |
| 2734 | + if ($this->version >= 2) | |
| 2735 | + { | |
| 2736 | + $responseType = 'kt_document_detail'; | |
| 2737 | + } | |
| 2590 | 2738 | $kt = &$this->get_ktapi($session_id ); |
| 2591 | 2739 | if (is_array($kt)) |
| 2592 | 2740 | { |
| 2593 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | |
| 2741 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); | |
| 2594 | 2742 | } |
| 2595 | 2743 | |
| 2596 | 2744 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); |
| ... | ... | @@ -2600,7 +2748,7 @@ class KTWebService |
| 2600 | 2748 | { |
| 2601 | 2749 | $response['message'] = $document->getMessage(); |
| 2602 | 2750 | $this->debug("copy_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); |
| 2603 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2751 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2604 | 2752 | } |
| 2605 | 2753 | |
| 2606 | 2754 | $tgt_folder = &$kt->get_folder_by_id($folder_id); |
| ... | ... | @@ -2609,7 +2757,7 @@ class KTWebService |
| 2609 | 2757 | $response['status_code'] = KTWS_ERR_INVALID_FOLDER; |
| 2610 | 2758 | $response['message'] = $tgt_folder->getMessage(); |
| 2611 | 2759 | $this->debug("copy_document - cannot get folderid $folder_id - " . $tgt_folder->getMessage(), $session_id); |
| 2612 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2760 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2613 | 2761 | } |
| 2614 | 2762 | |
| 2615 | 2763 | $result = $document->copy($tgt_folder, $reason, $newtitle, $newfilename); |
| ... | ... | @@ -2617,7 +2765,7 @@ class KTWebService |
| 2617 | 2765 | { |
| 2618 | 2766 | $response['message'] = $result->getMessage(); |
| 2619 | 2767 | $this->debug("copy_document - cannot copy - " . $result->getMessage(), $session_id); |
| 2620 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2768 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2621 | 2769 | } |
| 2622 | 2770 | $response['status_code'] = KTWS_SUCCESS; |
| 2623 | 2771 | if ($this->version >= 2) |
| ... | ... | @@ -2626,7 +2774,7 @@ class KTWebService |
| 2626 | 2774 | return $this->get_document_detail($session_id, $new_document_id, ''); |
| 2627 | 2775 | } |
| 2628 | 2776 | |
| 2629 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2777 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2630 | 2778 | } |
| 2631 | 2779 | |
| 2632 | 2780 | /** |
| ... | ... | @@ -2640,13 +2788,18 @@ class KTWebService |
| 2640 | 2788 | * @param string $newfilename |
| 2641 | 2789 | * @return kt_response |
| 2642 | 2790 | */ |
| 2643 | - function move_document($session_id,$document_id,$folder_id,$reason,$newtitle,$newfilename) | |
| 2791 | + function move_document($session_id,$document_id,$folder_id,$reason,$newtitle=null,$newfilename=null) | |
| 2644 | 2792 | { |
| 2645 | 2793 | $this->debug("move_document('$session_id',$document_id,$folder_id,'$reason','$newtitle','$newfilename')"); |
| 2794 | + $responseType = 'kt_response'; | |
| 2795 | + if ($this->version >= 2) | |
| 2796 | + { | |
| 2797 | + $responseType = 'kt_document_detail'; | |
| 2798 | + } | |
| 2646 | 2799 | $kt = &$this->get_ktapi($session_id ); |
| 2647 | 2800 | if (is_array($kt)) |
| 2648 | 2801 | { |
| 2649 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | |
| 2802 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); | |
| 2650 | 2803 | } |
| 2651 | 2804 | |
| 2652 | 2805 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); |
| ... | ... | @@ -2656,16 +2809,20 @@ class KTWebService |
| 2656 | 2809 | { |
| 2657 | 2810 | $response['message'] = $document->getMessage(); |
| 2658 | 2811 | $this->debug("move_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); |
| 2659 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2812 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2660 | 2813 | } |
| 2661 | 2814 | |
| 2815 | + if ($document->ktapi_folder->folderid != $folder_id) | |
| 2816 | + { | |
| 2817 | + // we only have to do something if the source and target folders are different | |
| 2818 | + | |
| 2662 | 2819 | $tgt_folder = &$kt->get_folder_by_id($folder_id); |
| 2663 | 2820 | if (PEAR::isError($tgt_folder)) |
| 2664 | 2821 | { |
| 2665 | 2822 | $response['status_code'] = KTWS_ERR_INVALID_FOLDER; |
| 2666 | 2823 | $response['message'] = $tgt_folder->getMessage(); |
| 2667 | 2824 | $this->debug("move_document - cannot get folderid $folder_id - " . $tgt_folder->getMessage(), $session_id); |
| 2668 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2825 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2669 | 2826 | } |
| 2670 | 2827 | |
| 2671 | 2828 | $result = $document->move($tgt_folder, $reason, $newtitle, $newfilename); |
| ... | ... | @@ -2673,11 +2830,17 @@ class KTWebService |
| 2673 | 2830 | { |
| 2674 | 2831 | $response['message'] = $result->getMessage(); |
| 2675 | 2832 | $this->debug("move_document - cannot move - " . $result->getMessage(), $session_id); |
| 2676 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2833 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2834 | + } | |
| 2677 | 2835 | } |
| 2836 | + | |
| 2678 | 2837 | $response['status_code'] = KTWS_SUCCESS; |
| 2838 | + if ($this->version >= 2) | |
| 2839 | + { | |
| 2840 | + return $this->get_document_detail($session_id, $document_id, ''); | |
| 2841 | + } | |
| 2679 | 2842 | |
| 2680 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | |
| 2843 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); | |
| 2681 | 2844 | } |
| 2682 | 2845 | |
| 2683 | 2846 | /** | ... | ... |