Skip to content
Snippets Groups Projects
Unverified Commit f3e7bbe5 authored by Peter Rotich's avatar Peter Rotich Committed by GitHub
Browse files

Merge pull request #5165 from protich/issue/5160

Clear Overdue Flag on Due Date Change
parents f3d4b284 8c76d704
Branches
Tags
No related merge requests found
...@@ -454,9 +454,9 @@ implements RestrictedAccess, Threadable, Searchable { ...@@ -454,9 +454,9 @@ implements RestrictedAccess, Threadable, Searchable {
} }
function updateEstDueDate($clearOverdue=true) { function updateEstDueDate($clearOverdue=true) {
$DueDate = $this->getEstDueDate();
$this->est_duedate = $this->getSLADueDate(); $this->est_duedate = $this->getSLADueDate();
// Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue. // Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
$DueDate = $this->getEstDueDate();
if ($this->isOverdue() if ($this->isOverdue()
&& $clearOverdue && $clearOverdue
&& (!$DueDate // Duedate + SLA cleared && (!$DueDate // Duedate + SLA cleared
...@@ -3306,22 +3306,14 @@ implements RestrictedAccess, Threadable, Searchable { ...@@ -3306,22 +3306,14 @@ implements RestrictedAccess, Threadable, Searchable {
$this->selectSLAId(); $this->selectSLAId();
} }
// Update estimated due date in database if (!$this->save())
$estimatedDueDate = $this->getEstDueDate(); return false;
$this->updateEstDueDate();
// Clear overdue flag if duedate or SLA changes and the ticket is no longer overdue.
if($this->isOverdue()
&& (!$estimatedDueDate //Duedate + SLA cleared
|| Misc::db2gmtime($estimatedDueDate) > Misc::gmtime() //New due date in the future.
)) {
$this->clearOverdue();
}
$this->updateEstDueDate();
Signal::send('model.updated', $this); Signal::send('model.updated', $this);
return $this->save();
}
return true;
}
function updateField($form, &$errors) { function updateField($form, &$errors) {
global $thisstaff, $cfg; global $thisstaff, $cfg;
...@@ -3397,11 +3389,10 @@ implements RestrictedAccess, Threadable, Searchable { ...@@ -3397,11 +3389,10 @@ implements RestrictedAccess, Threadable, Searchable {
$this->lastupdate = SqlFunction::NOW(); $this->lastupdate = SqlFunction::NOW();
$this->save();
if ($updateDuedate) if ($updateDuedate)
$this->updateEstDueDate(); $this->updateEstDueDate();
$this->save();
Signal::send('model.updated', $this); Signal::send('model.updated', $this);
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment