Beispiel #1
0
 public function testAcceptanceAfterDateUpdate()
 {
     global $current_user;
     global $db;
     $meeting = SugarTestMeetingUtilities::createMeeting();
     $user = SugarTestUserUtilities::createAnonymousUser();
     SugarTestMeetingUtilities::addMeetingUserRelation($meeting->id, $current_user->id);
     SugarTestMeetingUtilities::addMeetingUserRelation($meeting->id, $user->id);
     // set this to 'accept' before handleSave and make sure it gets set to 'none' after handleSave
     $meeting->set_accept_status($user, 'accept');
     $meeting->save();
     $_POST['record'] = $_REQUEST['record'] = $meeting->id;
     $_POST['user_invitees'] = $current_user->id . ',' . $user->id;
     $_POST['module'] = 'Meetings';
     $_POST['action'] = 'Save';
     $_POST['assigned_user_id'] = $current_user->id;
     $_POST['send_invites'] = $_REQUEST['send_invites'] = 1;
     $_POST['date_start'] = $GLOBALS['timedate']->getNow()->asDb();
     $_POST['date_end'] = $GLOBALS['timedate']->getNow()->modify("+900 seconds")->asDb();
     $formBase = new MeetingFormBase();
     $formBase->handleSave('', false, false);
     $sql = "SELECT accept_status FROM meetings_users WHERE meeting_id='{$meeting->id}' AND user_id='{$user->id}'";
     $result = $db->query($sql);
     if ($row = $db->fetchByAssoc($result)) {
         $this->assertEquals('none', $row['accept_status'], 'Should be none after date changed and invite sent.');
     }
 }
Beispiel #2
0
 /**
  * Ensure that saving relationship changes do not fail with fatal error and works fine
  * when saving relation field with type id
  *
  * @group 53516
  */
 public function testSaveRelationOnRelateFieldWithIdType()
 {
     $meeting = SugarTestMeetingUtilities::createMeeting();
     $meeting->in_workflow = true;
     $meeting->not_use_rel_in_req = true;
     $meeting->contact_id = $meeting->new_rel_id = $this->contact->id;
     $meeting->new_rel_relname = 'contact_id';
     $meeting->save_relationship_changes(false);
 }
 /**
  * Remove anything that was used during this test
  *
  */
 public function tearDown()
 {
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     $this->_contact = null;
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestMeetingUtilities::removeMeetingContacts();
     $this->_meeting = null;
     parent::tearDown();
 }
Beispiel #4
0
 /**
  * Remove anything that was used during this test
  *
  */
 public function tearDown()
 {
     parent::tearDown();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     $this->_contact = null;
     SugarTestMeetingUtilities::removeMeetingContacts();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
 }
Beispiel #5
0
 public function tearDown()
 {
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestMeetingUtilities::removeMeetingUsers();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestTaskUtilities::removeAllCreatedTasks();
     SugarTestProjectUtilities::removeAllCreatedProjects();
     SugarTestProjectTaskUtilities::removeAllCreatedProjectTasks();
     unset($this->timedate);
     unset($this->project);
     unset($GLOBALS['current_user']);
 }
Beispiel #6
0
 function tearDown()
 {
     global $db, $current_user;
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     $this->meeting = null;
     $this->call = null;
     $meetingsSql = "UPDATE meetings SET date_end = date_add(date_start, INTERVAL - CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $callsSql = "UPDATE calls SET date_end = date_add(date_start, INTERVAL - CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $db->query($meetingsSql);
     $db->query($callsSql);
     $current_user = $this->original_current_user;
 }
 function tearDown()
 {
     global $db, $current_user;
     if ($db->dbType != 'mysql') {
         return;
     }
     // No need to clean up if we skipped the test to begin with
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     $this->meeting = null;
     $this->call = null;
     $meetingsSql = "UPDATE meetings SET date_end = date_add(date_start, INTERVAL + CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $callsSql = "UPDATE calls SET date_end = date_add(date_start, INTERVAL + CONCAT(duration_hours, ':', duration_minutes) HOUR_MINUTE)";
     $db->query($meetingsSql);
     $db->query($callsSql);
     $current_user = $this->original_current_user;
 }
Beispiel #8
0
 /**
  * Test if set_entries returns proper IDs for Calls/Meetings
  * with set outlook_id or with equal fields
  *
  * @param $module - Module name
  * @param $outlookID - Outlook ID (must always be set, for the OPI Sync check to be initiated)
  * @param $nameValueLists - name-value lists for set_entries call
  *
  * @dataProvider dataProvider
  * @group 63559
  */
 public function testSetEntriesOPISync($module, $outlookID, $nameValueLists)
 {
     $meeting = SugarTestMeetingUtilities::createMeeting();
     // Set the fields using $nameValueLists, and resave the meeting
     foreach ($nameValueLists[0] as $nameValue) {
         $meeting->{$nameValue}['name'] = $nameValue['value'];
     }
     $meeting->outlook_id = $outlookID;
     $meeting->save();
     // Mock $server and $server->wsdl
     $server = $this->getMock('soap_server', array('register'));
     $server->wsdl = $this->getMock('wsdl', array('addComplexType'));
     // Need name space to be set
     $NAMESPACE = '';
     require_once 'soap/SoapSugarUsers.php';
     require_once 'soap/SoapError.php';
     // Unset $NAMESPACE, it was only needed in SoapSugarUsers.php
     unset($NAMESPACE);
     $actual = handle_set_entries($module, $nameValueLists);
     $this->assertEquals($meeting->id, $actual['ids'][0], 'Meeting not synced properly.');
 }
Beispiel #9
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');
     }
 }
Beispiel #10
0
 public function tearDown()
 {
     SugarTestContactUtilities::removeCreatedContactsUsersRelationships();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestMeetingUtilities::removeMeetingContacts();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     unset($GLOBALS['beanList']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['app_list_strings']);
     unset($GLOBALS['app_strings']);
     unset($GLOBALS['mod_strings']);
     unset($GLOBALS['current_user']);
 }
Beispiel #11
0
 public function testMeetingsUsersRelationships()
 {
     global $current_user;
     $bean = SugarTestMeetingUtilities::createMeeting();
     $convert_lead = SugarTestViewConvertLeadUtilities::createViewConvertLead();
     if ($bean->object_name == "Meeting") {
         $convert_lead->setMeetingsUsersRelationship($bean);
     }
     $this->assertTrue(is_object($bean->users), "Relationship wasn't set.");
     SugarTestMeetingUtilities::removeMeetingUsers();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
 }
Beispiel #12
0
 public function tearDown()
 {
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     unset($GLOBALS['current_user']);
 }
Beispiel #13
0
 public function tearDown()
 {
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestMeetingUtilities::removeMeetingUsers();
     parent::tearDown();
 }
Beispiel #14
0
 public function tearDown()
 {
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestHelper::tearDown();
 }
 public function tearDown()
 {
     global $current_user;
     $GLOBALS['db']->query("DELETE FROM meetings_users WHERE user_id = '{$current_user->id}'");
     $GLOBALS['db']->query("DELETE FROM calls_users WHERE user_id = '{$current_user->id}'");
     $GLOBALS['db']->query("DELETE FROM contacts_users WHERE user_id = '{$current_user->id}'");
     SugarTestUserUtilities::removeAllCreatedAnonymousUsers();
     SugarTestMeetingUtilities::removeAllCreatedMeetings();
     SugarTestCallUtilities::removeAllCreatedCalls();
     SugarTestContactUtilities::removeAllCreatedContacts();
     SugarTestTaskUtilities::removeAllCreatedTasks();
     unset($GLOBALS['current_user']);
     unset($GLOBALS['beanFiles']);
     unset($GLOBALS['beanList']);
 }