require_once 'modules/Calendar/DateTimeUtil.php'; global $timedate; $callBean = new Call(); $callQuery = "SELECT * FROM calls where calls.status != 'Held' and calls.deleted=0"; //$callQuery = "SELECT * FROM calls where calls.name like '1' and calls.deleted=0"; $result = $callBean->db->query($callQuery, true, ""); $row = $callBean->db->fetchByAssoc($result); while ($row != null) { $date_time_start = DateTimeUtil::get_time_start($row['date_start']); $date_time_end = DateTimeUtil::get_time_end($date_time_start, $row['duration_hours'], $row['duration_minutes']); $date_end = gmdate("Y-m-d", $date_time_end->ts); $updateQuery = "UPDATE calls set calls.date_end='{$date_end}' where calls.id='{$row['id']}'"; $call = new Call(); $call->db->query($updateQuery); $row = $callBean->db->fetchByAssoc($result); } $meetingBean = new Meeting(); $meetingQuery = "SELECT * FROM meetings where meetings.status != 'Held' and meetings.deleted=0"; //$meetingQuery = "SELECT * FROM meetings where meetings.name like '1' and meetings.deleted=0"; $result = $meetingBean->db->query($meetingQuery, true, ""); $row = $meetingBean->db->fetchByAssoc($result); while ($row != null) { $date_time_start = DateTimeUtil::get_time_start($row['date_start']); $date_time_end = DateTimeUtil::get_time_end($date_time_start, $row['duration_hours'], $row['duration_minutes']); $date_end = gmdate("Y-m-d", $date_time_end->ts); $updateQuery = "UPDATE meetings set meetings.date_end='{$date_end}' where meetings.id='{$row['id']}'"; $call = new Call(); $call->db->query($updateQuery); $row = $callBean->db->fetchByAssoc($result); } echo $mod_strings['LBL_DIAGNOSTIC_DONE'];
function CalendarActivity($args) { // if we've passed in an array, then this is a free/busy slot // and does not have a sugarbean associated to it global $DO_USER_TIME_OFFSET; if (is_array($args)) { $this->start_time = $args[0]; $this->end_time = $args[1]; $this->sugar_bean = null; return; } // else do regular constructor.. $sugar_bean = $args; global $timedate; $this->sugar_bean = $sugar_bean; if ($sugar_bean->object_name == 'Task') { $newdate = $timedate->merge_date_time($this->sugar_bean->date_due, $this->sugar_bean->time_due); $tempdate = $timedate->to_db_date($newdate, $DO_USER_TIME_OFFSET); if ($newdate != $tempdate) { $this->sugar_bean->date_due = $tempdate; } $temptime = $timedate->to_db_time($newdate, $DO_USER_TIME_OFFSET); if ($newdate != $temptime) { $this->sugar_bean->time_due = $temptime; } $this->start_time = DateTimeUtil::get_time_start($this->sugar_bean->date_due, $this->sugar_bean->time_due); if (empty($this->start_time)) { return null; } $this->end_time = $this->start_time; } else { // Convert it back to database time so we can properly manage it for getting the proper start and end dates $dbDate = $timedate->to_db($this->sugar_bean->date_start); $this->start_time = DateTimeUtil::get_time_start($dbDate); $this->end_time = DateTimeUtil::get_time_end($this->start_time, $this->sugar_bean->duration_hours, $this->sugar_bean->duration_minutes); } }
function save($check_notify = FALSE) { require_once 'modules/Calendar/DateTimeUtil.php'; global $timedate; global $current_user; global $disable_date_format; if (isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) { $date_time_start = DateTimeUtil::get_time_start($this->date_start); $date_time_end = DateTimeUtil::get_time_end($date_time_start, $this->duration_hours, $this->duration_minutes); $this->date_end = gmdate("Y-m-d", $date_time_end->ts); } $check_notify = !empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1' ? true : false; if (empty($_REQUEST['send_invites'])) { if (!empty($this->id)) { $old_record = new Meeting(); $old_record->retrieve($this->id); $old_assigned_user_id = $old_record->assigned_user_id; } if (empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id'] || isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) { $this->special_notification = true; $check_notify = true; if (isset($_REQUEST['assigned_user_name'])) { $this->new_assigned_user_name = $_REQUEST['assigned_user_name']; } } } /*nsingh 7/3/08 commenting out as bug #20814 is invalid if($current_user->getPreference('reminder_time')!= -1 && isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0 && $_POST['reminder_time']==-1){ $this->reminder_checked = '1'; $this->reminder_time = $current_user->getPreference('reminder_time'); }*/ if (empty($this->status)) { $mod_strings = return_module_language($GLOBALS['current_language'], $this->module_dir); $this->status = $mod_strings['LBL_DEFAULT_STATUS']; } $return_id = parent::save($check_notify); if ($this->update_vcal) { vCal::cache_sugar_vcal($current_user); } return $return_id; }
function CalendarActivity($args) { // if we've passed in an array, then this is a free/busy slot // and does not have a sugarbean associated to it global $DO_USER_TIME_OFFSET; if (is_array($args)) { $this->start_time = $args[0]; $this->end_time = $args[1]; $this->sugar_bean = null; return; } // else do regular constructor.. $sugar_bean = $args; global $timedate; $this->sugar_bean = $sugar_bean; if ($sugar_bean->object_name == 'Task') { $newdate = $timedate->merge_date_time($this->sugar_bean->date_due, $this->sugar_bean->time_due); $tempdate = $timedate->to_db_date($newdate, $DO_USER_TIME_OFFSET); if ($newdate != $tempdate) { $this->sugar_bean->date_due = $tempdate; } $temptime = $timedate->to_db_time($newdate, $DO_USER_TIME_OFFSET); if ($newdate != $temptime) { $this->sugar_bean->time_due = $temptime; } $this->start_time = DateTimeUtil::get_time_start($this->sugar_bean->date_due, $this->sugar_bean->time_due); if (empty($this->start_time)) { return null; } $this->end_time = $this->start_time; } else { $newdate = $timedate->merge_date_time($this->sugar_bean->date_start, $this->sugar_bean->time_start); //Modify by jchi 6/27/2008 1515pm china time , bug 20626. $temptime = $timedate->to_db_time($newdate, $DO_USER_TIME_OFFSET); if ($newdate != $temptime) { $this->sugar_bean->time_start = $temptime; } $this->start_time = DateTimeUtil::get_time_start($timedate->to_db_date($this->sugar_bean->date_start, $DO_USER_TIME_OFFSET), $this->sugar_bean->time_start); $this->end_time = DateTimeUtil::get_time_end($this->start_time, $this->sugar_bean->duration_hours, $this->sugar_bean->duration_minutes); } }
function save($check_notify = FALSE) { global $timedate; if (isset($this->date_start) && isset($this->time_start) && isset($this->duration_hours) && isset($this->duration_minutes)) { $date_time_start = DateTimeUtil::get_time_start($timedate->to_db_date($this->date_start, false), $this->time_start . ":00"); $date_time_end = DateTimeUtil::get_time_end($date_time_start, $this->duration_hours, $this->duration_minutes); $this->date_end = $timedate->to_display_date("{$date_time_end->year}-{$date_time_end->month}-{$date_time_end->day}"); } if (!empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1') { $check_notify = true; } else { $check_notify = false; } parent::save($check_notify); global $current_user; require_once 'modules/vCals/vCal.php'; if ($this->update_vcal) { vCal::cache_sugar_vcal($current_user); } }