diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-03-30 16:21:55 (GMT) |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2012-03-30 16:21:55 (GMT) |
commit | 7381230117b0861d635820dc9095f47e28cca390 (patch) | |
tree | 5078062df3da9b3aa1e5577362d03667dfdc7d0e /lib/api/kolab_api_service_form_value.php | |
parent | 812ccf7f14b09006dcf6fdf4f6618f2f65c68714 (diff) | |
download | kolab-wap-7381230117b0861d635820dc9095f47e28cca390.tar.gz |
Generate a proper primary mail attribute value for groups
Diffstat (limited to 'lib/api/kolab_api_service_form_value.php')
-rw-r--r-- | lib/api/kolab_api_service_form_value.php | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php index b006b84..6e39a9b 100644 --- a/lib/api/kolab_api_service_form_value.php +++ b/lib/api/kolab_api_service_form_value.php @@ -60,6 +60,7 @@ class kolab_api_service_form_value extends kolab_api_service public function generate($getdata, $postdata) { $attribs = $this->object_type_attributes($postdata['object_type'], $postdata['type_id']); + $attributes = (array) $postdata['attributes']; $result = array(); @@ -68,10 +69,16 @@ class kolab_api_service_form_value extends kolab_api_service continue; } - $method_name = 'generate_' . strtolower($attr_name); + $method_name = 'generate_' . strtolower($attr_name) . '_' . strtolower($postdata['object_type']); if (!method_exists($this, $method_name)) { - continue; + console("Method $method_name doesn't exist"); + + $method_name = 'generate_' . strtolower($attr_name); + + if (!method_exists($this, $method_name)) { + continue; + } } $result[$attr_name] = $this->{$method_name}($postdata, $attribs); @@ -269,6 +276,11 @@ class kolab_api_service_form_value extends kolab_api_service return $this->generate_primary_mail($postdata, $attribs); } + private function generate_mail_group($postdata, $attribs = array()) + { + return $this->generate_primary_mail_group($postdata, $attribs); + } + private function generate_mailalternateaddress($postdata, $attribs = array()) { return $this->generate_secondary_mail($postdata, $attribs); @@ -310,6 +322,22 @@ class kolab_api_service_form_value extends kolab_api_service } } + private function generate_primary_mail_group($postdata, $attribs = array()) + { + if (isset($attribs['auto_form_fields']) && isset($attribs['auto_form_fields']['mail'])) { + // Use Data Please + foreach ($attribs['auto_form_fields']['mail']['data'] as $key) { + if (!isset($postdata[$key])) { + throw new Exception("Key not set: " . $key, 12356); + } + } + + $primary_mail = kolab_recipient_policy::primary_mail_group($postdata); + + return $primary_mail; + } + } + private function generate_secondary_mail($postdata, $attribs = array()) { $secondary_mail_address = Array(); |