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)
1  2 
tests/tine20/Calendar/Controller/EventNotificationsTests.php
tine20/Calendar/Controller/EventNotifications.php
tine20/Tinebase/User.php
tine20/Tinebase/js/widgets/dialog/EditDialog.js

@@@ -1374,28 -1357,36 +1374,56 @@@ class Calendar_Controller_EventNotifica
  
          Tinebase_Container::getInstance()->setGrants($resource->container_id, $grants);
  
 +        $this->assertContains('Resource "' . $persistentResource->name . '" was booked', print_r($messages, true));
          $this->assertContains('Meeting Room (Required, No response)', print_r($messages, true));
 -        $this->assertEquals(4, count($messages), 'four mails should be send to current user (resource + attender + everybody whos allowed to edit this resource)');
 -        $this->assertEquals(3, count($persistentEvent->attendee));
 +
 +        $this->assertEquals(4, count($messages), 'four mails should be send to current user (resource + attender + everybody who is allowed to edit this resource)');
 +        $this->assertEquals(count($event->attendee), count($persistentEvent->attendee));
 +    }
 +
 +    /**
 +     * @see 0011272: ressource invitation: organizer receives no mail if he is no attendee
 +     */
 +    public function testResourceNotificationForNonAttendeeOrganizer()
 +    {
 +        $this->testResourceNotificationForGrantedUsers(/* $userIsAttendee = */ false);
 +    }
 +
 +    /**
 +     * testResourceNotificationMuteForEditors
 +     *
 +     * @see 0011312: Make resource notification handling and default status configurable
 +     */
 +    public function testResourceNotificationMuteForEditors()
 +    {
 +        $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');
+     }
  }
                  $sendLevel = is_object($organizer) && $_attender->getEmail() == $organizer->getPreferedEmailAddress() ? 40 : 30;
                  $sendOnOwnActions = false;
              }
 -            
 +
 +            $recipients = array($attendee);
 +
 +            $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())
Simple merge