Merge branch '2014.11' into 2014.11-develop
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 3 Dec 2015 12:40:03 +0000 (13:40 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 3 Dec 2015 12:40:03 +0000 (13:40 +0100)
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tine20/Admin/js/container/EditDialog.js
tine20/Calendar/Controller/EventNotifications.php
tine20/Tinebase/User.php
tine20/Tinebase/js/widgets/dialog/EditDialog.js

index 9db6c00..e4ac085 100644 (file)
@@ -1398,4 +1398,32 @@ class Calendar_Controller_EventNotificationsTests extends Calendar_TestCase
     {
         $this->testResourceNotification(/* $suppress_notification = */ false);
     }
+    
+    /**
+     * testGroupInvitation
+     */
+    public function testGroupInvitation()
+    {
+        $defaultUserGroup = Tinebase_Group::getInstance()->getDefaultGroup();
+        
+        $event = $this->_getEvent(TRUE);
+        
+        $event->attendee = $this->_getAttendee();
+        $event->attendee[1] = new Calendar_Model_Attender(array(
+                'user_id'   => $defaultUserGroup->getId(),
+                'user_type' => Calendar_Model_Attender::USERTYPE_GROUP,
+                'role'      => Calendar_Model_Attender::ROLE_REQUIRED
+        ));
+        
+        self::flushMailer();
+        $persistentEvent = $this->_eventController->create($event);
+        $this->_assertMail('jsmith', NULL);
+        $this->_assertMail('pwulf, sclever, jmcblack, rwright', 'invit');
+        
+        self::flushMailer();
+         
+        $persistentEvent = $this->_eventController->delete($persistentEvent);
+        $this->_assertMail('jsmith', NULL);
+        $this->_assertMail('pwulf, sclever, jmcblack, rwright', 'cancel');
+    }
 }
index 22585cf..1061466 100644 (file)
@@ -131,7 +131,7 @@ Tine.Admin.ContainerEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
                     fieldLabel: this.app.i18n._('Name'), 
                     name: 'name',
                     allowBlank: false,
-                    maxLength: 40
+                    maxLength: 255
                 }, {
                     xtype: 'combo',
                     readOnly: this.record.id != 0,
index 03651ac..8d4d061 100644 (file)
             $organizer = $_event->resolveOrganizer();
             $organizerAccountId = $organizer->account_id;
             $attendee = $_attender->getResolvedUser();
+
+            if ($attendee instanceof Addressbook_Model_List) {
+                // don't send notification to lists as we already resolved the list members for individual mails
+                if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+                    . " Skip notification for list " . $attendee->name);
+                return;
+            }
+
             $attendeeAccountId = $_attender->getUserAccountId();
             
             $prefUserId = $attendeeAccountId ? $attendeeAccountId :
             $this->_handleResourceEditors($_attender, $_notificationLevel, $recipients, $_action, $sendLevel);
 
             // check if user wants this notification NOTE: organizer gets mails unless she set notificationlevel to NONE
-            // NOTE prefUser is organzier for external notifications
+            // NOTE prefUser is organizer for external notifications
             if (($attendeeAccountId == $_updater->getId() && ! $sendOnOwnActions) 
                 || ($sendLevel < $_notificationLevel && (
                         ((is_object($organizer) && method_exists($attendee, 'getPreferedEmailAddress') && $attendee->getPreferedEmailAddress() != $organizer->getPreferedEmailAddress())
index fee3792..05ebef9 100644 (file)
@@ -746,16 +746,20 @@ class Tinebase_User
         $deletedInSyncBackend = array_diff($userIdsInSqlBackend, $usersInSyncBackend->getArrayOfIds());
 
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-            . ' About to delete ' . count($deletedInSyncBackend) . ' users in SQL backend...');
+            . ' About to delete / expire ' . count($deletedInSyncBackend) . ' users in SQL backend...');
 
         foreach ($deletedInSyncBackend as $userToDelete) {
             $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountId', $userToDelete, 'Tinebase_Model_FullUser');
 
+            if (in_array($user->accountLoginName, self::getSystemUsernames())) {
+                return;
+            }
+
             // at first, we expire the user
             $now = Tinebase_DateTime::now();
             if (! $user->accountExpires) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
-                    . ' Set expiry date to ' . $now);
+                    . ' Set expiry date of ' . $user->accountLoginName . ' to ' . $now);
                 $user->accountExpires = $now;
                 Tinebase_User::getInstance()->updateUserInSqlBackend($user);
             } else {
@@ -782,6 +786,16 @@ class Tinebase_User
     }
 
     /**
+     * returns login_names of system users
+     *
+     * @return array
+     */
+    public static function getSystemUsernames()
+    {
+        return array('cronuser', 'calendarscheduling');
+    }
+
+    /**
      * get all user passwords from ldap
      * - set pw for user (in sql and sql plugins)
      * - do not encrypt the pw again as it is encrypted in LDAP
index dfeceab..4c3b42e 100644 (file)
@@ -780,6 +780,15 @@ Tine.widgets.dialog.EditDialog = Ext.extend(Ext.FormPanel, {
     },
     
     /**
+     * vaidates on multiple edit
+     * 
+     * @return {Boolean}
+     */
+    isMultipleValid: function() {
+        return true;
+    },
+    
+    /**
      * @private
      */
     onCancel: function(){