Commit 58e97e31973af4d13c01f6a319d599bbfc2e52bc

Authored by kevin_fourie
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
ktapi/KTAPIDocument.inc.php
... ... @@ -873,6 +873,10 @@ class KTAPI_Document extends KTAPI_FolderItem
873 873 {
874 874 $doctypeid = $this->document->getDocumentTypeID();
875 875 $fieldsets = (array) KTMetadataUtil::fieldsetsForDocument($this->document, $doctypeid);
  876 + if (is_null($fieldsets) || PEAR::isError($fieldsets))
  877 + {
  878 + return array();
  879 + }
876 880  
877 881 $results = array();
878 882  
... ...
ktapi/ktapi.inc.php
... ... @@ -384,14 +384,14 @@ class KTAPI
384 384 {
385 385 // now get document type specifc ids
386 386 $typeid =$this->get_documenttypeid($document_type);
387   - if (PEAR::isError($typeid))
  387 + if (is_null($typeid) || PEAR::isError($typeid))
388 388 {
389 389 $response['message'] = $typeid->getMessage();
390 390 return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response);
391 391 }
392 392  
393 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 396 $response['message'] = $generic_ids->getMessage();
397 397 return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response);
... ... @@ -399,7 +399,7 @@ class KTAPI
399 399  
400 400 // first get generic ids
401 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 404 $response['message'] = $generic_ids->getMessage();
405 405 return new SOAP_Value('return',"{urn:$this->namespace}kt_metadata_response", $response);
... ...