summaryrefslogtreecommitdiff
path: root/lib/kolab_api_service.php
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:07:06 (GMT)
commitd3d1de2590c71d9dc6d36fe840f7feaca3b3797b (patch)
tree9830a6e54ba90ef459dac7d7e06a970e16f9b387 /lib/kolab_api_service.php
parent4aaa9b2a828af9d8a2a5aa31b38677208b6d0261 (diff)
downloadkolab-wap-d3d1de2590c71d9dc6d36fe840f7feaca3b3797b.tar.gz
Fix "invalid type id" exception when type id is provided (broken in last commit)
Diffstat (limited to 'lib/kolab_api_service.php')
-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 ab2400f..dd4a87c 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'];