Backdate IncidentStatus when an Incident is created retrospectively
This commit is contained in:
@@ -25,7 +25,7 @@ class StatusBoard_Incident extends StatusBoard_DatabaseObject {
|
|||||||
$new_incident->actual_end_time = null;
|
$new_incident->actual_end_time = null;
|
||||||
|
|
||||||
$new_incident->create();
|
$new_incident->create();
|
||||||
$new_incident->changeStatus($status, 'Initial Classification');
|
$new_incident->changeStatus($status, 'Initial Classification', $start_time);
|
||||||
|
|
||||||
return $new_incident;
|
return $new_incident;
|
||||||
}
|
}
|
||||||
@@ -159,12 +159,12 @@ class StatusBoard_Incident extends StatusBoard_DatabaseObject {
|
|||||||
return $this->statuses;
|
return $this->statuses;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changeStatus($status, $description) {
|
public function changeStatus($status, $description, $start_time = null) {
|
||||||
if ($this->statuses === null) {
|
if ($this->statuses === null) {
|
||||||
$this->statuses = StatusBoard_IncidentStatus::allFor('incident', $this->id);
|
$this->statuses = StatusBoard_IncidentStatus::allFor('incident', $this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_status = StatusBoard_IncidentStatus::newForIncident($this, $status, $description);
|
$new_status = StatusBoard_IncidentStatus::newForIncident($this, $status, $description, $start_time);
|
||||||
$this->statuses[] = $new_status;
|
$this->statuses[] = $new_status;
|
||||||
|
|
||||||
return $new_status;
|
return $new_status;
|
||||||
|
|||||||
@@ -14,12 +14,16 @@ class StatusBoard_IncidentStatus extends StatusBoard_DatabaseObject {
|
|||||||
return static::all_for('incident', $incident->id);
|
return static::all_for('incident', $incident->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function newForIncident(StatusBoard_Incident $incident, $status, $description) {
|
public function newForIncident(StatusBoard_Incident $incident, $status, $description, $ctime = null) {
|
||||||
|
if ($ctime === null) {
|
||||||
|
$ctime = time();
|
||||||
|
}
|
||||||
|
|
||||||
$new_status = new self();
|
$new_status = new self();
|
||||||
$new_status->incident = $incident->id;
|
$new_status->incident = $incident->id;
|
||||||
$new_status->status = $status;
|
$new_status->status = $status;
|
||||||
$new_status->description = $description;
|
$new_status->description = $description;
|
||||||
$new_status->ctime = time();
|
$new_status->ctime = $ctime;
|
||||||
|
|
||||||
$new_status->create();
|
$new_status->create();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user