Skip to content

Commit

Permalink
Fix change status after refused solution
Browse files Browse the repository at this point in the history
fixes #15700
  • Loading branch information
Lainow authored Nov 27, 2023
1 parent 760d96f commit 2a76ece
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/Change.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public function canViewItem()
))))));
}


/**
* Is the current user have right to create the current change ?
*
Expand Down Expand Up @@ -673,7 +672,7 @@ public static function getProcessStatusArray()

public static function getReopenableStatusArray()
{
return self::getClosedStatusArray();
return array_merge(self::getClosedStatusArray(), [self::SOLVED]);
}

public function getRights($interface = 'central')
Expand Down
2 changes: 1 addition & 1 deletion src/Features/ParentStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function updateParentStatus(CommonITILObject $parentitem, array $input):
$input['_status'] = CommonITILObject::PLANNED;
}

//change ITILObject status only if imput change
//change ITILObject status only if input change
if (
!$reopened
&& $input['_status'] != $parentitem->fields['status']
Expand Down
30 changes: 30 additions & 0 deletions tests/functional/Change.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,34 @@ public function testInitialStatus()
// Even when automatically assigning a user, the initial status should be set to New
$this->integer($change->fields['status'])->isIdenticalTo(\CommonITILObject::INCOMING);
}

public function testStatusWhenSolutionIsRefused()
{
$this->login();
$change = new \Change();
$changes_id = $change->add([
'name' => "test initial status",
'content' => "test initial status",
'entities_id' => getItemByTypeName('Entity', '_test_root_entity', true),
'_users_id_assign' => getItemByTypeName('User', TU_USER, true),
'status' => \CommonITILObject::SOLVED,
]);
$this->integer($changes_id)->isGreaterThan(0);

$followup = new \ITILFollowup();
$followup_id = $followup->add([
'itemtype' => 'Change',
'items_id' => $changes_id,
'users_id' => getItemByTypeName('User', TU_USER, true),
'users_id_editor' => getItemByTypeName('User', TU_USER, true),
'content' => 'Test followup content',
'requesttypes_id' => 1,
'timeline_position' => \CommonITILObject::TIMELINE_LEFT,
'add_reopen' => ''
]);
$this->integer($followup_id)->isGreaterThan(0);

$item = $change->getById($changes_id);
$this->integer($item->fields['status'])->isIdenticalTo(\CommonITILObject::INCOMING);
}
}

0 comments on commit 2a76ece

Please sign in to comment.