summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-03-30 19:20:47 +0200
committerAleksander Machniak <machniak@kolabsys.com>2012-03-30 19:20:47 +0200
commit8ee970d8a00ee29a1640eda03e4261ad717b9bcc (patch)
treefafe90171c07a8f52795103317196a573b74ca16
parentafa582a38e00123e9d57e91421f80d3254f8fafe (diff)
downloadwebadmin-8ee970d8a00ee29a1640eda03e4261ad717b9bcc.tar.gz
Some fixes
-rw-r--r--lib/api/kolab_api_service_group_types.php2
-rw-r--r--lib/kolab_api_service.php14
-rw-r--r--lib/kolab_client_task.php5
3 files changed, 12 insertions, 9 deletions
diff --git a/lib/api/kolab_api_service_group_types.php b/lib/api/kolab_api_service_group_types.php
index e564c06..ade6765 100644
--- a/lib/api/kolab_api_service_group_types.php
+++ b/lib/api/kolab_api_service_group_types.php
@@ -53,7 +53,7 @@ class kolab_api_service_group_types extends kolab_api_service
public function group_types_list($get, $post)
{
$group_types = $this->object_types('group');
-
+console($group_types);
return array(
'list' => $group_types,
'count' => count($group_types),
diff --git a/lib/kolab_api_service.php b/lib/kolab_api_service.php
index dfe69ea..f1b0b95 100644
--- a/lib/kolab_api_service.php
+++ b/lib/kolab_api_service.php
@@ -60,8 +60,8 @@ abstract class kolab_api_service
protected function object_type_attributes($object_name, $type_id, $required = true)
{
$supported = array('group', 'user');
- if (!in_array($object_name, $supported)) {
-
+ if (!$object_name || !in_array($object_name, $supported)) {
+ return array();
}
if (empty($type_id)) {
@@ -141,15 +141,15 @@ abstract class kolab_api_service
*/
protected function object_types($object_name)
{
- if (!empty($this->cache['object_types']) && !empty($this->cache['object_types'][$object_name])) {
- return $this->cache['object_types'][$object_name];
- }
-
$supported = array('group', 'user');
- if (!in_array($object_name, $supported)) {
+ if (!$object_name || !in_array($object_name, $supported)) {
return array();
}
+ if (!empty($this->cache['object_types']) && !empty($this->cache['object_types'][$object_name])) {
+ return $this->cache['object_types'][$object_name];
+ }
+
$sql_result = $this->db->query("SELECT * FROM {$object_name}_types");
$object_types = array();
diff --git a/lib/kolab_client_task.php b/lib/kolab_client_task.php
index 91039f1..2acf4e6 100644
--- a/lib/kolab_client_task.php
+++ b/lib/kolab_client_task.php
@@ -781,7 +781,10 @@ class kolab_client_task
// (Re-|Pre-)populate auto_form_fields
if ($add_mode) {
if (!empty($auto_attribs)) {
- $data = array_merge((array)$data, array('attributes' => $auto_attribs));
+ $data = array_merge((array)$data, array(
+ 'attributes' => $auto_attribs,
+ 'object_name' => $name,
+ ));
$resp = $this->api->post('form_value.generate', null, $data);
$data = array_merge((array)$data, (array)$resp->get());
}