Commit 290a688873f8e3c61fe69def911af46f0dd43461
1 parent
11320e62
Merged in from DEV trunk...
WSA-106 "KT_Error is used with insufficient parameters" Fixed. Committed By: Conrad Vermeulen Reviewed By: Megan Watson WSA-107 "Checkout returns kt_response and not kt_document_detail" Fixed. Committed By: Conrad Vermeulen Reviewed By: Megan Watson git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8011 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
23 additions
and
11 deletions
ktapi/KTAPIDocument.inc.php
| @@ -1076,12 +1076,12 @@ class KTAPI_Document extends KTAPI_FolderItem | @@ -1076,12 +1076,12 @@ class KTAPI_Document extends KTAPI_FolderItem | ||
| 1076 | if (is_null($result)) | 1076 | if (is_null($result)) |
| 1077 | { | 1077 | { |
| 1078 | DBUtil::rollback(); | 1078 | DBUtil::rollback(); |
| 1079 | - return new KTAPI_Error(KTAPI_ERROR_INTERNAL_ERROR); | 1079 | + return new PEAR_Error(KTAPI_ERROR_INTERNAL_ERROR . ': Null result returned but not expected.'); |
| 1080 | } | 1080 | } |
| 1081 | if (PEAR::isError($result)) | 1081 | if (PEAR::isError($result)) |
| 1082 | { | 1082 | { |
| 1083 | DBUtil::rollback(); | 1083 | DBUtil::rollback(); |
| 1084 | - return new KTAPI_Error(sprintf(_kt("Unexpected validation failure: %s."), $result->getMessage())); | 1084 | + return new KTAPI_Error('Unexpected validation failure', $result); |
| 1085 | } | 1085 | } |
| 1086 | DBUtil::commit(); | 1086 | DBUtil::commit(); |
| 1087 | 1087 |
ktwebservice/webservice.php
| @@ -2283,7 +2283,7 @@ class KTWebService | @@ -2283,7 +2283,7 @@ class KTWebService | ||
| 2283 | * @param string $reason | 2283 | * @param string $reason |
| 2284 | * @param string $base64 | 2284 | * @param string $base64 |
| 2285 | * @param boolean $major_update | 2285 | * @param boolean $major_update |
| 2286 | - * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_FOLDER, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS | 2286 | + * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_DOCUMENT, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS |
| 2287 | */ | 2287 | */ |
| 2288 | function checkin_small_document($session_id, $document_id, $filename, $reason, $base64, $major_update ) | 2288 | function checkin_small_document($session_id, $document_id, $filename, $reason, $base64, $major_update ) |
| 2289 | { | 2289 | { |
| @@ -2335,16 +2335,22 @@ class KTWebService | @@ -2335,16 +2335,22 @@ class KTWebService | ||
| 2335 | * @param string $session_id | 2335 | * @param string $session_id |
| 2336 | * @param int $document_id | 2336 | * @param int $document_id |
| 2337 | * @param string $reason | 2337 | * @param string $reason |
| 2338 | - * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_FOLDER or KTWS_SUCCESS | 2338 | + * @return kt_document_detail. status_code can be KTWS_ERR_INVALID_SESSION, KTWS_ERR_INVALID_DOCUMENT or KTWS_SUCCESS |
| 2339 | */ | 2339 | */ |
| 2340 | function checkout_document($session_id, $document_id, $reason,$download=true) | 2340 | function checkout_document($session_id, $document_id, $reason,$download=true) |
| 2341 | { | 2341 | { |
| 2342 | $this->debug("checkout_document('$session_id',$document_id,'$reason')"); | 2342 | $this->debug("checkout_document('$session_id',$document_id,'$reason')"); |
| 2343 | 2343 | ||
| 2344 | + $responseType = 'kt_response'; | ||
| 2345 | + if ($this->version >= 2) | ||
| 2346 | + { | ||
| 2347 | + $responseType = 'kt_document_detail'; | ||
| 2348 | + } | ||
| 2349 | + | ||
| 2344 | $kt = &$this->get_ktapi($session_id ); | 2350 | $kt = &$this->get_ktapi($session_id ); |
| 2345 | if (is_array($kt)) | 2351 | if (is_array($kt)) |
| 2346 | { | 2352 | { |
| 2347 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | 2353 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); |
| 2348 | } | 2354 | } |
| 2349 | 2355 | ||
| 2350 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); | 2356 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); |
| @@ -2354,7 +2360,7 @@ class KTWebService | @@ -2354,7 +2360,7 @@ class KTWebService | ||
| 2354 | { | 2360 | { |
| 2355 | $response['message'] = $document->getMessage(); | 2361 | $response['message'] = $document->getMessage(); |
| 2356 | $this->debug("checkout_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); | 2362 | $this->debug("checkout_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); |
| 2357 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | 2363 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 2358 | } | 2364 | } |
| 2359 | 2365 | ||
| 2360 | $result = $document->checkout($reason); | 2366 | $result = $document->checkout($reason); |
| @@ -2362,7 +2368,7 @@ class KTWebService | @@ -2362,7 +2368,7 @@ class KTWebService | ||
| 2362 | { | 2368 | { |
| 2363 | $response['message'] = $result->getMessage(); | 2369 | $response['message'] = $result->getMessage(); |
| 2364 | $this->debug("checkout_document - cannot checkout - " . $result->getMessage(), $session_id); | 2370 | $this->debug("checkout_document - cannot checkout - " . $result->getMessage(), $session_id); |
| 2365 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | 2371 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 2366 | } | 2372 | } |
| 2367 | 2373 | ||
| 2368 | $session = &$kt->get_session(); | 2374 | $session = &$kt->get_session(); |
| @@ -2403,10 +2409,16 @@ class KTWebService | @@ -2403,10 +2409,16 @@ class KTWebService | ||
| 2403 | { | 2409 | { |
| 2404 | $this->debug("checkout_small_document('$session_id',$document_id,'$reason', $download)"); | 2410 | $this->debug("checkout_small_document('$session_id',$document_id,'$reason', $download)"); |
| 2405 | 2411 | ||
| 2412 | + $responseType = 'kt_response'; | ||
| 2413 | + if ($this->version >= 2) | ||
| 2414 | + { | ||
| 2415 | + $responseType = 'kt_document_detail'; | ||
| 2416 | + } | ||
| 2417 | + | ||
| 2406 | $kt = &$this->get_ktapi($session_id ); | 2418 | $kt = &$this->get_ktapi($session_id ); |
| 2407 | if (is_array($kt)) | 2419 | if (is_array($kt)) |
| 2408 | { | 2420 | { |
| 2409 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $kt); | 2421 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $kt); |
| 2410 | } | 2422 | } |
| 2411 | 2423 | ||
| 2412 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); | 2424 | $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT); |
| @@ -2416,7 +2428,7 @@ class KTWebService | @@ -2416,7 +2428,7 @@ class KTWebService | ||
| 2416 | { | 2428 | { |
| 2417 | $response['message'] = $document->getMessage(); | 2429 | $response['message'] = $document->getMessage(); |
| 2418 | $this->debug("checkout_small_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); | 2430 | $this->debug("checkout_small_document - cannot get documentid $document_id - " . $document->getMessage(), $session_id); |
| 2419 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | 2431 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 2420 | } | 2432 | } |
| 2421 | 2433 | ||
| 2422 | $result = $document->checkout($reason); | 2434 | $result = $document->checkout($reason); |
| @@ -2424,7 +2436,7 @@ class KTWebService | @@ -2424,7 +2436,7 @@ class KTWebService | ||
| 2424 | { | 2436 | { |
| 2425 | $response['message'] = $result->getMessage(); | 2437 | $response['message'] = $result->getMessage(); |
| 2426 | $this->debug("checkout_small_document - cannot checkout - " . $result->getMessage(), $session_id); | 2438 | $this->debug("checkout_small_document - cannot checkout - " . $result->getMessage(), $session_id); |
| 2427 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | 2439 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 2428 | } | 2440 | } |
| 2429 | 2441 | ||
| 2430 | $content=''; | 2442 | $content=''; |
| @@ -2440,7 +2452,7 @@ class KTWebService | @@ -2440,7 +2452,7 @@ class KTWebService | ||
| 2440 | { | 2452 | { |
| 2441 | $response['message'] = 'The file is not in the storage system. Please contact an administrator!'; | 2453 | $response['message'] = 'The file is not in the storage system. Please contact an administrator!'; |
| 2442 | $this->debug("checkout_small_document - cannot write $filename ", $session_id); | 2454 | $this->debug("checkout_small_document - cannot write $filename ", $session_id); |
| 2443 | - return new SOAP_Value('return',"{urn:$this->namespace}kt_response", $response); | 2455 | + return new SOAP_Value('return',"{urn:$this->namespace}$responseType", $response); |
| 2444 | } | 2456 | } |
| 2445 | $content = fread($fp, filesize($filename)); | 2457 | $content = fread($fp, filesize($filename)); |
| 2446 | fclose($fp); | 2458 | fclose($fp); |