Commit f6e184d9fd568b599e8a3b776b1aea8d7859480f

Authored by conradverm
1 parent 80d66d1b

WSA-96

"Adding a document via web service should default to default document type if it does not exist. This is compatible with previous DWI operations"
Fixed.

Committed By: Conrad Vermeulen
Reviewed By: Megan Watson


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7880 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 11 additions and 4 deletions
ktapi/KTAPIFolder.inc.php
... ... @@ -137,9 +137,7 @@ class KTAPI_Folder extends KTAPI_FolderItem
137 137 // TODO: we should only clear the cache for the document we are working on
138 138 // this is a quick fix but not optimal!!
139 139  
140   - $cache = KTCache::getSingleton();
141   -
142   - $cache->remove('Folder/id', $this->folderid);
  140 + $GLOBALS["_OBJECTCACHE"]['Folder'] = array();
143 141  
144 142 $this->folder = &Folder::get($this->folderid);
145 143 }
... ... @@ -598,7 +596,16 @@ class KTAPI_Folder extends KTAPI_FolderItem
598 596 $documenttypeid = KTAPI::get_documenttypeid($documenttype);
599 597 if (PEAR::isError($documenttypeid))
600 598 {
601   - return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype);
  599 + $config = KTCache::getSingleton();
  600 + $defaultToDefaultDocType = $config->get('webservice/useDefaultDocumentTypeIfInvalid',true);
  601 + if ($defaultToDefaultDocType)
  602 + {
  603 + $documenttypeid = KTAPI::get_documenttypeid('Default');
  604 + }
  605 + else
  606 + {
  607 + return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype);
  608 + }
602 609 }
603 610  
604 611  
... ...