Commit 58e97e31973af4d13c01f6a319d599bbfc2e52bc
1 parent
ebf66103
Merged in from DEV trunk...
WSA-9 "get_document_metadata() breaks when document_type has no fieldssets" Fixed. Reviewed By: Martin Kirsten git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@7030 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
7 additions
and
3 deletions
ktapi/KTAPIDocument.inc.php
| @@ -873,6 +873,10 @@ class KTAPI_Document extends KTAPI_FolderItem | @@ -873,6 +873,10 @@ class KTAPI_Document extends KTAPI_FolderItem | ||
| 873 | { | 873 | { |
| 874 | $doctypeid = $this->document->getDocumentTypeID(); | 874 | $doctypeid = $this->document->getDocumentTypeID(); |
| 875 | $fieldsets = (array) KTMetadataUtil::fieldsetsForDocument($this->document, $doctypeid); | 875 | $fieldsets = (array) KTMetadataUtil::fieldsetsForDocument($this->document, $doctypeid); |
| 876 | + if (is_null($fieldsets) || PEAR::isError($fieldsets)) | ||
| 877 | + { | ||
| 878 | + return array(); | ||
| 879 | + } | ||
| 876 | 880 | ||
| 877 | $results = array(); | 881 | $results = array(); |
| 878 | 882 |
ktapi/ktapi.inc.php
| @@ -384,14 +384,14 @@ class KTAPI | @@ -384,14 +384,14 @@ class KTAPI | ||
| 384 | { | 384 | { |
| 385 | // now get document type specifc ids | 385 | // now get document type specifc ids |
| 386 | $typeid =$this->get_documenttypeid($document_type); | 386 | $typeid =$this->get_documenttypeid($document_type); |
| 387 | - if (PEAR::isError($typeid)) | 387 | + if (is_null($typeid) || PEAR::isError($typeid)) |
| 388 | { | 388 | { |
| 389 | $response['message'] = $typeid->getMessage(); | 389 | $response['message'] = $typeid->getMessage(); |
| 390 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); | 390 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | $doctype_ids = KTFieldset::getForDocumentType($typeid, array('ids' => false)); | 393 | $doctype_ids = KTFieldset::getForDocumentType($typeid, array('ids' => false)); |
| 394 | - if (PEAR::isError($doctype_ids)) | 394 | + if (is_null($doctype_ids) || PEAR::isError($doctype_ids)) |
| 395 | { | 395 | { |
| 396 | $response['message'] = $generic_ids->getMessage(); | 396 | $response['message'] = $generic_ids->getMessage(); |
| 397 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); | 397 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); |
| @@ -399,7 +399,7 @@ class KTAPI | @@ -399,7 +399,7 @@ class KTAPI | ||
| 399 | 399 | ||
| 400 | // first get generic ids | 400 | // first get generic ids |
| 401 | $generic_ids = KTFieldset::getGenericFieldsets(array('ids' => false)); | 401 | $generic_ids = KTFieldset::getGenericFieldsets(array('ids' => false)); |
| 402 | - if (PEAR::isError($generic_ids)) | 402 | + if (is_null($generic_ids) || PEAR::isError($generic_ids)) |
| 403 | { | 403 | { |
| 404 | $response['message'] = $generic_ids->getMessage(); | 404 | $response['message'] = $generic_ids->getMessage(); |
| 405 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); | 405 | return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response); |