Esempio n. 1
0
 /**
  * @group 63403
  */
 public function testBug63403()
 {
     $meeting = SugarTestMeetingUtilities::createMeeting();
     SugarTestMeetingUtilities::addMeetingUserRelation($meeting->id, $GLOBALS['current_user']->id);
     $meeting->date_start = $GLOBALS['timedate']->getNow()->asDb();
     $meeting->date_end = $GLOBALS['timedate']->getNow()->modify("+25 days")->asDb();
     $meeting->duration_hours = 720;
     $meeting->save();
     $calendar = new CalendarActivity($meeting);
     $start_date_time = $GLOBALS['timedate']->fromString($GLOBALS['timedate']->nowDb());
     $result = $calendar->get_activities($GLOBALS['current_user']->id, false, $start_date_time->get("+7 days"), $start_date_time->get("+14 days"), false);
     $this->assertNotEmpty($result);
     $this->assertEquals($meeting->id, $result[0]->sugar_bean->id, 'We should get current test Meeting');
 }
Esempio n. 2
0
 /**
  * Creates the string for the user's events and todos between the given start
  * and end times
  *
  * @param UserBean $user_bean the current UserBean
  * @param DateTime $start_date_time the start date to search from
  * @param DateTime $end_date_time the end date to search to
  * @param string $dtstamp the current timestamp
  * @return string the entries for events and todos
  */
 protected function createSugarIcal(&$user_bean, &$start_date_time, &$end_date_time, $dtstamp)
 {
     $ical_array = array();
     global $DO_USER_TIME_OFFSET, $sugar_config, $current_user, $timedate;
     $hide_calls = false;
     if (!empty($_REQUEST['hide_calls']) && $_REQUEST['hide_calls'] == "true") {
         $hide_calls = true;
     }
     $taskAsVTODO = true;
     if (!empty($_REQUEST['show_tasks_as_events']) && ($_REQUEST['show_tasks_as_events'] == "1" || $_REQUEST['show_tasks_as_events'] == "true")) {
         $taskAsVTODO = false;
     }
     $acts_arr = CalendarActivity::get_activities($user_bean->id, !$taskAsVTODO, $start_date_time, $end_date_time, 'month', !$hide_calls);
     // loop thru each activity, get start/end time in UTC, and return iCal strings
     foreach ($acts_arr as $act) {
         $event = $act->sugar_bean;
         if (!$hide_calls || $hide_calls && $event->object_name != "Call") {
             $ical_array[] = array("BEGIN", "VEVENT");
             $ical_array[] = array("SUMMARY", $event->name);
             $ical_array[] = array("DTSTART;TZID=" . $user_bean->getPreference('timezone'), str_replace("Z", "", $timedate->tzUser($act->start_time, $current_user)->format(self::UTC_FORMAT)));
             $ical_array[] = array("DTEND;TZID=" . $user_bean->getPreference('timezone'), str_replace("Z", "", $timedate->tzUser($act->end_time, $current_user)->format(self::UTC_FORMAT)));
             $ical_array[] = array("DTSTAMP", $dtstamp);
             $ical_array[] = array("DESCRIPTION", $event->description);
             $ical_array[] = array("URL;VALUE=URI", $sugar_config['site_url'] . "/index.php?module=" . $event->module_dir . "&action=DetailView&record=" . $event->id);
             $ical_array[] = array("UID", $event->id);
             if ($event->object_name == "Meeting") {
                 $ical_array[] = array("LOCATION", $event->location);
                 $eventUsers = $event->get_meeting_users();
                 $query = "SELECT contact_id as id from meetings_contacts where meeting_id='{$event->id}' AND deleted=0";
                 $eventContacts = $event->build_related_list($query, new Contact());
                 $eventAttendees = array_merge($eventUsers, $eventContacts);
                 if (is_array($eventAttendees)) {
                     foreach ($eventAttendees as $attendee) {
                         if ($attendee->id != $user_bean->id) {
                             // Define the participant status
                             $participant_status = '';
                             if (!empty($attendee->accept_status)) {
                                 switch ($attendee->accept_status) {
                                     case 'accept':
                                         $participant_status = ';PARTSTAT=ACCEPTED';
                                         break;
                                     case 'decline':
                                         $participant_status = ';PARTSTAT=DECLINED';
                                         break;
                                     case 'tentative':
                                         $participant_status = ';PARTSTAT=TENTATIVE';
                                         break;
                                 }
                             }
                             $ical_array[] = array('ATTENDEE' . $participant_status . ';CN="' . $attendee->get_summary_text() . '"', 'mailto:' . (!empty($attendee->email1) ? $attendee->email1 : '*****@*****.**'));
                         }
                     }
                 }
             }
             if ($event->object_name == "Call") {
                 $eventUsers = $event->get_call_users();
                 $eventContacts = $event->get_contacts();
                 $eventAttendees = array_merge($eventUsers, $eventContacts);
                 if (is_array($eventAttendees)) {
                     foreach ($eventAttendees as $attendee) {
                         if ($attendee->id != $user_bean->id) {
                             // Define the participant status
                             $participant_status = '';
                             if (!empty($attendee->accept_status)) {
                                 switch ($attendee->accept_status) {
                                     case 'accept':
                                         $participant_status = ';PARTSTAT=ACCEPTED';
                                         break;
                                     case 'decline':
                                         $participant_status = ';PARTSTAT=DECLINED';
                                         break;
                                     case 'tentative':
                                         $participant_status = ';PARTSTAT=TENTATIVE';
                                         break;
                                 }
                             }
                             $ical_array[] = array('ATTENDEE' . $participant_status . ';CN="' . $attendee->get_summary_text() . '"', 'mailto:' . (!empty($attendee->email1) ? $attendee->email1 : '*****@*****.**'));
                         }
                     }
                 }
             }
             if (isset($event->reminder_time) && $event->reminder_time > 0 && $event->status != "Held") {
                 $ical_array[] = array("BEGIN", "VALARM");
                 $ical_array[] = array("TRIGGER", "-PT");
                 $ical_array[] = array("ACTION", "DISPLAY");
                 $ical_array[] = array("DESCRIPTION", $event->name);
                 $ical_array[] = array("END", "VALARM");
             }
             $ical_array[] = array("END", "VEVENT");
         }
     }
     $str = vCal::create_ical_string_from_array($ical_array, true);
     require_once 'include/TimeDate.php';
     $timedate = new TimeDate();
     $today = gmdate("Y-m-d");
     $today = $timedate->handle_offset($today, $timedate->dbDayFormat, false);
     require_once 'modules/ProjectTask/ProjectTask.php';
     $where = "project_task.assigned_user_id='{$user_bean->id}' " . "AND (project_task.status IS NULL OR (project_task.status!='Deferred')) " . "AND (project_task.date_start IS NULL OR " . CalendarActivity::get_occurs_within_where_clause('project_task', '', $start_date_time, $end_date_time, 'date_start', 'month') . ")";
     $seedProjectTask = new ProjectTask();
     $projectTaskList = $seedProjectTask->get_full_list("", $where);
     if (is_array($projectTaskList)) {
         foreach ($projectTaskList as $projectTask) {
             $str .= $this->createSugarIcalTodo($user_bean, $projectTask, "ProjectTask", $dtstamp);
         }
     }
     if ($taskAsVTODO) {
         require_once 'modules/Tasks/Task.php';
         $where = "tasks.assigned_user_id='{$user_bean->id}' " . "AND (tasks.status IS NULL OR (tasks.status!='Deferred')) " . "AND (tasks.date_start IS NULL OR " . CalendarActivity::get_occurs_within_where_clause('tasks', '', $start_date_time, $end_date_time, 'date_start', 'month') . ")";
         $seedTask = new Task();
         $taskList = $seedTask->get_full_list("", $where);
         if (is_array($taskList)) {
             foreach ($taskList as $task) {
                 $str .= $this->createSugarIcalTodo($user_bean, $task, "Tasks", $dtstamp);
             }
         }
     }
     return $str;
 }
Esempio n. 3
0
	function create_sugar_freebusy($user_bean, $start_date_time, $end_date_time)
	{
        $ical_array = array();
		global $DO_USER_TIME_OFFSET,$timedate;

		$DO_USER_TIME_OFFSET = true;
		if(empty($GLOBALS['current_user']) || empty($GLOBALS['current_user']->id)) {
		    $GLOBALS['current_user'] = $user_bean;
		}
		// get activities.. queries Meetings and Calls
		$acts_arr =
		CalendarActivity::get_activities($user_bean->id,
			false,
			$start_date_time,
			$end_date_time,
			'freebusy');

		// loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
		foreach($acts_arr as $act)
		{
            $ID = $act->sugar_bean->id;
			$startTimeUTC = $act->start_time->format(self::UTC_FORMAT);
			$endTimeUTC = $act->end_time->format(self::UTC_FORMAT);
            $ical_array[] = array("FREEBUSY", $startTimeUTC ."/". $endTimeUTC);
            $ical_array[] = array("X-FREEBUSY-ID", $ID);
            $ical_array[] = array("X-FREEBUSY-TYPE", get_class($act->sugar_bean));
            //$ical_array[] = array(array("X-FREEBUSYID", $ID), array("FREEBUSY", $startTimeUTC ."/". $endTimeUTC));
		}
        return self::create_ical_string_from_array($ical_array);
//        return $ical_array;

	}
Esempio n. 4
0
 function create_sugar_freebusy($user_bean, $start_date_time, $end_date_time)
 {
     $str = '';
     global $DO_USER_TIME_OFFSET, $timedate;
     $DO_USER_TIME_OFFSET = true;
     // get activities.. queries Meetings and Calls
     $acts_arr = CalendarActivity::get_activities($user_bean->id, array("show_calls" => true), $start_date_time, $end_date_time, 'freebusy');
     // loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
     foreach ($acts_arr as $act) {
         $startTimeUTC = $act->start_time->format(self::UTC_FORMAT);
         $endTimeUTC = $act->end_time->format(self::UTC_FORMAT);
         $str .= "FREEBUSY:" . $startTimeUTC . "/" . $endTimeUTC . "\n";
     }
     return $str;
 }
Esempio n. 5
0
 /**
  * loads array of objects
  * @param User $user user object
  * @param string $type
  */
 public function add_activities($user, $type = 'sugar')
 {
     global $timedate;
     $start_date_time = $this->date_time;
     if ($this->view == 'week' || $this->view == 'shared' || $this->view == 'mobile') {
         $start_date_time = CalendarUtils::get_first_day_of_week($this->date_time);
         $end_date_time = $start_date_time->get("+7 days");
     } else {
         if ($this->view == 'month') {
             $start_date_time = $this->date_time->get_day_by_index_this_month(0);
             $end_date_time = $start_date_time->get("+" . $start_date_time->format('t') . " days");
             $start_date_time = CalendarUtils::get_first_day_of_week($start_date_time);
             $end_date_time = CalendarUtils::get_first_day_of_week($end_date_time)->get("+7 days");
         } else {
             $end_date_time = $this->date_time->get("+1 day");
         }
     }
     $start_date_time = $start_date_time->get("-5 days");
     // 5 days step back to fetch multi-day activities that
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $start_date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $start_date_time, $end_date_time, $this->view, $this->show_calls, $this->show_completed);
     }
     $this->acts_arr[$user->id] = $acts_arr;
 }
Esempio n. 6
0
 function add_activities($user, $type = 'sugar')
 {
     if ($this->view == 'week' || $this->view == 'shared') {
         $end_date_time = $this->date_time->get_first_day_of_next_week();
     } else {
         $end_date_time = $this->date_time;
     }
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $this->date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $this->date_time, $end_date_time, $this->view);
     }
     // loop thru each activity for this user
     for ($i = 0; $i < count($acts_arr); $i++) {
         $act = $acts_arr[$i];
         // get "hashed" time slots for the current activity we are looping through
         $hash_list = DateTimeUtil::getHashList($this->view, $act->start_time, $act->end_time);
         for ($j = 0; $j < count($hash_list); $j++) {
             if (!isset($this->slice_hash[$hash_list[$j]]) || !isset($this->slice_hash[$hash_list[$j]]->acts_arr[$user->id])) {
                 $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id] = array();
             }
             $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id][] = $act;
         }
     }
 }
Esempio n. 7
0
 function create_sugar_freebusy($user_bean, $start_date_time, $end_date_time)
 {
     $str = '';
     global $DO_USER_TIME_OFFSET, $timedate;
     $DO_USER_TIME_OFFSET = true;
     // get activities.. queries Meetings and Calls
     $acts_arr = CalendarActivity::get_activities($user_bean->id, false, $start_date_time, $end_date_time, 'week');
     // loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
     for ($i = 0; $i < count($acts_arr); $i++) {
         $act = $acts_arr[$i];
         $utcFormat = 'Ymd\\THi';
         $startTimeUTC = gmdate($utcFormat, $act->start_time->ts) . "00Z";
         $endTimeUTC = gmdate($utcFormat, $act->end_time->ts) . "00Z";
         $str .= "FREEBUSY:" . $startTimeUTC . "/" . $endTimeUTC . "\n";
     }
     return $str;
 }
Esempio n. 8
0
 function create_sugar_freebusy(&$user_bean, &$start_date_time, &$end_date_time)
 {
     $str = '';
     global $DO_USER_TIME_OFFSET;
     $DO_USER_TIME_OFFSET = true;
     // get activities.. queries Meetings and Calls
     $acts_arr = CalendarActivity::get_activities($user_bean->id, false, $start_date_time, $end_date_time, 'week');
     // loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
     for ($i = 0; $i < count($acts_arr); $i++) {
         $act = $acts_arr[$i];
         $date_arr = array('ts' => $act->start_time->ts);
         $start_time = new DateTimeUtil($date_arr, true);
         $date_arr = array('ts' => $act->end_time->ts);
         $end_time = new DateTimeUtil($date_arr, true);
         $str .= "FREEBUSY:" . $start_time->get_utc_date_time() . "/" . $end_time->get_utc_date_time() . "\n";
     }
     return $str;
 }
Esempio n. 9
0
 /**
  * Creates the string for the user's events and todos between the given start
  * and end times
  *
  * @param UserBean $user_bean the current UserBean
  * @param DateTime $start_date_time the start date to search from
  * @param DateTime $end_date_time the end date to search to
  * @param string $dtstamp the current timestamp
  * @return string the entries for events and todos
  */
 protected function createSugarIcal(&$user_bean, &$start_date_time, &$end_date_time, $dtstamp)
 {
     $str = '';
     global $DO_USER_TIME_OFFSET, $sugar_config, $current_user, $timedate;
     $acts_arr = CalendarActivity::get_activities($user_bean->id, false, $start_date_time, $end_date_time, 'month');
     $hide_calls = false;
     if (!empty($_REQUEST['hide_calls']) && $_REQUEST['hide_calls'] == "true") {
         $hide_calls = true;
     }
     // loop thru each activity, get start/end time in UTC, and return iCal strings
     foreach ($acts_arr as $act) {
         $event = $act->sugar_bean;
         if (!$hide_calls || $hide_calls && $event->object_name != "Call") {
             $str .= "BEGIN:VEVENT\n";
             $str .= "SUMMARY:" . $event->name . "\n";
             $str .= "DTSTART;TZID=" . $user_bean->getPreference('timezone') . ":" . str_replace("Z", "", $timedate->tzUser($act->start_time, $current_user)->format(self::UTC_FORMAT)) . "\n";
             $str .= "DTEND;TZID=" . $user_bean->getPreference('timezone') . ":" . str_replace("Z", "", $timedate->tzUser($act->end_time, $current_user)->format(self::UTC_FORMAT)) . "\n";
             $str .= "DTSTAMP:" . $dtstamp . "\n";
             $str .= "DESCRIPTION:" . $this->escapeNls($event->description) . "\n";
             $str .= "URL;VALUE=URI:" . $sugar_config['site_url'] . "/index.php?module=" . $event->module_dir . "&action=DetailView&record=" . $event->id . "\n";
             $str .= "UID:" . $event->id . "\n";
             if ($event->object_name == "Meeting") {
                 $str .= "LOCATION:" . $event->location . "\n";
                 $eventUsers = $event->get_meeting_users();
                 $query = "SELECT contact_id as id from meetings_contacts where meeting_id='{$event->id}' AND deleted=0";
                 $eventContacts = $event->build_related_list($query, new Contact());
                 $eventAttendees = array_merge($eventUsers, $eventContacts);
                 if (is_array($eventAttendees)) {
                     foreach ($eventAttendees as $attendee) {
                         if ($attendee->id != $user_bean->id) {
                             $str .= 'ATTENDEE;CN="' . $attendee->get_summary_text() . '":mailto:' . $attendee->email1 . "\n";
                         }
                     }
                 }
             }
             if ($event->object_name == "Call") {
                 $eventUsers = $event->get_call_users();
                 $eventContacts = $event->get_contacts();
                 $eventAttendees = array_merge($eventUsers, $eventContacts);
                 if (is_array($eventAttendees)) {
                     foreach ($eventAttendees as $attendee) {
                         if ($attendee->id != $user_bean->id) {
                             $str .= 'ATTENDEE;CN="' . $attendee->get_summary_text() . '":mailto:' . $attendee->email1 . "\n";
                         }
                     }
                 }
             }
             if ($event->reminder_time > 0 && $event->status != "Held") {
                 $str .= "BEGIN:VALARM\n";
                 $str .= "TRIGGER:-PT" . $event->reminder_time / 60 . "M\n";
                 $str .= "ACTION:DISPLAY\n";
                 $str .= "DESCRIPTION:" . $event->name . "\n";
                 $str .= "END:VALARM\n";
             }
             $str .= "END:VEVENT\n";
         }
     }
     require_once 'include/TimeDate.php';
     $timedate = new TimeDate();
     $today = gmdate("Y-m-d");
     $today = $timedate->handle_offset($today, $timedate->dbDayFormat, false);
     require_once 'modules/ProjectTask/ProjectTask.php';
     $where = "project_task.assigned_user_id='{$user_bean->id}' " . "AND (project_task.status IS NULL OR (project_task.status!='Deferred')) " . "AND (project_task.date_start IS NULL OR project_task.date_start <= '{$today}')";
     $seedProjectTask = new ProjectTask();
     $projectTaskList = $seedProjectTask->get_full_list("", $where);
     if (is_array($projectTaskList)) {
         foreach ($projectTaskList as $projectTask) {
             $str .= $this->createSugarIcalTodo($user_bean, $projectTask, "ProjectTask", $dtstamp);
         }
     }
     require_once 'modules/Tasks/Task.php';
     $where = "tasks.assigned_user_id='{$user_bean->id}' " . "AND (tasks.status IS NULL OR (tasks.status!='Deferred')) " . "AND (tasks.date_start IS NULL OR tasks.date_start <= '{$today}')";
     $seedTask = new Task();
     $taskList = $seedTask->get_full_list("", $where);
     if (is_array($taskList)) {
         foreach ($taskList as $task) {
             $str .= $this->createSugarIcalTodo($user_bean, $task, "Tasks", $dtstamp);
         }
     }
     return $str;
 }
Esempio n. 10
0
 /**
  * @group 58702
  * Test if Meetings/Calls/Tasks are shown properly when
  * show completed flag is set
  *
  * @dataProvider dataProvider
  */
 public function testShowCompleted($showCompleted)
 {
     // Create Held Meeting
     $meeting = SugarTestMeetingUtilities::createMeeting();
     $meeting->date_start = $GLOBALS['timedate']->nowDb();
     $meeting->date_end = $GLOBALS['timedate']->nowDb();
     $meeting->status = 'Held';
     $meeting->save();
     $meeting->set_accept_status($GLOBALS['current_user'], 'accept');
     // Create Held Call
     $call = SugarTestCallUtilities::createCall();
     $call->date_start = $GLOBALS['timedate']->nowDb();
     $call->date_end = $GLOBALS['timedate']->nowDb();
     $call->status = 'Held';
     $call->save();
     $call->set_accept_status($GLOBALS['current_user'], 'accept');
     // Create Completed Task
     $task = SugarTestTaskUtilities::createTask();
     $task->date_due = $GLOBALS['timedate']->nowDb();
     $task->status = 'Completed';
     $task->assigned_user_id = $GLOBALS['current_user']->id;
     $task->save();
     // Set query dates
     $start_date_time = $GLOBALS['timedate']->fromString(date("Y-m-d"));
     $end_date_time = $start_date_time->get("+7 days");
     $start_date_time = $start_date_time->get("-7 days");
     // Get all activities for the user
     $result = CalendarActivity::get_activities($GLOBALS['current_user']->id, true, $start_date_time, $end_date_time, 'month', true, $showCompleted);
     // Depending on show completed, get_activities should return 3 entries, the ones we created above
     if ($showCompleted) {
         $this->assertEquals(3, sizeof($result), 'get_activities did not return the Metting, Call and Task as it should have');
         $this->assertEquals($result[0]->sugar_bean->id, $meeting->id, 'Meeting not returned properly');
         $this->assertEquals($result[1]->sugar_bean->id, $call->id, 'Call not returned properly');
         $this->assertEquals($result[2]->sugar_bean->id, $task->id, 'Task not returned properly');
     } else {
         $this->assertEquals(0, sizeof($result), 'get_activities should be empty');
     }
 }
Esempio n. 11
0
 function add_activities($user, $type = 'sugar')
 {
     global $timedate;
     if ($this->view == 'week' || $this->view == 'shared') {
         $end_date_time = $this->date_time->get("+7 days");
     } else {
         $end_date_time = $this->date_time;
     }
     $acts_arr = array();
     if ($type == 'vfb') {
         $acts_arr = CalendarActivity::get_freebusy_activities($user, $this->date_time, $end_date_time);
     } else {
         $acts_arr = CalendarActivity::get_activities($user->id, $this->show_tasks, $this->date_time, $end_date_time, $this->view);
     }
     // loop thru each activity for this user
     foreach ($acts_arr as $act) {
         // get "hashed" time slots for the current activity we are looping through
         $start = $timedate->tzUser($act->start_time);
         $end = $timedate->tzUser($act->end_time);
         $hash_list = SugarDateTime::getHashList($this->view, $start, $end);
         for ($j = 0; $j < count($hash_list); $j++) {
             if (!isset($this->slice_hash[$hash_list[$j]]) || !isset($this->slice_hash[$hash_list[$j]]->acts_arr[$user->id])) {
                 $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id] = array();
             }
             $this->slice_hash[$hash_list[$j]]->acts_arr[$user->id][] = $act;
         }
     }
 }
Esempio n. 12
0
 function create_sugar_freebusy($user_bean, $start_date_time, $end_date_time)
 {
     $ical_array = [];
     global $DO_USER_TIME_OFFSET, $timedate;
     $DO_USER_TIME_OFFSET = true;
     if (empty($GLOBALS['current_user']) || empty($GLOBALS['current_user']->id)) {
         $GLOBALS['current_user'] = $user_bean;
     }
     // get activities.. queries Meetings and Calls
     $acts_arr = CalendarActivity::get_activities($user_bean->id, ["show_calls" => true], $start_date_time, $end_date_time, 'freebusy');
     // loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
     foreach ($acts_arr as $act) {
         $startTimeUTC = $act->start_time->format(self::UTC_FORMAT);
         $endTimeUTC = $act->end_time->format(self::UTC_FORMAT);
         $ical_array[] = ["FREEBUSY", $startTimeUTC . "/" . $endTimeUTC];
     }
     return self::create_ical_string_from_array($ical_array);
 }
Esempio n. 13
0
 function create_sugar_freebusy($user_bean, $start_date_time, $end_date_time)
 {
     $str = '';
     global $DO_USER_TIME_OFFSET, $timedate;
     $DO_USER_TIME_OFFSET = true;
     if (empty($GLOBALS['current_user']) || empty($GLOBALS['current_user']->id)) {
         $GLOBALS['current_user'] = $user_bean;
     }
     // get activities.. queries Meetings and Calls
     $acts_arr = CalendarActivity::get_activities($user_bean->id, false, $start_date_time, $end_date_time, 'freebusy');
     // loop thru each activity, get start/end time in UTC, and return FREEBUSY strings
     foreach ($acts_arr as $act) {
         if (empty($act->start_time) || empty($act->end_time)) {
             //create error message
             $errMSG = "ERROR in Vcal::create_sugar_freebusy.  Calendar Activity was not created because of missing start or end time";
             if (!empty($act->sugar_bean->id)) {
                 $errMSG .= ", id is " . $act->sugar_bean->id;
             }
             if (!empty($act->sugar_bean->name)) {
                 $errMSG .= ", name is: " . $act->sugar_bean->name;
             }
             //log message and continue
             $GLOBALS['log']->fatal($errMSG);
             continue;
         }
         $startTimeUTC = $act->start_time->format(self::UTC_FORMAT);
         $endTimeUTC = $act->end_time->format(self::UTC_FORMAT);
         $str .= "FREEBUSY:" . $startTimeUTC . "/" . $endTimeUTC . "\n";
     }
     return $str;
 }