function reschedule_history($focus, $field, $value, $view) { global $app_list_strings; if ($view == 'DetailView') { $html = ''; $html .= '<ul id="history_list">'; $query = "SELECT calls_reschedule.id FROM calls_reschedule JOIN users ON calls_reschedule.modified_user_id = users.id WHERE call_id='" . $focus->id . "' ORDER BY calls_reschedule.date_entered DESC"; $result = $focus->db->query($query); $reschedule = new Calls_Reschedule(); while ($row = $focus->db->fetchByAssoc($result)) { $reschedule->retrieve($row['id']); $html .= '<li>' . $app_list_strings["call_reschedule_dom"][$reschedule->reason] . ' - ' . $reschedule->date_entered . ' by ' . $reschedule->created_by_name . '</li>'; } $html .= '</ul>'; return $html; } }
} if (isset($ampm) && !empty($ampm)) { $time_start = $timedate->merge_time_meridiem($time_start, $timedate->get_time_format(), $ampm); } if (isset($time_start) && strlen($date) == 10) { $date_start = $date . ' ' . $time_start; } $call->retrieve($id); $call->date_start = $date_start; //set new the start date $call->save(); //save the new start date //get the duration of the call $hours = $call->duration_hours; $mins = $call->duration_minutes; //get the new start date directly from the database to avoid sugar changing the format to users setting $query = 'SELECT date_start FROM calls WHERE id="' . $id . '"'; $result = $call->db->getOne($query); //add on the duration of call and save the end date/time $Date = strtotime($result); $newDate = strtotime('+' . $hours . ' hours', $Date); $newDate = strtotime('+' . $mins . ' minutes', $newDate); $newDate = date("Y-m-d H:i:s", $newDate); $call->date_end = $newDate; //save call and call attempt history $reschedule = new Calls_Reschedule(); $reschedule->reason = $reason; $reschedule->call_id = $id; $call->save(); $reschedule->save(); //save call attempt history line