コード例 #1
0
ファイル: User.php プロジェクト: vojtajina/sitellite
    function export($user)
    {
        global $db, $loader;
        $row = $db->fetch('
			select
				*
			from
				sitellite_user
			where
				username = ?', $user);
        if (!$row) {
            $this->error = $db->error;
            return false;
        }
        // build vcard
        $loader->import('saf.Date.vCalendar');
        $card = new vCal();
        $card->tag = 'VCARD';
        $card->addProperty('VERSION', '3.0');
        $card->addProperty('PRODID', '-//Simian Systems\\, Inc//NONSGML Sitellite CMS ' . SITELLITE_VERSION . '//EN');
        if (empty($row->firstname) && empty($row->lastname)) {
            // skip name
            $card->addProperty('N', $row->username);
        } else {
            $card->addProperty('N', array($row->firstname, $row->lastname));
            $card->addProperty('FN', $row->firstname . ' ' . $row->lastname);
        }
        if (!empty($row->company)) {
            $card->addProperty('ORG', $row->company);
        }
        if (!empty($row->position)) {
            $title =& $card->addProperty('TITLE', $row->position);
            $title->addParameter('LANGUAGE', $row->lang);
        }
        if (!empty($row->email)) {
            $card->addProperty('EMAIL', $row->email, array('type' => 'WORK'));
        }
        if (!empty($row->phone)) {
            $card->addProperty('TEL', $row->phone, array('type' => 'WORK'));
        }
        if (!empty($row->cell)) {
            $card->addProperty('TEL', $row->cell, array('type' => 'CELL'));
        }
        if (!empty($row->fax)) {
            $card->addProperty('TEL', $row->fax, array('type' => 'FAX'));
        }
        if (!empty($row->home)) {
            $card->addProperty('TEL', $row->home, array('type' => 'HOME'));
        }
        if (!empty($row->address1)) {
            $card->addProperty('ADR', array('', '', $row->address1, $row->city, $row->province, $row->postal_code, $row->country), array('type' => 'HOME'));
        }
        if (!empty($row->website)) {
            $card->addProperty('URL', $row->website);
        }
        // write the vcard
        return $card->unfold($card->write());
    }
コード例 #2
0
ファイル: Bug62943Test.php プロジェクト: delkyd/sugarcrm_dev
 private function grabiCalField($iCal, $field)
 {
     $ical_arr = vCal::create_ical_array_from_string($iCal);
     foreach ($ical_arr as $ical_val) {
         if ($ical_val[0] == $field) {
             return $ical_val[1];
         }
     }
     return "";
 }
コード例 #3
0
 /**
  * handles save functionality for meetings
  * @param	string prefix
  * @param	bool redirect default True
  * @param	bool useRequired default True
  */
 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     global $current_user;
     global $timedate;
     $focus = BeanFactory::getBean('Meetings');
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!isset($_POST['reminder_checked']) or isset($_POST['reminder_checked']) && $_POST['reminder_checked'] == '0') {
         $_POST['reminder_time'] = -1;
     }
     if (!isset($_POST['reminder_time'])) {
         $_POST['reminder_time'] = $current_user->getPreference('reminder_time');
         $_POST['reminder_checked'] = 1;
     }
     if (!isset($_POST['email_reminder_checked']) || isset($_POST['email_reminder_checked']) && $_POST['email_reminder_checked'] == '0') {
         $_POST['email_reminder_time'] = -1;
     }
     if (!isset($_POST['email_reminder_time'])) {
         $_POST['email_reminder_time'] = $current_user->getPreference('email_reminder_time');
         $_POST['email_reminder_checked'] = 1;
     }
     if (isset($_POST['repeat_parent_id']) && trim($_POST['repeat_parent_id']) == '') {
         unset($_POST['repeat_parent_id']);
     }
     // don't allow to set recurring_source from a form
     unset($_POST['recurring_source']);
     $time_format = $timedate->get_user_time_format();
     $time_separator = ":";
     if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
         $time_separator = $match[1];
     }
     if (!empty($_POST[$prefix . 'time_hour_start']) && empty($_POST['time_start'])) {
         $_POST[$prefix . 'time_start'] = $_POST[$prefix . 'time_hour_start'] . $time_separator . $_POST[$prefix . 'time_minute_start'];
     }
     if (isset($_POST[$prefix . 'meridiem']) && !empty($_POST[$prefix . 'meridiem'])) {
         $_POST[$prefix . 'time_start'] = $timedate->merge_time_meridiem($_POST[$prefix . 'time_start'], $timedate->get_time_format(), $_POST[$prefix . 'meridiem']);
     }
     if (isset($_POST[$prefix . 'time_start']) && strlen($_POST[$prefix . 'date_start']) == 10) {
         $_POST[$prefix . 'date_start'] = $_POST[$prefix . 'date_start'] . ' ' . $_POST[$prefix . 'time_start'];
     }
     // retrieve happens here
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     // if dates changed
     if (!empty($focus->id)) {
         $oldBean = new Meeting();
         $oldBean->retrieve($focus->id);
         if ($focus->date_start != $oldBean->date_start || $focus->date_end != $oldBean->date_end) {
             $focus->date_changed = true;
         } else {
             $focus->date_changed = false;
         }
     }
     $newBean = true;
     if (!empty($focus->id)) {
         $newBean = false;
     }
     //add assigned user and current user if this is the first time bean is saved
     if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'DetailView') {
         //if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user)
         //The current user is already added to UI and we want to give the current user the option of opting out of meeting.
         //add current user if the assigned to user is different than current user.
         if ($current_user->id != $_POST['assigned_user_id']) {
             $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
             $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
         }
     } elseif (empty($focus->id)) {
         //this is not from long form so add assigned and current user automatically as there is no invitee list UI.
         //This call could be through an ajax call from subpanels or shortcut bar
         if (!isset($_POST['user_invitees'])) {
             $_POST['user_invitees'] = '';
         }
         $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
         //add current user if the assigned to user is different than current user.
         if ($current_user->id != $_POST['assigned_user_id'] && $_REQUEST['module'] != "Calendar") {
             $_POST['user_invitees'] .= ',' . $current_user->id . ', ';
         }
         //remove any double comma's introduced during appending
         $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
     }
     if (isset($_POST['isSaveFromDetailView']) && $_POST['isSaveFromDetailView'] == 'true' || (isset($_POST['is_ajax_call']) && !empty($_POST['is_ajax_call']) && !empty($focus->id) || isset($_POST['return_action']) && $_POST['return_action'] == 'SubPanelViewer' && !empty($focus->id)) || !isset($_POST['user_invitees'])) {
         $focus->save(true);
         $return_id = $focus->id;
     } else {
         if ($focus->status == 'Held' && $this->isEmptyReturnModuleAndAction() && !$this->isSaveFromDCMenu()) {
             //if we are closing the meeting, and the request does not have a return module AND return action set and it is not a save
             //being triggered by the DCMenu (shortcut bar) then the request is coming from a dashlet or subpanel close icon and there is no
             //need to process user invitees, just save the current values.
             $focus->save(true);
         } else {
             $relate_to = $this->getRelatedModuleName($focus);
             $userInvitees = array();
             $contactInvitees = array();
             $leadInvitees = array();
             $existingUsers = array();
             $existingContacts = array();
             $existingLeads = array();
             if (!empty($_POST['user_invitees'])) {
                 $userInvitees = explode(',', trim($_POST['user_invitees'], ','));
             }
             if (!empty($_POST['existing_invitees'])) {
                 $existingUsers = explode(",", trim($_POST['existing_invitees'], ','));
             }
             if (!empty($_POST['contact_invitees'])) {
                 $contactInvitees = explode(',', trim($_POST['contact_invitees'], ','));
             }
             if (!empty($_POST['existing_contact_invitees'])) {
                 $existingContacts = explode(",", trim($_POST['existing_contact_invitees'], ','));
             }
             if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Contacts') {
                 $contactInvitees[] = $_POST['parent_id'];
             }
             if ($relate_to == 'Contacts') {
                 if (!empty($_REQUEST['relate_id']) && !in_array($_REQUEST['relate_id'], $contactInvitees)) {
                     $contactInvitees[] = $_REQUEST['relate_id'];
                 }
             }
             if (!empty($_POST['lead_invitees'])) {
                 $leadInvitees = explode(',', trim($_POST['lead_invitees'], ','));
             }
             if (!empty($_POST['existing_lead_invitees'])) {
                 $existingLeads = explode(",", trim($_POST['existing_lead_invitees'], ','));
             }
             if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Leads') {
                 $leadInvitees[] = $_POST['parent_id'];
             }
             if ($relate_to == 'Leads') {
                 if (!empty($_REQUEST['relate_id']) && !in_array($_REQUEST['relate_id'], $leadInvitees)) {
                     $leadInvitees[] = $_REQUEST['relate_id'];
                 }
             }
             // Call the Meeting module's save function to handle saving other fields besides
             // the users and contacts relationships
             $focus->update_vcal = false;
             // Bug #49195 : don't update vcal b/s related users aren't saved yet, create vcal cache below
             $focus->users_arr = $userInvitees;
             $focus->contacts_arr = $contactInvitees;
             $focus->leads_arr = $leadInvitees;
             $focus->save(true);
             $return_id = $focus->id;
             if (empty($return_id)) {
                 //this is to handle the situation where the save fails, most likely because of a failure
                 //in the external api. bug: 42200
                 $_REQUEST['action'] = 'EditView';
                 $_REQUEST['return_action'] = 'EditView';
                 handleRedirect('', 'Meetings');
             }
             $focus->setUserInvitees($userInvitees, $existingUsers);
             $focus->setContactInvitees($contactInvitees, $existingContacts);
             $focus->setLeadInvitees($focus->leads_arr, $existingLeads);
             // Bug #49195 : update vcal
             vCal::cache_sugar_vcal($current_user);
             $this->processRecurring($focus);
         }
     }
     if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] === 'Home') {
         SugarApplication::redirect(buildRedirectURL('', 'Home'));
     } else {
         if ($redirect) {
             handleRedirect($return_id, 'Meetings');
         } else {
             return $focus;
         }
     }
 }
コード例 #4
0
ファイル: CalendarActivity.php プロジェクト: NALSS/SuiteCRM
 function get_freebusy_activities($user_focus, $start_date_time, $end_date_time)
 {
     $act_list = array();
     $vcal_focus = new vCal();
     $vcal_str = $vcal_focus->get_vcal_freebusy($user_focus);
     $lines = explode("\n", $vcal_str);
     $utc = new DateTimeZone("UTC");
     foreach ($lines as $line) {
         if (preg_match('/^FREEBUSY.*?:([^\\/]+)\\/([^\\/]+)/i', $line, $matches)) {
             $dates_arr = array(SugarDateTime::createFromFormat(vCal::UTC_FORMAT, $matches[1], $utc), SugarDateTime::createFromFormat(vCal::UTC_FORMAT, $matches[2], $utc));
             $act_list[] = new CalendarActivity($dates_arr);
         }
     }
     return $act_list;
 }
コード例 #5
0
ファイル: Calendar.php プロジェクト: aldridged/gtg-sugar
 function get_freebusy_activities(&$user_focus, &$start_date_time, &$end_date_time)
 {
     $act_list = array();
     $vcal_focus = new vCal();
     $vcal_str = $vcal_focus->get_vcal_freebusy($user_focus);
     $lines = explode("\n", $vcal_str);
     foreach ($lines as $line) {
         $dates_arr = array();
         if (preg_match('/^FREEBUSY.*?:([^\\/]+)\\/([^\\/]+)/i', $line, $matches)) {
             $dates_arr[] = DateTimeUtil::parse_utc_date_time($matches[1]);
             $dates_arr[] = DateTimeUtil::parse_utc_date_time($matches[2]);
             $act_list[] = new CalendarActivity($dates_arr);
         }
     }
     usort($act_list, 'sort_func_by_act_date');
     return $act_list;
 }
コード例 #6
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

$user = db_single('select * from sitellite_user where username = ?', $parameters['user']);
if (!$user) {
    die('User not found');
}
loader_import('saf.Date.vCalendar');
$card = new vCal();
$card->tag = 'VCARD';
$card->addProperty('VERSION', '3.0');
$card->addProperty('FN', $user->firstname . ' ' . $user->lastname);
$card->addProperty('N', array($user->lastname, $user->firstname));
if (!empty($user->company)) {
    $card->addProperty('ORG', $user->company);
}
if (!empty($user->website)) {
    $card->addProperty('URL', $user->website, array('TYPE' => 'WORK'));
}
if (!empty($user->email)) {
    $card->addProperty('EMAIL', $user->email, array('PREF' => 'INTERNET'));
}
if (!empty($user->phone)) {
    $card->addProperty('TEL', $user->phone, array('TYPE' => 'WORK'));
}
if (!empty($user->cell)) {
    $card->addProperty('TEL', $user->cell, array('TYPE' => 'CELL'));
}
if (!empty($user->home)) {
    $card->addProperty('TEL', $user->home, array('TYPE' => 'HOME'));
}
if (!empty($user->address1)) {
コード例 #7
0
ファイル: iCal.php プロジェクト: MexinaD/SuiteCRM
 /**
  * Generates the complete string for the calendar
  *
  * @param User $user_focus the user
  * @param integer $num_months the number of months to search before and after today
  * @return string the iCal calenar string
  */
 function getVcalIcal(&$user_focus, $num_months)
 {
     global $current_user, $timedate;
     $current_user = $user_focus;
     $cal_name = $user_focus->first_name . " " . $user_focus->last_name;
     $ical_array = array();
     $ical_array[] = array("BEGIN", "VCALENDAR");
     $ical_array[] = array("VERSION", "2.0");
     $ical_array[] = array("METHOD", "PUBLISH");
     $ical_array[] = array("X-WR-CALNAME", "{$cal_name} (SugarCRM)");
     $ical_array[] = array("PRODID", "-//SugarCRM//SugarCRM Calendar//EN");
     $ical_array = array_merge($ical_array, vCal::create_ical_array_from_string($this->getTimezoneString()));
     $ical_array[] = array("CALSCALE", "GREGORIAN");
     $now_date_time = $timedate->getNow(true);
     global $sugar_config;
     $timeOffset = 2;
     if (isset($sugar_config['vcal_time']) && $sugar_config['vcal_time'] != 0 && $sugar_config['vcal_time'] < 13) {
         $timeOffset = $sugar_config['vcal_time'];
     }
     if (!empty($num_months)) {
         $timeOffset = $num_months;
     }
     $start_date_time = $now_date_time->get("-{$timeOffset} months");
     $end_date_time = $now_date_time->get("+{$timeOffset} months");
     $utc_now_time = $this->getUtcDateTime($now_date_time);
     $str = vCal::create_ical_string_from_array($ical_array, true);
     $str .= $this->createSugarIcal($user_focus, $start_date_time, $end_date_time, $utc_now_time);
     $ical_array = array(array("DTSTAMP", $utc_now_time));
     $ical_array[] = array("END", "VCALENDAR");
     $str .= vCal::create_ical_string_from_array($ical_array, true);
     return $str;
 }
コード例 #8
0
ファイル: vCal.php プロジェクト: auf/crm_auf_org
        static function cache_sugar_vcal_freebusy(&$user_focus)
        {
            $focus = new vCal();
            // set freebusy members and save
            $arr = array('user_id'=>$user_focus->id,'type'=>'vfb','source'=>'sugar');
            $focus->retrieve_by_string_fields($arr);


            $focus->content = $focus->get_vcal_freebusy($user_focus,false);
            $focus->type = 'vfb';
            $focus->date_modified = null;
            $focus->source = 'sugar';
            $focus->user_id = $user_focus->id;
            $focus->save();
        }
コード例 #9
0
 /**
  * @param SugarBean $parentBean
  * @return array events saved
  * @throws SugarException
  */
 public function saveRecurringEvents(SugarBean $parentBean)
 {
     global $timedate;
     if (!$this->isEventRecurring($parentBean)) {
         $logmsg = 'SaveRecurringEvents() : Event is not a Recurring Event';
         $GLOBALS['log']->error($logmsg);
         throw new SugarException('LBL_CALENDAR_EVENT_NOT_A_RECURRING_EVENT', array($parentBean->object_name));
     }
     if (!empty($parentBean->repeat_parent_id)) {
         $logmsg = 'SaveRecurringEvents() : Event received is not the Parent Occcurrence';
         $GLOBALS['log']->error($logmsg);
         throw new SugarException('LBL_CALENDAR_EVENT_IS_NOT_A_PARENT_OCCURRENCE', array($parentBean->object_name));
     }
     $dateStart = $this->formatDateTime('datetime', $parentBean->date_start, 'user');
     $params = array();
     $params['type'] = $parentBean->repeat_type;
     $params['interval'] = $parentBean->repeat_interval;
     $params['count'] = $parentBean->repeat_count;
     $params['until'] = $this->formatDateTime('date', $parentBean->repeat_until, 'user');
     $params['dow'] = $parentBean->repeat_dow;
     $repeatDateTimeArray = $this->buildRecurringSequence($dateStart, $params);
     $limit = $this->getRecurringLimit();
     if (count($repeatDateTimeArray) > $limit - 1) {
         $logMessage = sprintf('Calendar Events (%d) exceed Event Limit: (%d)', count($repeatDateTimeArray), $limit);
         $GLOBALS['log']->warning($logMessage);
     }
     // Turn off The Cache Updates while deleting the multiple recurrences.
     // The current Cache Enabled status is returned so it can be appropriately
     // restored when all the recurrences have been deleted.
     $cacheEnabled = vCal::setCacheUpdateEnabled(false);
     $this->markRepeatDeleted($parentBean);
     // Restore the Cache Enabled status to its previous state
     vCal::setCacheUpdateEnabled($cacheEnabled);
     return $this->saveRecurring($parentBean, $repeatDateTimeArray);
 }
コード例 #10
0
ファイル: index.php プロジェクト: vojtajina/sitellite
<?php

loader_import('siteevent.Event');
loader_import('saf.Date');
loader_import('saf.Date.vCalendar');
if (!isset($parameters['limit'])) {
    $parameters['limit'] = 50;
}
$e = new SiteEvent_Event();
$list = $e->getUpcoming($parameters['limit'], $parameters['category'], $parameters['audience']);
$cal = new vCal();
$cal->addProperty('METHOD', 'PUBLISH');
$cal->addProperty('CALSCALE', 'GREGORIAN');
$cal->addProperty('PRODID', '-//SIMIAN systems//NONSGML SiteEvent//EN');
$cal->addProperty('VERSION', '2.0');
foreach (array_keys($list) as $k) {
    $item =& $list[$k];
    $e =& $cal->addEvent('VEVENT');
    $e->addProperty('UID', site_domain() . '/siteevent/' . $item->id);
    $e->addProperty('SEQUENCE', $k + 1);
    $p =& $e->addProperty('URL', 'http://' . site_domain() . site_prefix() . '/index/siteevent-details-action/id.' . $item->id . '/title.' . siteevent_filter_link_title($item->title));
    $p->addParameter('VALUE', 'URI');
    $e->addProperty('STATUS', 'CONFIRMED');
    if ($item->time && $item->time > '00:00:00') {
        $e->addProperty('DTSTART', Date::timestamp($item->date . ' ' . $item->time, 'Ymd\\THis'));
    } else {
        $p =& $e->addProperty('DTSTART', Date::format($item->date, 'Ymd'));
        $p->addParameter('VALUE', 'DATE');
    }
    if ($item->until_date && $item->until_date > '0000-00-00') {
        if ($item->until_time && $item->until_time > '00:00:00') {
コード例 #11
0
ファイル: vCalTest.php プロジェクト: sacredwebsite/SuiteCRM
 public function testget_ical_event()
 {
     $user = new User(1);
     $meeting = new Meeting();
     $meeting->id = 1;
     $meeting->date_start = '2016-02-11 17:30:00';
     $meeting->date_end = '2016-02-11 17:30:00';
     $meeting->name = 'test';
     $meeting->location = 'test location';
     $meeting->description = 'test description';
     $expectedStart = "BEGIN:VCALENDAR\r\nVERSION:2.0\r\nPRODID:-//SugarCRM//SugarCRM Calendar//EN\r\nBEGIN:VEVENT\r\nUID:1\r\nORGANIZED;CN=:\r\nDTSTART:20160211T173000Z\r\nDTEND:20160211T173000Z\r\n";
     $expectedEnd = "\r\nSUMMARY:test\r\nLOCATION:test location\r\nDESCRIPTION:test description\r\nEND:VEVENT\r\nEND:VCALENDAR\r\n";
     $result = vCal::get_ical_event($meeting, $user);
     $this->assertStringStartsWith($expectedStart, $result);
     $this->assertStringEndsWith($expectedEnd, $result);
 }
コード例 #12
0
ファイル: Bug64061Test.php プロジェクト: delkyd/sugarcrm_dev
 /**
  * Test the function create_ical_array_from_string()
  *
  * @dataProvider iCalProvider
  */
 public function testiCalArrayFromString($icalarray, $icalstring)
 {
     $res = vCal::create_ical_array_from_string($icalstring);
     $this->assertEquals($icalarray, $res);
 }
コード例 #13
0
ファイル: iCal.php プロジェクト: rgauss/sugar-ical-patch
 function iCal()
 {
     parent::vCal();
 }
コード例 #14
0
ファイル: vCalProperty.php プロジェクト: vojtajina/sitellite
 /**
  * Writes the property out in vCalendar format.
  * 
  * @access	public
  * @return	string
  * 
  */
 function write()
 {
     $out = $this->name . "\r\n";
     foreach ($this->parameters as $key => $value) {
         if (is_array($value)) {
             $vals = array();
             foreach ($value as $k => $v) {
                 $value[$k] = vCal::quote($v);
                 $vals[] = $key . '=' . $value[$k];
             }
             //$out .= vCal::fold (join (',', $value)) . "\r\n";
             // it doesn't look like people use commas in other implementations,
             // and it seems that multiple properties and parameters may use
             // the same name, which means hashes don't work so well here.
             //				$out .= vCal::fold (join (';', $value)) . "\r\n";
             $out .= ' ;' . vCal::fold(join("\r\n ;", $vals)) . "\r\n";
         } else {
             $out .= ' ;' . $key . '=';
             $out .= vCal::fold(vCal::quote($value)) . "\r\n";
         }
     }
     if (is_array($this->value)) {
         $numeric = false;
         foreach ($this->value as $key => $value) {
             if (is_numeric($key)) {
                 $numeric = true;
             } else {
                 $numeric = false;
             }
             break;
         }
         $out .= ' :';
         $buf = array();
         foreach ($this->value as $key => $value) {
             // to handle values and parameters whose values are arrays...
             if (is_array($value)) {
                 foreach ($value as $k => $v) {
                     $value[$k] = vCal::quote($v);
                 }
                 $value = join(';', $value);
             }
             if ($numeric) {
                 $buf[] = vCal::fold(vCal::quote($value));
             } else {
                 $buf[] = $key . '=' . vCal::fold(vCal::quote($value));
             }
         }
         //if ($numeric) {
         //$out .= join (',', $buf) . "\r\n";
         //} else {
         $out .= join(';', $buf) . "\r\n";
         //}
     } else {
         $out .= ' :' . vCal::fold($this->value) . "\r\n";
     }
     return $out;
 }
コード例 #15
0
ファイル: vCal.php プロジェクト: jglaine/sugar761-ent
 public static function cache_sugar_vcal(&$user_focus)
 {
     vCal::cache_sugar_vcal_freebusy($user_focus);
 }
コード例 #16
0
ファイル: MeetingFormBase.php プロジェクト: sunmo/snowlotus
 /**
  * handles save functionality for meetings
  * @param	string prefix
  * @param	bool redirect default True
  * @param	bool useRequired default True
  */
 function handleSave($prefix, $redirect = true, $useRequired = false)
 {
     require_once 'include/formbase.php';
     global $current_user;
     global $timedate;
     $focus = new Meeting();
     if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
         return null;
     }
     if (!isset($_POST['reminder_checked']) or isset($_POST['reminder_checked']) && $_POST['reminder_checked'] == '0') {
         $_POST['reminder_time'] = -1;
     }
     if (!isset($_POST['reminder_time'])) {
         $_POST['reminder_time'] = $current_user->getPreference('reminder_time');
         $_POST['reminder_checked'] = 1;
     }
     if (!isset($_POST['email_reminder_checked']) || isset($_POST['email_reminder_checked']) && $_POST['email_reminder_checked'] == '0') {
         $_POST['email_reminder_time'] = -1;
     }
     if (!isset($_POST['email_reminder_time'])) {
         $_POST['email_reminder_time'] = $current_user->getPreference('email_reminder_time');
         $_POST['email_reminder_checked'] = 1;
     }
     // don't allow to set recurring_source from a form
     unset($_POST['recurring_source']);
     $time_format = $timedate->get_user_time_format();
     $time_separator = ":";
     if (preg_match('/\\d+([^\\d])\\d+([^\\d]*)/s', $time_format, $match)) {
         $time_separator = $match[1];
     }
     if (!empty($_POST[$prefix . 'time_hour_start']) && empty($_POST['time_start'])) {
         $_POST[$prefix . 'time_start'] = $_POST[$prefix . 'time_hour_start'] . $time_separator . $_POST[$prefix . 'time_minute_start'];
     }
     if (isset($_POST[$prefix . 'meridiem']) && !empty($_POST[$prefix . 'meridiem'])) {
         $_POST[$prefix . 'time_start'] = $timedate->merge_time_meridiem($_POST[$prefix . 'time_start'], $timedate->get_time_format(), $_POST[$prefix . 'meridiem']);
     }
     if (isset($_POST[$prefix . 'time_start']) && strlen($_POST[$prefix . 'date_start']) == 10) {
         $_POST[$prefix . 'date_start'] = $_POST[$prefix . 'date_start'] . ' ' . $_POST[$prefix . 'time_start'];
     }
     // retrieve happens here
     $focus = populateFromPost($prefix, $focus);
     if (!$focus->ACLAccess('Save')) {
         ACLController::displayNoAccess(true);
         sugar_cleanup(true);
     }
     // if dates changed
     if (!empty($focus->id)) {
         $oldBean = new Meeting();
         $oldBean->retrieve($focus->id);
         if ($focus->date_start != $oldBean->date_start || $focus->date_end != $oldBean->date_end) {
             $focus->date_changed = true;
         } else {
             $focus->date_changed = false;
         }
     }
     $newBean = true;
     if (!empty($focus->id)) {
         $newBean = false;
     }
     //add assigned user and current user if this is the first time bean is saved
     if (empty($focus->id) && !empty($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Meetings' && !empty($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'DetailView') {
         //if return action is set to detail view and return module to meeting, then this is from the long form, do not add the assigned user (only the current user)
         //The current user is already added to UI and we want to give the current user the option of opting out of meeting.
         //add current user if the assigned to user is different than current user.
         if ($current_user->id != $_POST['assigned_user_id']) {
             $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
             $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
         }
     } elseif (empty($focus->id)) {
         //this is not from long form so add assigned and current user automatically as there is no invitee list UI.
         //This call could be through an ajax call from subpanels or shortcut bar
         if (!isset($_POST['user_invitees'])) {
             $_POST['user_invitees'] = '';
         }
         $_POST['user_invitees'] .= ',' . $_POST['assigned_user_id'] . ', ';
         //add current user if the assigned to user is different than current user.
         if ($current_user->id != $_POST['assigned_user_id'] && $_REQUEST['module'] != "Calendar") {
             $_POST['user_invitees'] .= ',' . $current_user->id . ', ';
         }
         //remove any double comma's introduced during appending
         $_POST['user_invitees'] = str_replace(',,', ',', $_POST['user_invitees']);
     }
     if (isset($_POST['isSaveFromDetailView']) && $_POST['isSaveFromDetailView'] == 'true' || (isset($_POST['is_ajax_call']) && !empty($_POST['is_ajax_call']) && !empty($focus->id) || isset($_POST['return_action']) && $_POST['return_action'] == 'SubPanelViewer' && !empty($focus->id)) || !isset($_POST['user_invitees'])) {
         $focus->save(true);
         $return_id = $focus->id;
     } else {
         if ($focus->status == 'Held' && $this->isEmptyReturnModuleAndAction() && !$this->isSaveFromDCMenu()) {
             //if we are closing the meeting, and the request does not have a return module AND return action set and it is not a save
             //being triggered by the DCMenu (shortcut bar) then the request is coming from a dashlet or subpanel close icon and there is no
             //need to process user invitees, just save the current values.
             $focus->save(true);
         } else {
             ///////////////////////////////////////////////////////////////////////////
             ////	REMOVE INVITEE RELATIONSHIPS
             if (!empty($_POST['user_invitees'])) {
                 $userInvitees = explode(',', trim($_POST['user_invitees'], ','));
             } else {
                 $userInvitees = array();
             }
             // Calculate which users to flag as deleted and which to add
             $deleteUsers = array();
             $focus->load_relationship('users');
             // Get all users for the meeting
             $q = 'SELECT mu.user_id, mu.accept_status FROM meetings_users mu WHERE mu.meeting_id = \'' . $focus->id . '\'';
             $r = $focus->db->query($q);
             $acceptStatusUsers = array();
             while ($a = $focus->db->fetchByAssoc($r)) {
                 if (!in_array($a['user_id'], $userInvitees)) {
                     $deleteUsers[$a['user_id']] = $a['user_id'];
                 } else {
                     $acceptStatusUsers[$a['user_id']] = $a['accept_status'];
                 }
             }
             if (count($deleteUsers) > 0) {
                 $sql = '';
                 foreach ($deleteUsers as $u) {
                     $sql .= ",'" . $u . "'";
                 }
                 $sql = substr($sql, 1);
                 // We could run a delete SQL statement here, but will just mark as deleted instead
                 $sql = "UPDATE meetings_users set deleted = 1 where user_id in ({$sql}) AND meeting_id = '" . $focus->id . "'";
                 $focus->db->query($sql);
             }
             // Get all contacts for the meeting
             if (!empty($_POST['contact_invitees'])) {
                 $contactInvitees = explode(',', trim($_POST['contact_invitees'], ','));
             } else {
                 $contactInvitees = array();
             }
             $deleteContacts = array();
             $focus->load_relationship('contacts');
             $q = 'SELECT mu.contact_id, mu.accept_status FROM meetings_contacts mu WHERE mu.meeting_id = \'' . $focus->id . '\'';
             $r = $focus->db->query($q);
             $acceptStatusContacts = array();
             while ($a = $focus->db->fetchByAssoc($r)) {
                 if (!in_array($a['contact_id'], $contactInvitees)) {
                     $deleteContacts[$a['contact_id']] = $a['contact_id'];
                 } else {
                     $acceptStatusContacts[$a['contact_id']] = $a['accept_status'];
                 }
             }
             if (count($deleteContacts) > 0) {
                 $sql = '';
                 foreach ($deleteContacts as $u) {
                     $sql .= ",'" . $u . "'";
                 }
                 $sql = substr($sql, 1);
                 // We could run a delete SQL statement here, but will just mark as deleted instead
                 $sql = "UPDATE meetings_contacts set deleted = 1 where contact_id in ({$sql}) AND meeting_id = '" . $focus->id . "'";
                 $focus->db->query($sql);
             }
             if (!empty($_POST['lead_invitees'])) {
                 $leadInvitees = explode(',', trim($_POST['lead_invitees'], ','));
             } else {
                 $leadInvitees = array();
             }
             $deleteLeads = array();
             $focus->load_relationship('leads');
             $q = 'SELECT mu.lead_id, mu.accept_status FROM meetings_leads mu WHERE mu.meeting_id = \'' . $focus->id . '\'';
             $r = $focus->db->query($q);
             $acceptStatusLeads = array();
             while ($a = $focus->db->fetchByAssoc($r)) {
                 if (!in_array($a['lead_id'], $leadInvitees)) {
                     $deleteLeads[$a['lead_id']] = $a['lead_id'];
                 } else {
                     $acceptStatusLeads[$a['lead_id']] = $a['accept_status'];
                 }
             }
             if (count($deleteLeads) > 0) {
                 $sql = '';
                 foreach ($deleteLeads as $u) {
                     $sql .= ",'" . $u . "'";
                 }
                 $sql = substr($sql, 1);
                 // We could run a delete SQL statement here, but will just mark as deleted instead
                 $sql = "UPDATE meetings_leads set deleted = 1 where lead_id in ({$sql}) AND meeting_id = '" . $focus->id . "'";
                 $focus->db->query($sql);
             }
             ////	END REMOVE
             ///////////////////////////////////////////////////////////////////////////
             ///////////////////////////////////////////////////////////////////////////
             ////	REBUILD INVITEE RELATIONSHIPS
             $focus->users_arr = array();
             $focus->users_arr = $userInvitees;
             $focus->contacts_arr = array();
             $focus->contacts_arr = $contactInvitees;
             $focus->leads_arr = array();
             $focus->leads_arr = $leadInvitees;
             if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Contacts') {
                 $focus->contacts_arr[] = $_POST['parent_id'];
             }
             if (!empty($_POST['parent_id']) && $_POST['parent_type'] == 'Leads') {
                 $focus->leads_arr[] = $_POST['parent_id'];
             }
             // Call the Meeting module's save function to handle saving other fields besides
             // the users and contacts relationships
             $focus->update_vcal = false;
             // Bug #49195 : don't update vcal b/s related users aren't saved yet, create vcal cache below
             $focus->save(true);
             $return_id = $focus->id;
             if (empty($return_id)) {
                 //this is to handle the situation where the save fails, most likely because of a failure
                 //in the external api. bug: 42200
                 $_REQUEST['action'] = 'EditView';
                 $_REQUEST['return_action'] = 'EditView';
                 handleRedirect('', 'Meetings');
             }
             // Process users
             $existing_users = array();
             if (!empty($_POST['existing_invitees'])) {
                 $existing_users = explode(",", trim($_POST['existing_invitees'], ','));
             }
             foreach ($focus->users_arr as $user_id) {
                 if (empty($user_id) || isset($existing_users[$user_id]) || isset($deleteUsers[$user_id])) {
                     continue;
                 }
                 if (!isset($acceptStatusUsers[$user_id])) {
                     $focus->users->add($user_id);
                 } else {
                     if (!$focus->date_changed) {
                         // update query to preserve accept_status
                         $qU = 'UPDATE meetings_users SET deleted = 0, accept_status = \'' . $acceptStatusUsers[$user_id] . '\' ';
                         $qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
                         $qU .= 'AND user_id = \'' . $user_id . '\'';
                         $focus->db->query($qU);
                     }
                 }
             }
             // Process contacts
             $existing_contacts = array();
             if (!empty($_POST['existing_contact_invitees'])) {
                 $existing_contacts = explode(",", trim($_POST['existing_contact_invitees'], ','));
             }
             foreach ($focus->contacts_arr as $contact_id) {
                 if (empty($contact_id) || isset($existing_contacts[$contact_id]) || isset($deleteContacts[$contact_id])) {
                     continue;
                 }
                 if (!isset($acceptStatusContacts[$contact_id])) {
                     $focus->contacts->add($contact_id);
                 } else {
                     if (!$focus->date_changed) {
                         // update query to preserve accept_status
                         $qU = 'UPDATE meetings_contacts SET deleted = 0, accept_status = \'' . $acceptStatusContacts[$contact_id] . '\' ';
                         $qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
                         $qU .= 'AND contact_id = \'' . $contact_id . '\'';
                         $focus->db->query($qU);
                     }
                 }
             }
             // Process leads
             $existing_leads = array();
             if (!empty($_POST['existing_lead_invitees'])) {
                 $existing_leads = explode(",", trim($_POST['existing_lead_invitees'], ','));
             }
             foreach ($focus->leads_arr as $lead_id) {
                 if (empty($lead_id) || isset($existing_leads[$lead_id]) || isset($deleteLeads[$lead_id])) {
                     continue;
                 }
                 if (!isset($acceptStatusLeads[$lead_id])) {
                     $focus->leads->add($lead_id);
                 } else {
                     if (!$focus->date_changed) {
                         // update query to preserve accept_status
                         $qU = 'UPDATE meetings_leads SET deleted = 0, accept_status = \'' . $acceptStatusLeads[$lead_id] . '\' ';
                         $qU .= 'WHERE meeting_id = \'' . $focus->id . '\' ';
                         $qU .= 'AND lead_id = \'' . $lead_id . '\'';
                         $focus->db->query($qU);
                     }
                 }
             }
             // Bug #49195 : update vcal
             vCal::cache_sugar_vcal($current_user);
             // CCL - Comment out call to set $current_user as invitee
             // set organizer to auto-accept
             if ($focus->assigned_user_id == $current_user->id && $newBean) {
                 $focus->set_accept_status($current_user, 'accept');
             }
             ////	END REBUILD INVITEE RELATIONSHIPS
             ///////////////////////////////////////////////////////////////////////////
         }
     }
     if (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Home') {
         header("Location: index.php?module=Home&action=index");
     } else {
         if ($redirect) {
             handleRedirect($return_id, 'Meetings');
         } else {
             return $focus;
         }
     }
 }
コード例 #17
0
 /**
  * offers the vcal/ical functonality
  * 
  * @todo Not yet working
  *
  * @author Lybegard Karl-Olof
  * @since 0.9
  */
 function vcal()
 {
     $mainframe =& JFactory::getApplication();
     $task = JRequest::getWord('task');
     $id = JRequest::getInt('id');
     $user_offset = $mainframe->getCfg('offset_user');
     //get Data from model
     $model =& $this->getModel('Details', 'RedEventModel');
     $model->setId((int) $id);
     $row = $model->getDetails();
     $Start = mktime(strftime('%H', strtotime($row->times)), strftime('%M', strtotime($row->times)), strftime('%S', strtotime($row->times)), strftime('%m', strtotime($row->dates)), strftime('%d', strtotime($row->dates)), strftime('%Y', strtotime($row->dates)), 0);
     $End = mktime(strftime('%H', strtotime($row->endtimes)), strftime('%M', strtotime($row->endtimes)), strftime('%S', strtotime($row->endtimes)), strftime('%m', strtotime($row->enddates)), strftime('%d', strtotime($row->enddates)), strftime('%Y', strtotime($row->enddates)), 0);
     require_once JPATH_COMPONENT_SITE . DS . 'classes' . DS . 'vcal.class.php';
     $v = new vCal();
     $v->setTimeZone($user_offset);
     $v->setSummary($row->venue . '-' . $row->catname . '-' . $row->full_title);
     $v->setDescription($row->datdescription);
     $v->setStartDate($Start);
     $v->setEndDate($End);
     $v->setLocation($row->street . ', ' . $row->plz . ', ' . $row->city . ', ' . $row->country);
     $v->setFilename((int) $row->did);
     if ($task == 'vcal') {
         $v->generateHTMLvCal();
     } else {
         $v->generateHTMLiCal();
     }
 }
コード例 #18
0
 private function processCat($cat)
 {
     $blocksize = 10;
     $db = JFactory::getDBO();
     $query = "SELECT ev.*, cc.name AS category, " . "\n UNIX_TIMESTAMP(ev.publish_up) AS dtstart ," . "\n UNIX_TIMESTAMP(ev.publish_down) AS dtend " . "\n FROM  #__events AS ev" . "\n LEFT JOIN #__categories AS cc ON  ev.catid = cc.id" . "\n WHERE cc.id = {$cat->id}" . "\n AND migrated = 0" . "\n LIMIT {$blocksize}";
     $db->setQuery($query);
     $detevents = null;
     $detevents = $db->loadObjectList();
     if (count($detevents) == 0) {
         return 0;
     }
     $showBR = intval(JRequest::getVar('showBR', '0'));
     // get vCal with HTML encoded descriptions
     global $cal;
     $cal = new vCal("", true);
     if (count($detevents) > 0) {
         foreach ($detevents as $event) {
             $cal->addEvent($event);
             // mark as migrated
             $query = "UPDATE  #__events set migrated=1 WHERE id=" . $event->id;
             $db->setQuery($query);
             $db->query();
         }
         $detevents = null;
         global $output;
         $output = $cal->getVCal();
         $cal = null;
         if ($showBR) {
             echo "Processing cat {$cat->title}<br/>";
             echo $output;
             echo "<hr/>";
         }
         // Map them to the new cat id
         $catid = $cat->newid;
         $access = $cat->access;
         $state = $cat->published;
         // find the default icsfile - if none then create a new one
         $sql = "SELECT * FROM #__jevents_icsfile WHERE icaltype=2 AND isdefault=1";
         $db->setQuery($sql);
         $ics = $db->loadObject();
         if (!$ics || is_null($ics)) {
             $icsid = 0;
             // new
             $icsLabel = "{$cat->title} (imp)";
         } else {
             $icsid = $ics->ics_id;
             $icsLabel = $ics->label;
             if ($ics->catid == 0) {
                 $sql = "UPDATE #__jevents_icsfile SET catid=" . $cat->newid . " WHERE ics_id=" . $icsid;
                 $db->setQuery($sql);
                 $db->query();
             }
         }
         $icsFile = iCalICSFile::newICSFileFromString($output, $icsid, $catid, $access, $state, $icsLabel);
         // DO NOT CLEAN OUT EXISTING EVENTS
         $icsFileid = $icsFile->store($catid, false);
         $icsFile = null;
     }
     $query = "SELECT count(ev.id)" . "\n FROM  #__events AS ev" . "\n LEFT JOIN #__categories AS cc ON  ev.catid = cc.id" . "\n WHERE cc.id = {$cat->id}" . "\n AND migrated = 0";
     $db->setQuery($query);
     $detevents = null;
     $eventsleft = $db->loadResult();
     return $eventsleft;
 }
コード例 #19
0
 /**
  * Delete recurring activities and their invitee relationships
  * @param SugarBean $bean
  */
 static function markRepeatDeleted(SugarBean $bean)
 {
     // we don't use mark_deleted method here because it runs very slowly
     global $db;
     $date_modified = $GLOBALS['timedate']->nowDb();
     if (!empty($GLOBALS['current_user'])) {
         $modified_user_id = $GLOBALS['current_user']->id;
     } else {
         $modified_user_id = 1;
     }
     $lower_name = strtolower($bean->object_name);
     $qu = "SELECT id FROM {$bean->table_name} WHERE repeat_parent_id = '{$bean->id}' AND deleted = 0";
     $re = $db->query($qu);
     while ($ro = $db->fetchByAssoc($re)) {
         $id = $ro['id'];
         $date_modified = $GLOBALS['timedate']->nowDb();
         $db->query("UPDATE {$bean->table_name} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . ", modified_user_id = '{$modified_user_id}' WHERE id = '{$id}'");
         $db->query("UPDATE {$bean->rel_users_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
         $db->query("UPDATE {$bean->rel_contacts_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
         $db->query("UPDATE {$bean->rel_leads_table} SET deleted = 1, date_modified = " . $db->convert($db->quoted($date_modified), 'datetime') . " WHERE {$lower_name}_id = '{$id}'");
     }
     vCal::cache_sugar_vcal($GLOBALS['current_user']);
 }
コード例 #20
0
 /**
  * Deletes the parent and associated child events in a series.
  * @param $api
  * @param $args
  * @return array
  */
 public function deleteRecordAndRecurrences($api, $args)
 {
     $bean = $this->loadBean($api, $args, 'delete');
     if (!empty($bean->repeat_parent_id)) {
         $parentArgs = array_merge($args, array('record' => $bean->repeat_parent_id));
         $bean = $this->loadBean($api, $parentArgs, 'delete');
     }
     // Turn off The Cache Updates while deleting the multiple recurrences.
     // The current Cache Enabled status is returned so it can be appropriately
     // restored when all the recurrences have been deleted.
     $cacheEnabled = vCal::setCacheUpdateEnabled(false);
     $this->deleteRecurrences($bean);
     $bean->mark_deleted($bean->id);
     // Restore the Cache Enabled status to its previous state
     vCal::setCacheUpdateEnabled($cacheEnabled);
     $this->getCalendarEvents()->rebuildFreeBusyCache($GLOBALS['current_user']);
     return array('id' => $bean->id);
 }
コード例 #21
0
ファイル: Call.php プロジェクト: eggsurplus/SuiteCRM
  function set_accept_status(&$user,$status)
  {
    if ( $user->object_name == 'User')
    {
      $relate_values = array('user_id'=>$user->id,'call_id'=>$this->id);
      $data_values = array('accept_status'=>$status);
      $this->set_relationship($this->rel_users_table, $relate_values, true, true,$data_values);
      global $current_user;

      if ( $this->update_vcal )
      {
        vCal::cache_sugar_vcal($user);
      }
    }
    else if ( $user->object_name == 'Contact')
    {
      $relate_values = array('contact_id'=>$user->id,'call_id'=>$this->id);
      $data_values = array('accept_status'=>$status);
      $this->set_relationship($this->rel_contacts_table, $relate_values, true, true,$data_values);
    }
    else if ( $user->object_name == 'Lead')
    {
      $relate_values = array('lead_id'=>$user->id,'call_id'=>$this->id);
      $data_values = array('accept_status'=>$status);
      $this->set_relationship($this->rel_leads_table, $relate_values, true, true,$data_values);
    }
  }
コード例 #22
0
ファイル: iCal.php プロジェクト: sunmo/snowlotus
 /**
  * Constructor for the iCal class.
  */
 public function __construct()
 {
     parent::vCal();
 }
コード例 #23
0
    $query = "SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists ";
    $query .= " left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id";
    $query .= " where email_marketing.campaign_id='{$record}'";
    $query .= " and email_marketing_prospect_lists.prospect_list_id='{$linked_id}'";
    $result = $focus->db->query($query);
    while (($row = $focus->db->fetchByAssoc($result)) != null) {
        $del_query = " update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=" . db_convert("'" . gmdate($GLOBALS['timedate']->get_db_date_time_format(), time()) . "'", 'datetime');
        $del_query .= " WHERE  email_marketing_prospect_lists.id='{$row['id']}'";
        $focus->db->query($del_query);
    }
    $focus->db->query($query);
}
if ($bean_name == "Meeting") {
    $focus->retrieve($record);
    $user = new User();
    $user->retrieve($linked_id);
    if (!empty($user->id)) {
        //make sure that record exists. we may have a contact on our hands.
        if ($focus->update_vcal) {
            vCal::cache_sugar_vcal($user);
        }
    }
}
if (!empty($_REQUEST['return_url'])) {
    $_REQUEST['return_url'] = urldecode($_REQUEST['return_url']);
}
$GLOBALS['log']->debug("deleted relationship: bean: {$bean_name}, linked_field: {$linked_field}, linked_id:{$linked_id}");
if (empty($_REQUEST['refresh_page'])) {
    handleRedirect();
}
exit;
コード例 #24
0
 function set_accept_status(&$user, $status)
 {
     if ($user->object_name == 'User') {
         $relate_values = array('user_id' => $user->id, 'meeting_id' => $this->id);
         $data_values = array('accept_status' => $status);
         $this->set_relationship($this->rel_users_table, $relate_values, true, true, $data_values);
         global $current_user;
         require_once 'modules/vCals/vCal.php';
         if ($this->update_vcal) {
             vCal::cache_sugar_vcal($user);
         }
     } else {
         if ($user->object_name == 'Contact') {
             $relate_values = array('contact_id' => $user->id, 'meeting_id' => $this->id);
             $data_values = array('accept_status' => $status);
             $this->set_relationship($this->rel_contacts_table, $relate_values, true, true, $data_values);
         }
     }
 }