Commit 90dc8fb104a09ba427de075aa617b62e8bbc8186
1 parent
708d34e3
WSA-67
"Add error code for unknown document type" Fixed. Committed By: Conrad Vermeulen Reviewed By: Martin Kirsten git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@8043 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
4 changed files
with
11 additions
and
7 deletions
ktapi/KTAPIDocument.inc.php
| ... | ... | @@ -1611,7 +1611,7 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1611 | 1611 | $detail['workflow_state']=$workflowstate; |
| 1612 | 1612 | |
| 1613 | 1613 | // get the full path |
| 1614 | - $detail['full_path'] = $this->ktapi_folder->get_full_path() . '/' . $this->get_title(); | |
| 1614 | + $detail['full_path'] = '/' . $this->document->getFullPath(); | |
| 1615 | 1615 | |
| 1616 | 1616 | // get mime info |
| 1617 | 1617 | $mimetypeid = $document->getMimeTypeID(); | ... | ... |
ktapi/KTAPIFolder.inc.php
| ... | ... | @@ -210,8 +210,8 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 210 | 210 | |
| 211 | 211 | function get_full_path() |
| 212 | 212 | { |
| 213 | - $path = $this->folder->getFullPath() . '/' . $this->folder->getName(); | |
| 214 | - if (substr($path,0,1) == '/') $path = substr($path,1); | |
| 213 | + $path = $this->folder->getFullPath(); | |
| 214 | + if (empty($path)) $path = '/'; | |
| 215 | 215 | |
| 216 | 216 | return $path; |
| 217 | 217 | } |
| ... | ... | @@ -604,7 +604,7 @@ class KTAPI_Folder extends KTAPI_FolderItem |
| 604 | 604 | } |
| 605 | 605 | else |
| 606 | 606 | { |
| 607 | - return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype); | |
| 607 | + return new KTAPI_DocumentTypeError('The document type could not be resolved or is disabled: ' . $documenttype); | |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | ... | ... |
ktapi/ktapi.inc.php
| ... | ... | @@ -70,7 +70,7 @@ class KTAPI_FolderItem |
| 70 | 70 | |
| 71 | 71 | class KTAPI_Error extends PEAR_Error |
| 72 | 72 | { |
| 73 | - function KTAPI_Error($msg, $obj) | |
| 73 | + function KTAPI_Error($msg, $obj = null) | |
| 74 | 74 | { |
| 75 | 75 | if (PEAR::isError($obj)) |
| 76 | 76 | { |
| ... | ... | @@ -83,6 +83,8 @@ class KTAPI_Error extends PEAR_Error |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | +class KTAPI_DocumentTypeError extends KTAPI_Error {} | |
| 87 | + | |
| 86 | 88 | class KTAPI |
| 87 | 89 | { |
| 88 | 90 | /** | ... | ... |
ktwebservice/webservice.php
| ... | ... | @@ -1951,7 +1951,8 @@ class KTWebService |
| 1951 | 1951 | $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename); |
| 1952 | 1952 | if (PEAR::isError($document)) |
| 1953 | 1953 | { |
| 1954 | - $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT,$document); | |
| 1954 | + $status = is_a($document, 'KTAPI_DocumentTypeError')?KTWS_ERR_INVALID_DOCUMENT_TYPE:KTWS_ERR_INVALID_DOCUMENT; | |
| 1955 | + $response = KTWebService::_status($status, $document); | |
| 1955 | 1956 | $this->debug("add_document - cannot add document - " . $document->getMessage(), $session_id); |
| 1956 | 1957 | return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); |
| 1957 | 1958 | } |
| ... | ... | @@ -2130,7 +2131,8 @@ class KTWebService |
| 2130 | 2131 | $document = &$folder->add_document($title, $filename, $documenttype, $tempfilename); |
| 2131 | 2132 | if (PEAR::isError($document)) |
| 2132 | 2133 | { |
| 2133 | - $response = KTWebService::_status(KTWS_ERR_INVALID_DOCUMENT,$document); | |
| 2134 | + $status = is_a($document, 'KTAPI_DocumentTypeError')?KTWS_ERR_INVALID_DOCUMENT_TYPE:KTWS_ERR_INVALID_DOCUMENT; | |
| 2135 | + $response = KTWebService::_status($status,$document); | |
| 2134 | 2136 | |
| 2135 | 2137 | $this->debug("add_small_document - cannot add document - " . $document->getMessage(), $session_id); |
| 2136 | 2138 | return new SOAP_Value('return',"{urn:$this->namespace}kt_document_detail", $response); | ... | ... |