From f6e184d9fd568b599e8a3b776b1aea8d7859480f Mon Sep 17 00:00:00 2001 From: conradverm Date: Wed, 9 Jan 2008 10:30:38 +0000 Subject: [PATCH] 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. --- ktapi/KTAPIFolder.inc.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ktapi/KTAPIFolder.inc.php b/ktapi/KTAPIFolder.inc.php index a2a2b7e..ca5c8a0 100644 --- a/ktapi/KTAPIFolder.inc.php +++ b/ktapi/KTAPIFolder.inc.php @@ -137,9 +137,7 @@ class KTAPI_Folder extends KTAPI_FolderItem // TODO: we should only clear the cache for the document we are working on // this is a quick fix but not optimal!! - $cache = KTCache::getSingleton(); - - $cache->remove('Folder/id', $this->folderid); + $GLOBALS["_OBJECTCACHE"]['Folder'] = array(); $this->folder = &Folder::get($this->folderid); } @@ -598,7 +596,16 @@ class KTAPI_Folder extends KTAPI_FolderItem $documenttypeid = KTAPI::get_documenttypeid($documenttype); if (PEAR::isError($documenttypeid)) { - return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype); + $config = KTCache::getSingleton(); + $defaultToDefaultDocType = $config->get('webservice/useDefaultDocumentTypeIfInvalid',true); + if ($defaultToDefaultDocType) + { + $documenttypeid = KTAPI::get_documenttypeid('Default'); + } + else + { + return new PEAR_Error('The document type could not be resolved or is disabled: ' . $documenttype); + } } -- libgit2 0.21.4