} if ($act->sugar_bean->ACLAccess('Save')) { $newAct['editview'] = 1; } else { $newAct['editview'] = 0; } if (empty($beanA->id)) { $newAct['detailview'] = 0; $newAct['editview'] = 0; } $newAct['date_start'] = $act->sugar_bean->date_start; $date_unix = to_timestamp_from_uf($act->sugar_bean->date_start); if ($newAct['type'] == 'task') { $newAct['date_start'] = $act->sugar_bean->date_due; //$newAct['date_start'] = $timedate->swap_formats($newAct['date_start'],'Y-m-d H:i:s',$timedate->get_date_time_format()); $date_unix = to_timestamp_from_uf($newAct['date_start']); } $newAct['start'] = $date_unix; $newAct['time_start'] = timestamp_to_user_formated2($newAct['start'], $GLOBALS['timedate']->get_time_format()); if ($newAct['type'] == 'task') { $newAct['duration_hours'] = 0; $newAct['duration_minutes'] = 0; //$newAct['date_due'] = $act->sugar_bean->date_due; } else { $newAct['duration_hours'] = $act->sugar_bean->duration_hours; $newAct['duration_minutes'] = $act->sugar_bean->duration_minutes; } if (empty($newAct['duration_hours'])) { $newAct['duration_hours'] = 0; } if (empty($newAct['duration_minutes'])) {
$bean = new Meeting(); $type = 'meeting'; $table_name = 'meetings'; $jn = "meeting_id_c"; } $bean->retrieve($_REQUEST['record']); if (!$bean->ACLAccess('DetailView')) { $json_arr = array('succuss' => 'no'); echo json_encode($json_arr); die; } if ($bean->ACLAccess('Save')) { $editview = 1; } else { $editview = 0; } if ($r_id = $bean->id) { $bean->retrieve($r_id); if (!empty($bean->parent_type) && !empty($bean->parent_id)) { require_once $beanFiles[$beanList[$bean->parent_type]]; $par = new $beanList[$bean->parent_type](); $par->retrieve($bean->parent_id); } global $timedate; $start = to_timestamp_from_uf($bean->date_start); $json_arr = array('succuss' => 'yes', 'record_name' => html_entity_decode($bean->name, ENT_QUOTES), 'record' => $bean->id, 'type' => $type, 'assigned_user_id' => $bean->assigned_user_id, 'user_id' => '', 'user_name' => $bean->assigned_user_name, 'date_start' => $bean->date_start, 'start' => $start, 'duration_hours' => $bean->duration_hours, 'duration_minutes' => $bean->duration_minutes, 'reminder_time' => $bean->reminder_time, 'status' => $bean->status, 'time_start' => timestamp_to_user_formated2($start, $GLOBALS['timedate']->get_time_format()), 'direction' => $bean->direction, 'location' => $bean->location, 'description' => html_entity_decode($bean->description, ENT_QUOTES), 'parent_type' => $bean->parent_type, 'parent_name' => $par->name, 'parent_id' => $bean->parent_id, 'rec_id_c' => $bean->{$jn}, 'repeat_type_c' => $bean->repeat_type_c, 'repeat_interval_c' => $bean->repeat_interval_c, 'repeat_end_date_c' => $bean->repeat_end_date_c, 'repeat_days_c' => $bean->repeat_days_c, 'editview' => $editview); } else { $json_arr = array('succuss' => 'no'); } ob_clean(); echo json_encode($json_arr);
<?php $rtype = $_REQUEST['repeat_type_c']; $repeat_days = $_REQUEST['repeat_days_c']; $interval = $_REQUEST['repeat_interval_c']; $timezone = $GLOBALS['timedate']->getUserTimeZone(); global $timedate; $start_unix = to_timestamp_from_uf($_REQUEST['date_start']); $end_unix = to_timestamp($GLOBALS['timedate']->swap_formats($_REQUEST['repeat_end_date_c'], $GLOBALS['timedate']->get_date_format(), 'Y-m-d H:i:s')); $end_unix = $end_unix + 60 * 60 * 24 - 1; $start_day = date("w", $start_unix - date('Z', $start_unix)) + 1; $start_dayM = date("j", $start_unix - date('Z', $start_unix)); if ($rtype == 'Weekly' || $rtype == 'Monthly (day)') { $start_unix = $start_unix - 60 * 60 * 24 * ($start_day - 1); } remove_recurence($bean, $table_name, $jn, $bean->id); $ft = true; if (!empty($_REQUEST['repeat_type_c']) && !empty($_REQUEST['repeat_end_date_c'])) { if (empty($interval) && $interval == 0) { $interval = 1; } $cur_date = $start_unix; $i = 0; if ($rtype == 'Weekly' || $rtype == 'Monthly (day)') { $i--; } while ($cur_date <= $end_unix) { $i++; if ($rtype == 'Daily') { $step = 60 * 60 * 24; } else {