public function testSaveAndMarkdeletedAndSetAcceptStatus()
 {
     $meeting = new Meeting();
     $meeting->name = 'test';
     $meeting->status = 'Not Held';
     $meeting->type = 'Sugar';
     $meeting->description = 'test description';
     $meeting->duration_hours = 1;
     $meeting->duration_minutes = 1;
     $meeting->date_start = '2016-02-11 17:30:00';
     $meeting->date_end = '2016-02-11 17:30:00';
     $meeting->save();
     //test for record ID to verify that record is saved
     $this->assertTrue(isset($meeting->id));
     $this->assertEquals(36, strlen($meeting->id));
     /* Test set_accept_status method */
     //test set_accept_status with User object
     $user = new User();
     $meeting->set_accept_status($user, 'accept');
     //test set_accept_status with contact object
     $contact = new Contact();
     $meeting->set_accept_status($contact, 'accept');
     //test set_accept_status with Lead object
     $lead = new Lead();
     $meeting->set_accept_status($lead, 'accept');
     //mark all created relationships as deleted
     $meeting->mark_relationships_deleted($meeting->id);
     //mark the record as deleted and verify that this record cannot be retrieved anymore.
     $meeting->mark_deleted($meeting->id);
     $result = $meeting->retrieve($meeting->id);
     $this->assertEquals(null, $result);
 }
Exemple #2
0
 function save($id = FALSE)
 {
     if ($_POST) {
         $meeting = new Meeting($id);
         $_POST['start_date'] = Date2DB($_POST['start_date']);
         $_POST['end_date'] = Date2DB($_POST['end_date']);
         $_POST['close_date'] = Date2DB($_POST['close_date']);
         $meeting->from_array($_POST);
         $meeting->save();
         fix_file($_FILES['file']);
         foreach ($_POST['doc'] as $key => $doc) {
             if (@$_FILES['file'][$key]['name'] || @$_POST['doc_id'][$key]) {
                 $document = new Meeting_document(@$_POST['doc_id'][$key]);
                 if ($_FILES['file'][$key]['name']) {
                     if (@$_POST['doc_id'][$key]) {
                         $document->delete_file('uploads/meeting', 'file');
                     }
                     $document->file = $document->upload($_FILES['file'][$key], 'uploads/meeting');
                 }
                 $document->name = $doc;
                 $document->meeting_id = $meeting->id;
                 $document->save();
             }
         }
         set_notify('success', lang('save_data_complete'));
     }
     redirect('meetings');
 }
Exemple #3
0
 public function setUp()
 {
     global $current_user, $currentModule;
     $mod_strings = return_module_language($GLOBALS['current_language'], "Meetings");
     $current_user = SugarTestUserUtilities::createAnonymousUser();
     $meeting = new Meeting();
     $meeting->id = uniqid();
     $meeting->name = 'Test Meeting';
     $meeting->save();
     $this->meeting = $meeting;
 }
 public static function createMeeting($id = '')
 {
     $time = mt_rand();
     $name = 'Meeting';
     $meeting = new Meeting();
     $meeting->name = $name . $time;
     if (!empty($id)) {
         $meeting->new_with_id = true;
         $meeting->id = $id;
     }
     $meeting->save();
     self::$_createdMeetings[] = $meeting;
     return $meeting;
 }
 function create()
 {
     $meeting = new Meeting();
     $meeting->m_date = $this->params('date') . ' ' . $this->params('time');
     foreach (['local', 'participants', 'systems', 'infra', 'processes', 'people', 'organ_id'] as $field) {
         $meeting->{$field} = $this->params($field);
     }
     $meeting->document_id = $this->session('document_id');
     if ($meeting->save()) {
         $this->redirect('/documents/' . $this->session('document_id') . '/meetings', 'Salvo com sucesso!');
     } else {
         $this->redirect('/documents/' . $this->session('document_id') . '/meetings', 'Ocorreu algum erro.');
     }
 }
Exemple #6
0
 protected function createNewMeeting()
 {
     $m = new Meeting();
     $m->name = "40541TestMeeting";
     $m->date_start = gmdate($GLOBALS['timedate']->get_db_date_time_format(), time() + 3000);
     $m->duration_hours = 0;
     $m->duration_minutes = 15;
     $m->reminder_time = 60;
     $m->reminder_checked = true;
     $m->save();
     $m->load_relationship("users");
     $m->users->add($this->_user->id);
     $this->beans[] = $m;
     return $m;
 }
 public static function createMeetingWithOwnerAndRelatedAccount($name, $owner, $account)
 {
     $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $endStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 11000);
     $meeting = new Meeting();
     $meeting->name = $name;
     $meeting->owner = $owner;
     $meeting->location = 'my location';
     $meeting->category->value = 'Call';
     $meeting->startDateTime = $startStamp;
     $meeting->endDateTime = $endStamp;
     $meeting->description = 'my test description';
     $meeting->activityItems->add($account);
     $saved = $meeting->save();
     assert('$saved');
     return $meeting;
 }
 public static function createMeeting($id = '')
 {
     $time = mt_rand();
     $name = 'Meeting';
     $meeting = new Meeting();
     $meeting->name = $name . $time;
     $meeting->date_start = $GLOBALS['timedate']->getNow()->asDb();
     $meeting->duration_hours = '0';
     $meeting->duration_minutes = '15';
     if (!empty($id)) {
         $meeting->new_with_id = true;
         $meeting->id = $id;
     }
     $meeting->save();
     self::$_createdMeetings[] = $meeting;
     return $meeting;
 }
 public function testUpdateLatestActivityDateTimeWhenAMeetingIsInThePast()
 {
     $meeting = new Meeting();
     $meeting->name = 'my meeting';
     $meeting->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 86400);
     $this->assertNull($meeting->processedForLatestActivity);
     $meeting->processedForLatestActivity = true;
     $this->assertTrue($meeting->save());
     $this->assertTrue($meeting->processedForLatestActivity == false);
     $meeting->processedForLatestActivity = true;
     $this->assertTrue($meeting->save());
     $this->assertTrue($meeting->processedForLatestActivity == true);
 }
 $meeting->date_start = create_date() . ' ' . create_time();
 //$meeting->time_start = date("H:i",time());
 $meeting->duration_hours = array_rand($possible_duration_hours_arr);
 $meeting->duration_minutes = array_rand($possible_duration_minutes_arr);
 $meeting->assigned_user_id = $assigned_user_id;
 $meeting->assigned_user_id = $contacts_account->assigned_user_id;
 $meeting->assigned_user_name = $contacts_account->assigned_user_name;
 $meeting->description = 'Meeting to discuss project plan and hash out the details of implementation';
 $key = array_rand($app_list_strings['meeting_status_dom']);
 $meeting->status = $app_list_strings['meeting_status_dom'][$key];
 $meeting->contact_id = $contact->id;
 $meeting->parent_id = $account_id;
 $meeting->parent_type = 'Accounts';
 // dont update vcal
 $meeting->update_vcal = false;
 $meeting->save();
 // leverage the seed user to set the acceptance status on the meeting.
 $seed_user->id = $meeting->assigned_user_id;
 $meeting->set_accept_status($seed_user, 'accept');
 //Create new emails
 $email = new Email();
 $key = array_rand($email->default_email_subject_values);
 $email->name = $email->default_email_subject_values[$key];
 $email->date_start = create_date();
 $email->time_start = create_time();
 $email->duration_hours = array_rand($possible_duration_hours_arr);
 $email->duration_minutes = array_rand($possible_duration_minutes_arr);
 $email->assigned_user_id = $assigned_user_id;
 $email->assigned_user_id = $contacts_account->assigned_user_id;
 $email->assigned_user_name = $contacts_account->assigned_user_name;
 $email->description = 'Discuss project plan and hash out the details of implementation';
 public static function makeMassDeleteData()
 {
     $account = new Account();
     $account->owner = Yii::app()->user->userModel;
     $account->name = 'Mass Delete Full Load Account';
     $saved = $account->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     //Load past meetings that will show up as latest activities
     for ($i = 0; $i < 15; $i++) {
         $meeting = new Meeting();
         $meeting->name = 'MyMeeting ' . $i;
         $meeting->owner = Yii::app()->user->userModel;
         $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 10000 - $i * 3600 * 24);
         $meeting->startDateTime = $startStamp;
         $meeting->activityItems->add($account);
         $saved = $meeting->save();
         if (!$saved) {
             throw new NotSupportedException();
         }
     }
     //Load upcoming tasks
     for ($i = 0; $i < 15; $i++) {
         $task = new Task();
         $task->name = 'MyTask ' . $i;
         $task->completed = false;
         $task->owner = Yii::app()->user->userModel;
         $dueDateStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000 + $i * 3600 * 24);
         $task->dueDateTime = $dueDateStamp;
         $task->activityItems->add($account);
         $saved = $task->save();
         if (!$saved) {
             throw new NotSupportedException();
         }
     }
     //Load 20 so there is sufficient data for list view pagination testing
     for ($i = 0; $i < 20; $i++) {
         $account = new Account();
         $account->owner = Yii::app()->user->userModel;
         $account->name = 'Mass Delete Test Account ' . $i;
         $saved = $account->save();
         if (!$saved) {
             throw new NotSupportedException();
         }
     }
 }
Exemple #12
0
 /**
  * Should not throw exception, should cast down ok
  */
 public function testCastDown()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $meeting = new Meeting();
     $meeting->name = 'aTest';
     $meeting->startDateTime = $startStamp;
     $this->assertTrue($meeting->save());
     $itemId = $meeting->getClassId('Item');
     $item = Item::getById($itemId);
     $modelDerivationPathToItem = RuntimeUtil::getModelDerivationPathToItem('Meeting');
     $castedDownModel = $item->castDown(array($modelDerivationPathToItem));
     $this->assertEquals('Meeting', get_class($castedDownModel));
 }
Exemple #13
0
 function testEmailReminder()
 {
     $meeting = new Meeting();
     $meeting->email_reminder_time = "20";
     $meeting->name = 'Test Email Reminder';
     $meeting->status = "Planned";
     $meeting->date_start = $GLOBALS['timedate']->nowDb();
     $meeting->save();
     require_once "modules/Activities/EmailReminder.php";
     $er = new EmailReminder();
     $to_remind = $er->getMeetingsForRemind();
     $this->assertTrue(in_array($meeting->id, $to_remind));
     $GLOBALS['db']->query("DELETE FROM meetings WHERE id = '{$meeting->id}'");
 }
 public function storeMeeting()
 {
     $advisor = Auth::user();
     $day = Day::find(Input::get('day_id'));
     // If form validation passes:
     $meeting = new Meeting();
     $meeting->title = Input::get('title');
     if (Input::get('notes')) {
         $meeting->notes = Input::get('notes');
     }
     $meeting->save();
     $meeting->days()->save($day);
     $advisor->meetings()->save($meeting);
     return Redirect::attempt('advisor.dashboard');
 }
<?php

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}
require_once "modules/Calls/Call.php";
require_once "modules/Meetings/Meeting.php";
if ($_REQUEST['type'] == 'call') {
    $bean = new Call();
}
if ($_REQUEST['type'] == 'meeting') {
    $bean = new Meeting();
}
$bean->retrieve($_REQUEST['record']);
if (!$bean->ACLAccess('Save')) {
    die;
}
$bean->date_start = $_REQUEST['datetime'];
$bean->date_end = $_REQUEST['date_end'];
$bean->save();