Merge branch 'pu/2013.03/modelconfig-hr'
[tine20] / tine20 / Calendar / Model / Event.php
index 36a7711..903cf9f 100644 (file)
@@ -96,7 +96,7 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
         'description'          => array(Zend_Filter_Input::ALLOW_EMPTY => true          ),
         'geo'                  => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => NULL),
         'location'             => array(Zend_Filter_Input::ALLOW_EMPTY => true          ),
         'description'          => array(Zend_Filter_Input::ALLOW_EMPTY => true          ),
         'geo'                  => array(Zend_Filter_Input::ALLOW_EMPTY => true, Zend_Filter_Input::DEFAULT_VALUE => NULL),
         'location'             => array(Zend_Filter_Input::ALLOW_EMPTY => true          ),
-        'organizer'            => array(Zend_Filter_Input::ALLOW_EMPTY => true,         ),
+        'organizer'            => array(Zend_Filter_Input::ALLOW_EMPTY => false,        ),
         'priority'             => array(Zend_Filter_Input::ALLOW_EMPTY => true, 'Int'   ),
         'status'            => array(
             Zend_Filter_Input::ALLOW_EMPTY => true,
         'priority'             => array(Zend_Filter_Input::ALLOW_EMPTY => true, 'Int'   ),
         'status'            => array(
             Zend_Filter_Input::ALLOW_EMPTY => true,
@@ -111,6 +111,7 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
         'alarms'                => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // RecordSet of Tinebase_Model_Alarm
         'tags'                  => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // originally categories handled by Tinebase_Tags
         'notes'                 => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // originally comment handled by Tinebase_Notes
         'alarms'                => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // RecordSet of Tinebase_Model_Alarm
         'tags'                  => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // originally categories handled by Tinebase_Tags
         'notes'                 => array(Zend_Filter_Input::ALLOW_EMPTY => true         ), // originally comment handled by Tinebase_Notes
+        'relations'             => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
         'attachments'           => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         
         //'contact'               => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
         'attachments'           => array(Zend_Filter_Input::ALLOW_EMPTY => true),
         
         //'contact'               => array(Zend_Filter_Input::ALLOW_EMPTY => true         ),
@@ -551,8 +552,11 @@ class Calendar_Model_Event extends Tinebase_Record_Abstract
      */
     public function resolveOrganizer()
     {
      */
     public function resolveOrganizer()
     {
-        if (! $this->organizer instanceof Addressbook_Model_Contact) {
-            $this->organizer = Addressbook_Controller_Contact::getInstance()->getMultiple($this->organizer, TRUE)->getFirstRecord();
+        if (! empty($this->organizer) && ! $this->organizer instanceof Addressbook_Model_Contact) {
+            $contacts = Addressbook_Controller_Contact::getInstance()->getMultiple($this->organizer, TRUE);
+            if (count($contacts)) {
+                $this->organizer = $contacts->getFirstRecord();
+            }
         }
         
         return $this->organizer;
         }
         
         return $this->organizer;