Commit 3ce18129eb8f8fa3c9fd489a8211d98bb7be4c2b
1 parent
c9732c29
WSA-66
"Metadata update may cause errors if metadata is empty" Updated. Committed By: Conrad Vermeulen Reviewed By: Martin Kirsten git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7695 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
9 additions
and
2 deletions
ktapi/KTAPIDocument.inc.php
| ... | ... | @@ -1055,6 +1055,11 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1055 | 1055 | function update_metadata($metadata) |
| 1056 | 1056 | { |
| 1057 | 1057 | global $default; |
| 1058 | + if (empty($metadata)) | |
| 1059 | + { | |
| 1060 | + return; | |
| 1061 | + } | |
| 1062 | + | |
| 1058 | 1063 | $packed = $this->get_packed_metadata($metadata); |
| 1059 | 1064 | |
| 1060 | 1065 | DBUtil::startTransaction(); |
| ... | ... | @@ -1196,7 +1201,8 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1196 | 1201 | $documents[$name] = $userId; |
| 1197 | 1202 | break; |
| 1198 | 1203 | default: |
| 1199 | - return new PEAR_Error('Unexpected field: ' . $name); | |
| 1204 | + // TODO: we should do some logging | |
| 1205 | + //return new PEAR_Error('Unexpected field: ' . $name); | |
| 1200 | 1206 | } |
| 1201 | 1207 | } |
| 1202 | 1208 | |
| ... | ... | @@ -1266,7 +1272,8 @@ class KTAPI_Document extends KTAPI_FolderItem |
| 1266 | 1272 | $metadata_version = $this->document->getMetadataVersion(); |
| 1267 | 1273 | if ($metadata_version == 0) |
| 1268 | 1274 | { |
| 1269 | - return new PEAR_Error('MetadataVersion cannot be merged'); | |
| 1275 | + // this could theoretically happen in the case we are updating metadata and sysdata, but no metadata fields are specified. | |
| 1276 | + return; | |
| 1270 | 1277 | } |
| 1271 | 1278 | |
| 1272 | 1279 | $metadata_id = $this->document->getMetadataVersionId(); | ... | ... |