Commit bdf9a2c026a85df782614112cbc7f9ca52aa9a8b
1 parent
bd9cb133
"KTS-1973"
"Webservice error when calling get_folder_contents fom VB.NET" Fixed. Types for metadata and history info has been catered for. Reviewed By: Kevin Fourie git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@6627 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
339 additions
and
34 deletions
ktwebservice/webservice.php
| @@ -106,9 +106,7 @@ class KTWebService | @@ -106,9 +106,7 @@ class KTWebService | ||
| 106 | 'folder_name' => 'string', | 106 | 'folder_name' => 'string', |
| 107 | 'parent_id' => 'int', | 107 | 'parent_id' => 'int', |
| 108 | 'full_path' => 'string', | 108 | 'full_path' => 'string', |
| 109 | - ); | ||
| 110 | - | ||
| 111 | - | 109 | + ); |
| 112 | 110 | ||
| 113 | $this->__typedef["{urn:$this->namespace}kt_folder_item"] = | 111 | $this->__typedef["{urn:$this->namespace}kt_folder_item"] = |
| 114 | array( | 112 | array( |
| @@ -127,14 +125,14 @@ class KTWebService | @@ -127,14 +125,14 @@ class KTWebService | ||
| 127 | 'mime_icon_path' => 'string', | 125 | 'mime_icon_path' => 'string', |
| 128 | 'mime_display' => 'string', | 126 | 'mime_display' => 'string', |
| 129 | 'items' =>"{urn:$this->namespace}kt_folder_items" | 127 | 'items' =>"{urn:$this->namespace}kt_folder_items" |
| 130 | - ); | 128 | + ); |
| 131 | 129 | ||
| 132 | $this->__typedef["{urn:$this->namespace}kt_folder_items"] = | 130 | $this->__typedef["{urn:$this->namespace}kt_folder_items"] = |
| 133 | array( | 131 | array( |
| 134 | array( | 132 | array( |
| 135 | 'item' => "{urn:$this->namespace}kt_folder_item" | 133 | 'item' => "{urn:$this->namespace}kt_folder_item" |
| 136 | ) | 134 | ) |
| 137 | - ); | 135 | + ); |
| 138 | 136 | ||
| 139 | 137 | ||
| 140 | $this->__typedef["{urn:$this->namespace}kt_folder_contents"] = | 138 | $this->__typedef["{urn:$this->namespace}kt_folder_contents"] = |
| @@ -145,7 +143,7 @@ class KTWebService | @@ -145,7 +143,7 @@ class KTWebService | ||
| 145 | 'folder_name' => 'string' , | 143 | 'folder_name' => 'string' , |
| 146 | 'full_path' => 'string' , | 144 | 'full_path' => 'string' , |
| 147 | 'items' => "{urn:$this->namespace}kt_folder_items", | 145 | 'items' => "{urn:$this->namespace}kt_folder_items", |
| 148 | - ); | 146 | + ); |
| 149 | 147 | ||
| 150 | $this->__typedef["{urn:$this->namespace}kt_document_detail"] = | 148 | $this->__typedef["{urn:$this->namespace}kt_document_detail"] = |
| 151 | array( | 149 | array( |
| @@ -166,7 +164,7 @@ class KTWebService | @@ -166,7 +164,7 @@ class KTWebService | ||
| 166 | 'checkout_by' => 'string', | 164 | 'checkout_by' => 'string', |
| 167 | 'full_path' => 'string', | 165 | 'full_path' => 'string', |
| 168 | // 'metadata' => "{urn:$this->namespace}kt_metadata_fieldsets" | 166 | // 'metadata' => "{urn:$this->namespace}kt_metadata_fieldsets" |
| 169 | - ); | 167 | + ); |
| 170 | 168 | ||
| 171 | $this->__typedef["{urn:$this->namespace}kt_metadata_selection_item"] = | 169 | $this->__typedef["{urn:$this->namespace}kt_metadata_selection_item"] = |
| 172 | array( | 170 | array( |
| @@ -174,7 +172,7 @@ class KTWebService | @@ -174,7 +172,7 @@ class KTWebService | ||
| 174 | 'name' => 'string', | 172 | 'name' => 'string', |
| 175 | 'value' => 'string', | 173 | 'value' => 'string', |
| 176 | 'parent_id' => 'int' | 174 | 'parent_id' => 'int' |
| 177 | - ); | 175 | + ); |
| 178 | 176 | ||
| 179 | 177 | ||
| 180 | $this->__typedef["{urn:$this->namespace}kt_metadata_selection"] = | 178 | $this->__typedef["{urn:$this->namespace}kt_metadata_selection"] = |
| @@ -182,7 +180,7 @@ class KTWebService | @@ -182,7 +180,7 @@ class KTWebService | ||
| 182 | array( | 180 | array( |
| 183 | 'item' => "{urn:$this->namespace}kt_metadata_selection_item" | 181 | 'item' => "{urn:$this->namespace}kt_metadata_selection_item" |
| 184 | ) | 182 | ) |
| 185 | - ); | 183 | + ); |
| 186 | 184 | ||
| 187 | 185 | ||
| 188 | $this->__typedef["{urn:$this->namespace}kt_metadata_field"] = | 186 | $this->__typedef["{urn:$this->namespace}kt_metadata_field"] = |
| @@ -192,7 +190,7 @@ class KTWebService | @@ -192,7 +190,7 @@ class KTWebService | ||
| 192 | 'value' => 'string' , | 190 | 'value' => 'string' , |
| 193 | 'description' => 'string' , | 191 | 'description' => 'string' , |
| 194 | 'control_type' => 'string' , | 192 | 'control_type' => 'string' , |
| 195 | - 'selection' => "{urn:$this->namespace}kt_metadata_selection" , | 193 | + 'selection' => "{urn:$this->namespace}kt_metadata_selection" |
| 196 | ); | 194 | ); |
| 197 | 195 | ||
| 198 | $this->__typedef["{urn:$this->namespace}kt_metadata_fields"] = | 196 | $this->__typedef["{urn:$this->namespace}kt_metadata_fields"] = |
| @@ -201,6 +199,7 @@ class KTWebService | @@ -201,6 +199,7 @@ class KTWebService | ||
| 201 | 'field' => "{urn:$this->namespace}kt_metadata_field" | 199 | 'field' => "{urn:$this->namespace}kt_metadata_field" |
| 202 | ) | 200 | ) |
| 203 | ); | 201 | ); |
| 202 | + | ||
| 204 | $this->__typedef["{urn:$this->namespace}kt_metadata_fieldset"] = | 203 | $this->__typedef["{urn:$this->namespace}kt_metadata_fieldset"] = |
| 205 | array( | 204 | array( |
| 206 | 'fieldset' => 'string', | 205 | 'fieldset' => 'string', |
| @@ -213,7 +212,7 @@ class KTWebService | @@ -213,7 +212,7 @@ class KTWebService | ||
| 213 | array( | 212 | array( |
| 214 | 'fieldset' => "{urn:$this->namespace}kt_metadata_fieldset" | 213 | 'fieldset' => "{urn:$this->namespace}kt_metadata_fieldset" |
| 215 | ) | 214 | ) |
| 216 | - ); | 215 | + ); |
| 217 | 216 | ||
| 218 | $this->__typedef["{urn:$this->namespace}kt_metadata_response"] = | 217 | $this->__typedef["{urn:$this->namespace}kt_metadata_response"] = |
| 219 | array( | 218 | array( |
| @@ -227,14 +226,14 @@ class KTWebService | @@ -227,14 +226,14 @@ class KTWebService | ||
| 227 | array( | 226 | array( |
| 228 | 'transition' => 'string' | 227 | 'transition' => 'string' |
| 229 | ) | 228 | ) |
| 230 | - ); | 229 | + ); |
| 231 | 230 | ||
| 232 | $this->__typedef["{urn:$this->namespace}kt_document_transitions_response"] = | 231 | $this->__typedef["{urn:$this->namespace}kt_document_transitions_response"] = |
| 233 | array( | 232 | array( |
| 234 | 'status_code'=>'int', | 233 | 'status_code'=>'int', |
| 235 | 'message'=>'string', | 234 | 'message'=>'string', |
| 236 | 'metadata' => "{urn:$this->namespace}kt_document_transitions" | 235 | 'metadata' => "{urn:$this->namespace}kt_document_transitions" |
| 237 | - ); | 236 | + ); |
| 238 | 237 | ||
| 239 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = | 238 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_item"] = |
| 240 | array( | 239 | array( |
| @@ -244,16 +243,14 @@ class KTWebService | @@ -244,16 +243,14 @@ class KTWebService | ||
| 244 | 'comment' => 'string', | 243 | 'comment' => 'string', |
| 245 | 'datetime' => 'string', | 244 | 'datetime' => 'string', |
| 246 | 245 | ||
| 247 | - ); | ||
| 248 | - | 246 | + ); |
| 249 | 247 | ||
| 250 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history"] = | 248 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history"] = |
| 251 | array( | 249 | array( |
| 252 | array( | 250 | array( |
| 253 | 'history' => "{urn:$this->namespace}kt_document_transaction_history_item" | 251 | 'history' => "{urn:$this->namespace}kt_document_transaction_history_item" |
| 254 | ) | 252 | ) |
| 255 | - ); | ||
| 256 | - | 253 | + ); |
| 257 | 254 | ||
| 258 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_response"] = | 255 | $this->__typedef["{urn:$this->namespace}kt_document_transaction_history_response"] = |
| 259 | array( | 256 | array( |
| @@ -267,16 +264,14 @@ class KTWebService | @@ -267,16 +264,14 @@ class KTWebService | ||
| 267 | 'user'=>'int', | 264 | 'user'=>'int', |
| 268 | 'metadata_version'=>'string', | 265 | 'metadata_version'=>'string', |
| 269 | 'content_version'=>'string', | 266 | 'content_version'=>'string', |
| 270 | - ); | ||
| 271 | - | 267 | + ); |
| 272 | 268 | ||
| 273 | $this->__typedef["{urn:$this->namespace}kt_document_version_history"] = | 269 | $this->__typedef["{urn:$this->namespace}kt_document_version_history"] = |
| 274 | array( | 270 | array( |
| 275 | array( | 271 | array( |
| 276 | 'history' => "{urn:$this->namespace}kt_document_version_history_item" | 272 | 'history' => "{urn:$this->namespace}kt_document_version_history_item" |
| 277 | ) | 273 | ) |
| 278 | - ); | ||
| 279 | - | 274 | + ); |
| 280 | 275 | ||
| 281 | $this->__typedef["{urn:$this->namespace}kt_document_version_history_response"] = | 276 | $this->__typedef["{urn:$this->namespace}kt_document_version_history_response"] = |
| 282 | array( | 277 | array( |
| @@ -285,21 +280,19 @@ class KTWebService | @@ -285,21 +280,19 @@ class KTWebService | ||
| 285 | 'history' => "{urn:$this->namespace}kt_document_version_history" | 280 | 'history' => "{urn:$this->namespace}kt_document_version_history" |
| 286 | ); | 281 | ); |
| 287 | 282 | ||
| 288 | - | ||
| 289 | $this->__typedef["{urn:$this->namespace}kt_document_types_array"] = | 283 | $this->__typedef["{urn:$this->namespace}kt_document_types_array"] = |
| 290 | array( | 284 | array( |
| 291 | array( | 285 | array( |
| 292 | 'document_type' => 'string' | 286 | 'document_type' => 'string' |
| 293 | ) | 287 | ) |
| 294 | - ); | 288 | + ); |
| 295 | 289 | ||
| 296 | $this->__typedef["{urn:$this->namespace}kt_document_types_response"] = | 290 | $this->__typedef["{urn:$this->namespace}kt_document_types_response"] = |
| 297 | array( | 291 | array( |
| 298 | 'status_code' => 'int', | 292 | 'status_code' => 'int', |
| 299 | 'message' => 'string', | 293 | 'message' => 'string', |
| 300 | 'document_types' => "{urn:$this->namespace}kt_document_types_array" | 294 | 'document_types' => "{urn:$this->namespace}kt_document_types_array" |
| 301 | - ); | ||
| 302 | - | 295 | + ); |
| 303 | 296 | ||
| 304 | /* methods */ | 297 | /* methods */ |
| 305 | 298 | ||
| @@ -676,6 +669,63 @@ class KTWebService | @@ -676,6 +669,63 @@ class KTWebService | ||
| 676 | } | 669 | } |
| 677 | 670 | ||
| 678 | /** | 671 | /** |
| 672 | + * Encodes an array as kt_folder_item | ||
| 673 | + * | ||
| 674 | + * @param array $item | ||
| 675 | + * @param string $name | ||
| 676 | + * @return SOAP_Value of kt_folder_item | ||
| 677 | + * @access private | ||
| 678 | + * @static | ||
| 679 | + */ | ||
| 680 | + function _encode_folder_item($item, $name='item') | ||
| 681 | + { | ||
| 682 | + $item['id'] = (int) $item['id']; | ||
| 683 | + | ||
| 684 | + if (!empty($item['items'])) | ||
| 685 | + { | ||
| 686 | + $item['items'] = KTWebService::_encode_folder_items($item['items']); | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_folder_item", $item); | ||
| 690 | + } | ||
| 691 | + | ||
| 692 | + /** | ||
| 693 | + * Encodes an array as kt_folder_items | ||
| 694 | + * | ||
| 695 | + * @param array $items | ||
| 696 | + * @param string $name | ||
| 697 | + * @return SOAP_Value of kt_folder_items | ||
| 698 | + * @access private | ||
| 699 | + * @static | ||
| 700 | + */ | ||
| 701 | + function _encode_folder_items($items, $name='items') | ||
| 702 | + { | ||
| 703 | + $encoded=array(); | ||
| 704 | + foreach($items as $item) | ||
| 705 | + { | ||
| 706 | + $encoded[] = KTWebService::_encode_folder_item($item); | ||
| 707 | + } | ||
| 708 | + | ||
| 709 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_folder_items", $encoded); | ||
| 710 | + } | ||
| 711 | + | ||
| 712 | + /** | ||
| 713 | + * Encodes an array as kt_folder_contents | ||
| 714 | + * | ||
| 715 | + * @param array $contents | ||
| 716 | + * @param string $name | ||
| 717 | + * @return SOAP_Value of kt_folder_contents | ||
| 718 | + * @access private | ||
| 719 | + * @static | ||
| 720 | + */ | ||
| 721 | + function _encode_folder_contents($contents, $name='return') | ||
| 722 | + { | ||
| 723 | + $contents['items'] = KTWebService::_encode_folder_items($contents['items']); | ||
| 724 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_folder_contents", $contents); | ||
| 725 | + } | ||
| 726 | + | ||
| 727 | + | ||
| 728 | + /** | ||
| 679 | * Returns the contents of a folder. | 729 | * Returns the contents of a folder. |
| 680 | * | 730 | * |
| 681 | * @param string $session_id | 731 | * @param string $session_id |
| @@ -713,7 +763,7 @@ class KTWebService | @@ -713,7 +763,7 @@ class KTWebService | ||
| 713 | 'items'=>$listing | 763 | 'items'=>$listing |
| 714 | ); | 764 | ); |
| 715 | 765 | ||
| 716 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_folder_contents", $contents); | 766 | + return KTWebService::_encode_folder_contents($contents); |
| 717 | } | 767 | } |
| 718 | 768 | ||
| 719 | /** | 769 | /** |
| @@ -1741,6 +1791,161 @@ class KTWebService | @@ -1741,6 +1791,161 @@ class KTWebService | ||
| 1741 | } | 1791 | } |
| 1742 | 1792 | ||
| 1743 | /** | 1793 | /** |
| 1794 | + * Encodes the array as a kt_metadata_selection_item | ||
| 1795 | + * | ||
| 1796 | + * @param aray $item | ||
| 1797 | + * @param string $name | ||
| 1798 | + * @return SOAP_Value of kt_metadata_selection_item | ||
| 1799 | + * @access private | ||
| 1800 | + * @static | ||
| 1801 | + */ | ||
| 1802 | + function _encode_metadata_selection_item($item, $name='item') | ||
| 1803 | + { | ||
| 1804 | + if (!is_null($item['id'])) | ||
| 1805 | + { | ||
| 1806 | + $item['id'] = (int) $item['id']; | ||
| 1807 | + } | ||
| 1808 | + | ||
| 1809 | + if (!is_null($item['parent_id'])) | ||
| 1810 | + { | ||
| 1811 | + $item['parent_id'] = (int) $item['parent_id']; | ||
| 1812 | + } | ||
| 1813 | + | ||
| 1814 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection_item", $item); | ||
| 1815 | + } | ||
| 1816 | + | ||
| 1817 | + /** | ||
| 1818 | + * Encode an array as kt_metadata_selection | ||
| 1819 | + * | ||
| 1820 | + * @param array $selection | ||
| 1821 | + * @param string $name | ||
| 1822 | + * @return SOAP_Value of kt_metadata_selection | ||
| 1823 | + * @access private | ||
| 1824 | + * @static | ||
| 1825 | + */ | ||
| 1826 | + | ||
| 1827 | + function _encode_metadata_selection($selection, $name='selection') | ||
| 1828 | + { | ||
| 1829 | + $encoded=array(); | ||
| 1830 | + foreach($selection as $field) | ||
| 1831 | + { | ||
| 1832 | + $encoded[] = KTWebService::_encode_metadata_selection_item($field); | ||
| 1833 | + } | ||
| 1834 | + | ||
| 1835 | + if (empty($encoded)) | ||
| 1836 | + { | ||
| 1837 | + $encoded=null; | ||
| 1838 | + } | ||
| 1839 | + | ||
| 1840 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_selection", $encoded); | ||
| 1841 | + } | ||
| 1842 | + | ||
| 1843 | + /** | ||
| 1844 | + * Encode an array as kt_metadata_field | ||
| 1845 | + * | ||
| 1846 | + * @param arra $field | ||
| 1847 | + * @param string $name | ||
| 1848 | + * @return SOAP_Value of kt_metadata_field | ||
| 1849 | + * @access private | ||
| 1850 | + * @static | ||
| 1851 | + */ | ||
| 1852 | + | ||
| 1853 | + function _encode_metadata_field($field, $name='field') | ||
| 1854 | + { | ||
| 1855 | + if (!empty($field['selection'])) | ||
| 1856 | + { | ||
| 1857 | + $field['selection'] = KTWebService::_encode_metadata_selection($field['selection']); | ||
| 1858 | + } | ||
| 1859 | + if (!is_null($field['required'])) | ||
| 1860 | + { | ||
| 1861 | + $field['required'] = (bool) $field['required']; | ||
| 1862 | + } | ||
| 1863 | + | ||
| 1864 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_field", $field); | ||
| 1865 | + } | ||
| 1866 | + | ||
| 1867 | + /** | ||
| 1868 | + * Encode an array as kt_metadata_fields | ||
| 1869 | + * | ||
| 1870 | + * @param array $fields | ||
| 1871 | + * @param string $name | ||
| 1872 | + * @return SOAP_Value of kt_metadata_fields | ||
| 1873 | + * @access private | ||
| 1874 | + * @static | ||
| 1875 | + */ | ||
| 1876 | + function _encode_metadata_fields($fields, $name='fields') | ||
| 1877 | + { | ||
| 1878 | + $encoded=array(); | ||
| 1879 | + foreach($fields as $field) | ||
| 1880 | + { | ||
| 1881 | + $encoded[] = KTWebService::_encode_metadata_field($field); | ||
| 1882 | + } | ||
| 1883 | + if (empty($encoded)) | ||
| 1884 | + { | ||
| 1885 | + $encoded=null; | ||
| 1886 | + } | ||
| 1887 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_fields", $encoded); | ||
| 1888 | + } | ||
| 1889 | + | ||
| 1890 | + /** | ||
| 1891 | + * Encode an array as kt_metadata_fieldset | ||
| 1892 | + * | ||
| 1893 | + * @param array $fieldset | ||
| 1894 | + * @param string $name | ||
| 1895 | + * @return SOAP_Value of kt_metadata_fieldset | ||
| 1896 | + * @access private | ||
| 1897 | + * @static | ||
| 1898 | + */ | ||
| 1899 | + function _encode_metadata_fieldset($fieldset, $name='fieldset') | ||
| 1900 | + { | ||
| 1901 | + if (!empty($fieldset['fields'])) | ||
| 1902 | + { | ||
| 1903 | + $fieldset['fields'] = KTWebService::_encode_metadata_fields($fieldset['fields']); | ||
| 1904 | + } | ||
| 1905 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_fieldset", $fieldset); | ||
| 1906 | + } | ||
| 1907 | + | ||
| 1908 | + /** | ||
| 1909 | + * Encode an array as kt_metadata_fieldsets | ||
| 1910 | + * | ||
| 1911 | + * @param array $fieldsets | ||
| 1912 | + * @param string $name | ||
| 1913 | + * @return SOAP_Value of kt_metadata_fieldsets | ||
| 1914 | + * @access private | ||
| 1915 | + * @static | ||
| 1916 | + */ | ||
| 1917 | + function _encode_metadata_fieldsets($fieldsets, $name='metadata') | ||
| 1918 | + { | ||
| 1919 | + $encoded=array(); | ||
| 1920 | + foreach($fieldsets as $fieldset) | ||
| 1921 | + { | ||
| 1922 | + $encoded[] = KTWebService::_encode_metadata_fieldset($fieldset); | ||
| 1923 | + } | ||
| 1924 | + if (empty($encoded)) | ||
| 1925 | + { | ||
| 1926 | + $encoded=null; | ||
| 1927 | + } | ||
| 1928 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_fieldsets", $encoded); | ||
| 1929 | + } | ||
| 1930 | + | ||
| 1931 | + /** | ||
| 1932 | + * Encodes an array into a kt_metadata_response | ||
| 1933 | + * | ||
| 1934 | + * @param array $response | ||
| 1935 | + * @param string $name | ||
| 1936 | + * @return SOAP_Value of kt_metadata_response | ||
| 1937 | + * @access private | ||
| 1938 | + * @static | ||
| 1939 | + */ | ||
| 1940 | + function _encode_metadata_response($response, $name='return') | ||
| 1941 | + { | ||
| 1942 | + $response['metadata'] = KTWebService::_encode_metadata_fieldsets($response['metadata']); | ||
| 1943 | + | ||
| 1944 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_metadata_response", $response); | ||
| 1945 | + | ||
| 1946 | + } | ||
| 1947 | + | ||
| 1948 | + /** | ||
| 1744 | * Returns the metadata on a document. | 1949 | * Returns the metadata on a document. |
| 1745 | * | 1950 | * |
| 1746 | * @param string $session_id | 1951 | * @param string $session_id |
| @@ -1795,8 +2000,7 @@ class KTWebService | @@ -1795,8 +2000,7 @@ class KTWebService | ||
| 1795 | 'message' => '', | 2000 | 'message' => '', |
| 1796 | 'metadata' => $metadata); | 2001 | 'metadata' => $metadata); |
| 1797 | 2002 | ||
| 1798 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); | ||
| 1799 | - | 2003 | + return KTWebService::_encode_metadata_response($response); |
| 1800 | } | 2004 | } |
| 1801 | 2005 | ||
| 1802 | /** | 2006 | /** |
| @@ -1920,18 +2124,68 @@ class KTWebService | @@ -1920,18 +2124,68 @@ class KTWebService | ||
| 1920 | } | 2124 | } |
| 1921 | 2125 | ||
| 1922 | /** | 2126 | /** |
| 2127 | + * Encode an array as kt_document_transaction_history_item | ||
| 2128 | + * | ||
| 2129 | + * @param array $item | ||
| 2130 | + * @param string $name | ||
| 2131 | + * @return SOAP_Value of kt_document_transaction_history_item | ||
| 2132 | + * @access private | ||
| 2133 | + * @static | ||
| 2134 | + */ | ||
| 2135 | + function _encode_transaction_history_item($item, $name='item') | ||
| 2136 | + { | ||
| 2137 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history_item", $item); | ||
| 2138 | + } | ||
| 2139 | + | ||
| 2140 | + /** | ||
| 2141 | + * Encode an array as kt_document_transaction_history | ||
| 2142 | + * | ||
| 2143 | + * @param array $history | ||
| 2144 | + * @param string $name | ||
| 2145 | + * @return SOAP_Value of kt_document_transaction_history | ||
| 2146 | + * @access private | ||
| 2147 | + * @static | ||
| 2148 | + */ | ||
| 2149 | + function _encode_transaction_history($history, $name='history') | ||
| 2150 | + { | ||
| 2151 | + $encoded=array(); | ||
| 2152 | + foreach($history as $item) | ||
| 2153 | + { | ||
| 2154 | + $encoded[] = KTWebService::_encode_transaction_history_item($item); | ||
| 2155 | + } | ||
| 2156 | + | ||
| 2157 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history", $encoded); | ||
| 2158 | + } | ||
| 2159 | + | ||
| 2160 | + /** | ||
| 2161 | + * Encode an array as kt_document_transaction_history_response | ||
| 2162 | + * | ||
| 2163 | + * @param array $response | ||
| 2164 | + * @param string $name | ||
| 2165 | + * @return SOAP_Value of kt_document_transaction_history_response | ||
| 2166 | + * @access private | ||
| 2167 | + * @static | ||
| 2168 | + */ | ||
| 2169 | + function _encode_transaction_history_response($response, $name='return') | ||
| 2170 | + { | ||
| 2171 | + $response['history'] = KTWebService::_encode_transaction_history($response['history']); | ||
| 2172 | + | ||
| 2173 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_transaction_history_response", $response); | ||
| 2174 | + } | ||
| 2175 | + | ||
| 2176 | + /** | ||
| 1923 | * Returns the document transaction history. | 2177 | * Returns the document transaction history. |
| 1924 | * | 2178 | * |
| 1925 | * @param string $session_id | 2179 | * @param string $session_id |
| 1926 | * @param int $document_id | 2180 | * @param int $document_id |
| 1927 | - * @return kt_transaction_history_response | 2181 | + * @return kt_document_transaction_history_response |
| 1928 | */ | 2182 | */ |
| 1929 | function get_document_transaction_history($session_id, $document_id) | 2183 | function get_document_transaction_history($session_id, $document_id) |
| 1930 | { | 2184 | { |
| 1931 | $kt = &$this->get_ktapi($session_id ); | 2185 | $kt = &$this->get_ktapi($session_id ); |
| 1932 | if (is_array($kt)) | 2186 | if (is_array($kt)) |
| 1933 | { | 2187 | { |
| 1934 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_transaction_history_response", $kt); | 2188 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_transaction_history_response", $kt); |
| 1935 | } | 2189 | } |
| 1936 | $response=array( | 2190 | $response=array( |
| 1937 | 'status_code'=>KTWS_ERR_INVALID_DOCUMENT, | 2191 | 'status_code'=>KTWS_ERR_INVALID_DOCUMENT, |
| @@ -1942,7 +2196,7 @@ class KTWebService | @@ -1942,7 +2196,7 @@ class KTWebService | ||
| 1942 | if (PEAR::isError($document)) | 2196 | if (PEAR::isError($document)) |
| 1943 | { | 2197 | { |
| 1944 | $response['message'] = $document->getMessage(); | 2198 | $response['message'] = $document->getMessage(); |
| 1945 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_transaction_history_response", $response); | 2199 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_transaction_history_response", $response); |
| 1946 | } | 2200 | } |
| 1947 | 2201 | ||
| 1948 | $result = $document->get_transaction_history(); | 2202 | $result = $document->get_transaction_history(); |
| @@ -1950,16 +2204,67 @@ class KTWebService | @@ -1950,16 +2204,67 @@ class KTWebService | ||
| 1950 | { | 2204 | { |
| 1951 | $response['status_code'] = KTWS_PROBLEM; | 2205 | $response['status_code'] = KTWS_PROBLEM; |
| 1952 | $response['message'] = $result->getMessage(); | 2206 | $response['message'] = $result->getMessage(); |
| 1953 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_transaction_history_response", $response); | 2207 | + return new SOAP_Value('return',"{urn:$this->namespace}kt_document_transaction_history_response", $response); |
| 1954 | } | 2208 | } |
| 1955 | 2209 | ||
| 1956 | $response['status_code'] = KTWS_SUCCESS; | 2210 | $response['status_code'] = KTWS_SUCCESS; |
| 1957 | $response['history'] = $result; | 2211 | $response['history'] = $result; |
| 1958 | 2212 | ||
| 1959 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_transaction_history_response", $response); | 2213 | + return KTWebService::_encode_transaction_history_response($response); |
| 2214 | + } | ||
| 2215 | + | ||
| 2216 | + /** | ||
| 2217 | + * Encode an array as kt_document_version_history_item | ||
| 2218 | + * | ||
| 2219 | + * @param array $item | ||
| 2220 | + * @param string $name | ||
| 2221 | + * @return SOAP_Value of kt_document_version_history_item | ||
| 2222 | + * @access private | ||
| 2223 | + * @static | ||
| 2224 | + */ | ||
| 2225 | + function _encode_version_history_item($item, $name='item') | ||
| 2226 | + { | ||
| 2227 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history_item", $item); | ||
| 2228 | + } | ||
| 2229 | + | ||
| 2230 | + /** | ||
| 2231 | + * Encode an array as kt_document_version_history | ||
| 2232 | + * | ||
| 2233 | + * @param array $history | ||
| 2234 | + * @param string $name | ||
| 2235 | + * @return SOAP_Value of kt_document_version_history | ||
| 2236 | + * @access private | ||
| 2237 | + * @static | ||
| 2238 | + */ | ||
| 2239 | + function _encode_version_history($history, $name='history') | ||
| 2240 | + { | ||
| 2241 | + $encoded=array(); | ||
| 2242 | + foreach($history as $item) | ||
| 2243 | + { | ||
| 2244 | + $encoded[] = KTWebService::_encode_version_history_item($item); | ||
| 2245 | + } | ||
| 2246 | + | ||
| 2247 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history", $encoded); | ||
| 1960 | } | 2248 | } |
| 1961 | 2249 | ||
| 1962 | /** | 2250 | /** |
| 2251 | + * Encode an array as kt_document_version_history_response | ||
| 2252 | + * | ||
| 2253 | + * @param array $response | ||
| 2254 | + * @param string $name | ||
| 2255 | + * @return SOAP_Value of kt_document_version_history_response | ||
| 2256 | + * @access private | ||
| 2257 | + * @static | ||
| 2258 | + */ | ||
| 2259 | + function _encode_version_history_response($response, $name='return') | ||
| 2260 | + { | ||
| 2261 | + $response['history'] = KTWebService::_encode_version_history($response['history']); | ||
| 2262 | + | ||
| 2263 | + return new SOAP_Value($name,"{urn:$this->namespace}kt_document_version_history_response", $response); | ||
| 2264 | + } | ||
| 2265 | + | ||
| 2266 | + | ||
| 2267 | + /** | ||
| 1963 | * Returns the version history. | 2268 | * Returns the version history. |
| 1964 | * | 2269 | * |
| 1965 | * @param string $session_id | 2270 | * @param string $session_id |
| @@ -1996,7 +2301,7 @@ class KTWebService | @@ -1996,7 +2301,7 @@ class KTWebService | ||
| 1996 | $response['status_code'] = KTWS_SUCCESS; | 2301 | $response['status_code'] = KTWS_SUCCESS; |
| 1997 | $response['history'] = $result; | 2302 | $response['history'] = $result; |
| 1998 | 2303 | ||
| 1999 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_document_version_history_response", $response); | 2304 | + return KTWebService::_encode_version_history_response($response); |
| 2000 | } | 2305 | } |
| 2001 | 2306 | ||
| 2002 | /** | 2307 | /** |