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

Add _do_not_compute_takeintoaccount in Common Task #18527

Open
wants to merge 10 commits into
base: 10.0/bugfixes
Choose a base branch
from

Conversation

Lainow
Copy link
Contributor

@Lainow Lainow commented Dec 10, 2024

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

  • It fixes !35342
  • Here is a brief description of what this PR does

Added verification of the presence of the _do_not_compute_takeintoaccount field to the CommonITILTask class to enable the escalation task not to terminate the SLA / OLA TTO

Screenshots (if appropriate):

@Lainow Lainow changed the base branch from main to 10.0/bugfixes December 10, 2024 16:02
src/CommonITILTask.php Outdated Show resolved Hide resolved
src/CommonITILTask.php Show resolved Hide resolved
Co-authored-by: Johan Cwiklinski <trasher@x-tnd.be>
@Lainow Lainow requested review from stonebuzz and trasher December 11, 2024 09:10
@trasher
Copy link
Contributor

trasher commented Dec 11, 2024

That probably requires a test

src/CommonITILObject.php Outdated Show resolved Hide resolved
Co-authored-by: Stanislas <skita@teclib.com>
@Lainow Lainow requested a review from stonebuzz December 11, 2024 10:46
phpunit/functional/TicketTest.php Outdated Show resolved Hide resolved
Lainow and others added 2 commits December 11, 2024 14:14
Co-authored-by: Stanislas <skita@teclib.com>
@stonebuzz
Copy link
Contributor

@Lainow

Can you ask the customer to test ?

@@ -5210,6 +5210,11 @@ public function updateDateMod($ID, $no_stat_computation = false, $users_id_lastu
$update['users_id_lastupdater'] = $users_id_lastupdater;
}

// set take into account delay stat
if ($no_stat_computation && $this->getType() == Ticket::class) {
$update['takeintoaccount_delay_stat'] = 0;
Copy link
Member

Choose a reason for hiding this comment

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

IMHO, we should not force the value here. takeintoaccount_delay_stat may have already been defined by a previous action.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Like that it's okay ?

if ($this->fields['takeintoaccount_delay_stat'] == 0) {
    $update['takeintoaccount_delay_stat'] = 0;
}

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 to understand what you are trying to do. Also, the ticket specific case should probably be managed in the Ticker::updateDateMod() override.

@Lainow Lainow requested a review from cedric-anne December 11, 2024 14:20
src/Ticket.php Outdated Show resolved Hide resolved
Comment on lines +5215 to +5217
if ($this->fields['takeintoaccount_delay_stat'] == 0) {
$update['takeintoaccount_delay_stat'] = 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

As explained in the internal chat, this code does not make sense to me. If $this->fields['takeintoaccount_delay_stat'] equals 0, why should we update it to the same value ?

Also, $no_stat_computation probably means that we should not change the value of the takeintoaccount_delay_stat field, even if we set it to 0.

@@ -650,7 +650,7 @@ public function post_addItem()
}
}

$this->input["_job"]->updateDateMod($this->input[$this->input["_job"]->getForeignKeyField()]);
$this->input["_job"]->updateDateMod($this->input[$this->input["_job"]->getForeignKeyField()], $this->input['_do_not_compute_takeintoaccount'] ?? false);
Copy link
Member

Choose a reason for hiding this comment

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

This change should probably de done to all the calls to updateDateMod. This same ability to not alter SLA/OLA stats will probably be usefull for other actions, like adding an actor, updating a task, adding an automatic followup, ...

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.

4 participants