summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-11-18 14:07:06 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-11-18 14:08:09 (GMT)
commit6ec6d398a0ee9379f24afea531fad7bf2ed36480 (patch)
tree394313c9ad920b4c1ca39429ceece7af7765ceb0
parent19e0281fab8f0198f05bf216d2ee754905faeff8 (diff)
downloadkolab-wap-6ec6d398a0ee9379f24afea531fad7bf2ed36480.tar.gz
Fix "invalid type id" exception when type id is provided (broken in last commit)
-rw-r--r--lib/kolab_api_service.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index ef0e8bf..1972cb0 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -84,14 +84,16 @@ abstract class kolab_api_service
$object_types = $this->object_types($object_name);
}
- if ($type_id && empty($object_types[$type_id])) {
- throw new Exception($this->controller->translate('api.invalidtypeid'), 35);
- }
- else if (count($object_types) == 1) {
- $type_id = key($object_types);
+ if (empty($type_id)) {
+ if (count($object_types) == 1) {
+ $type_id = key($object_types);
+ }
+ else {
+ throw new Exception($this->controller->translate('api.notypeid'), 34);
+ }
}
- else {
- throw new Exception($this->controller->translate('api.notypeid'), 34);
+ else if ($type_id && empty($object_types[$type_id])) {
+ throw new Exception($this->controller->translate('api.invalidtypeid'), 35);
}
$key_name = $object_types[$type_id]['key'];