Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update ticket status when ticket task is de-scheduled #16895

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

RomainLvr
Copy link
Contributor

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets !32381

When a task is de-scheduled, the ticket status remains In progress (Scheduled) instead of being changed back to In progress (Assigned).

@RomainLvr RomainLvr self-assigned this Apr 5, 2024
@trasher
Copy link
Contributor

trasher commented Apr 5, 2024

Please add a test

@RomainLvr RomainLvr requested review from trasher and Rom1-B April 5, 2024 09:42
src/CommonITILTask.php Outdated Show resolved Hide resolved
@RomainLvr RomainLvr requested a review from orthagh April 12, 2024 06:14
Copy link
Contributor

@Rom1-B Rom1-B left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a function updateParentStatus, which you could use

src/Features/ParentStatus.php Outdated Show resolved Hide resolved
@cedric-anne cedric-anne changed the base branch from 10.0/bugfixes to main April 22, 2024 08:46
@cedric-anne
Copy link
Member

I change the target to main branch. This can be considered as a new feature and may have unexpected side effects.

@cedric-anne cedric-anne added this to the 11.0.0 milestone Apr 22, 2024
@cedric-anne cedric-anne force-pushed the fix/ticket-task-de-plan-status branch from a44093c to 937926a Compare June 4, 2024 09:47
@cedric-anne
Copy link
Member

@RomainLvr I rebased your branch to fix conflicts.

if ($iterator->numrows() > 0) {
$input['_status'] = CommonITILObject::PLANNED;
} elseif (
$parentitem::isAllowedStatus($parentitem->fields["status"], CommonITILObject::ASSIGNED)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure of this, but I think we should not rely on the current profile statuses matrix to filter available status. Indeed, I think that when a task begin date is updated, the ticket status should be changed to PLANNED, even if the technician is not supposed to be able to do it by itself.

@orthagh What do you think of this?

Suggested change
$parentitem::isAllowedStatus($parentitem->fields["status"], CommonITILObject::ASSIGNED)
$parentitem->isStatusExists(CommonITILObject::ASSIGNED)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, previously, we just checked the planned status really exists for the ITILobject (Changes doesn't have this status).
The right of a technician to change the status to planned should not be checked.
This is for the UI and prevents manually changing the status field.
All shortcuts, like "adding a tech actor -> status move to in ASSIGN", "remove all attributed actor -> return to INCOMING" and the new one to move to PLANNED should be done by the framework automatically and do not impact the status field directly.

) {
$input['_status'] = CommonITILObject::ASSIGNED;
} elseif (
$parentitem::isAllowedStatus($parentitem->fields["status"], CommonITILObject::INCOMING)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same remark here.

Suggested change
$parentitem::isAllowedStatus($parentitem->fields["status"], CommonITILObject::INCOMING)
$parentitem->isStatusExists(CommonITILObject::INCOMING)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants