Skip to content

Commit

Permalink
fix automatic change os status - fixed #5301
Browse files Browse the repository at this point in the history
  • Loading branch information
yllen committed May 22, 2015
1 parent 2231097 commit 5154a63
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion inc/commonitilactor.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ function post_addItem() {
// Check object status and update it if needed
if (!isset($this->input['_from_object'])) {
if ($item->getFromDB($this->fields[static::getItilObjectForeignKey()])) {
if (($item->fields["status"] == CommonITILObject::INCOMING)
if (in_array($item->fields["status"], $item->getNewStatusArray())
&& in_array(CommonITILObject::ASSIGNED, array_keys($item->getAllStatusArray()))) {
$item->update(array('id' => $item->getID(),
'status' => CommonITILObject::ASSIGNED));
Expand Down
6 changes: 6 additions & 0 deletions inc/commonitilobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,13 @@ function pre_updateInDB() {
$this->oldvalues['status'] = $this->fields['status'];
$this->updates[] = 'status';
}

$this->fields['status'] = self::INCOMING;
// Don't change status if it's a new status allow
if (in_array($this->oldvalues['status'], $this->getNewStatusArray())) {
$this->fields['status'] = $this->oldvalues['status'];

}
}

if (in_array("status", $this->updates)
Expand Down

0 comments on commit 5154a63

Please sign in to comment.