Skip to content

Commit

Permalink
* Fixed issues with incident_alert_status not being set in Edit Repor…
Browse files Browse the repository at this point in the history
…t screen

* closed #834
  • Loading branch information
David Kobia committed Aug 18, 2010
1 parent 712d005 commit 6576ffc
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion application/controllers/admin/reports.php
Expand Up @@ -95,9 +95,14 @@ function index($page = 1)
$update->incident_active = '1';

// Tag this as a report that needs to be sent out as an alert
$update->incident_alert_status = '1';
if ($update->incident_alert_status != '2')
{ // 2 = report that has had an alert sent
$update->incident_alert_status = '1';
}

$update->save();


$verify = new Verify_Model();
$verify->incident_id = $item;
$verify->verified_status = '1';
Expand All @@ -115,6 +120,13 @@ function index($page = 1)
$update = new Incident_Model($item);
if ($update->loaded == true) {
$update->incident_active = '0';

// If Alert hasn't been sent yet, disable it
if ($update->incident_alert_status == '1')
{
$update->incident_alert_status = '0';
}

$update->save();

$verify = new Verify_Model();
Expand Down Expand Up @@ -575,6 +587,7 @@ function edit( $id = false, $saved = false )
{
$incident->incident_dateadd = date("Y-m-d H:i:s",time());
}

// Is this an Email, SMS, Twitter submitted report?
//XXX: We may get rid of incident_mode altogether... ???
//$_POST
Expand Down Expand Up @@ -605,6 +618,21 @@ function edit( $id = false, $saved = false )
//Save
$incident->save();

// Tag this as a report that needs to be sent out as an alert
if ($incident->incident_active == '1' AND
$incident->incident_alert_status != '2')
{ // 2 = report that has had an alert sent
$incident->incident_alert_status = '1';
$incident->save();
}
// Remove alert if report is unactivated and alert hasn't yet been sent
if ($incident->incident_active == '0' AND
$incident->incident_alert_status == '1')
{
$incident->incident_alert_status = '0';
$incident->save();
}

// Record Approval/Verification Action
$verify = new Verify_Model();
$verify->incident_id = $incident->id;
Expand Down

0 comments on commit 6576ffc

Please sign in to comment.