public function getSchedule($scheduleId) { $schedule = Schedule::find_by_id($scheduleId); if (!$schedule instanceof Schedule) { throw new Exception('Invalid schedule: ' . $scheduleId); } return $schedule; }
/** * Add tastsupport find task */ public function getTaskById($id) { return Schedule::find_by_id($id); }
public function getCloseSchedule($id) { $schedule = Schedule::find_by_id($id); //var_dump($_POST['status']); //Change in schedule should result in change //in ticket and activation call status /* * checks if $activityShed is a ticket * if not then it is an activation * call change the status corresponding to * schedule status for each condition * */ if ($_REQUEST['status'] == "Open") { // Condition to check if schedule is Open $schedule->status = "Open"; $activityShed = Ticket::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = 'Open'; $activityShed->datemodified = date("Y-m-d H:i:s"); $activityShed->update(); } else { $activityShed = Activation::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = "Open"; $activityShed->created_at = date("Y-m-d H:i:s"); $activityShed->update(); } } $schedule->update(); return true; } elseif ($_REQUEST['status'] == "Closed") { // Condition to check if schedule is closed $schedule->status = "Closed"; $activityShed = Ticket::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = 'Closed'; $activityShed->datemodified = date("Y-m-d H:i:s"); $activityShed->update(); } else { $activityShed = Activation::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = "Closed"; $activityShed->created_at = date("Y-m-d H:i:s"); $activityShed->update(); } } $schedule->update(); return true; } elseif ($_REQUEST['status'] == "In Progress") { // Condition to check if schedule is in progress $schedule->status = "In Progress"; $activityShed = Ticket::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = 'Admin Reply'; // admin reply stands for response for administrator for response to ticket or engineer assigned $activityShed->datemodified = date("Y-m-d H:i:s"); } else { $activityShed = Activation::find_by_id($schedule->ticket_id); if ($activityShed) { $activityShed->status = "In Progress"; $activityShed->created_at = date("Y-m-d H:i:s"); $activityShed->update(); } } $schedule->update(); return true; } else { return false; } //echo $schedule->update(); }
public function acceptTask() { global $session; $newWorkSheet = new Worksheet(); $ticket = Schedule::find_by_id($_POST['taskid']); if (isset($_POST['taskid'])) { $newWorkSheet->cse_emp_id = $_SESSION['emp_ident']; $newWorkSheet->formid = $_POST['taskid']; $newWorkSheet->prod_id = $ticket->prod_id; $newWorkSheet->client_id = $ticket->client_id; //$newWorkSheet->contact_person = $ticket->contact_name; $newWorkSheet->problem = $ticket->issue; $newWorkSheet->sheet_date = date("Y:m:d H:i:s"); $newWorkSheet->datecreated = date("Y:m:d H:i:s"); $newWorkSheet->status = "Open"; $ticket->status = "In Progress"; $ticket->datemodified = date("Y:m:d H:i:s"); if ($newWorkSheet->create()) { $ticket->update(); return 1; } else { return 2; } } else { return 3; } }