Repository navigation
Add change/clear_ticket_take_into_account: write or reset a ticket's take-into-account stamp through v1 (0.6.8) - #47
Merged
Conversation
…t stamp through the legacy v1 API GLPI stamps the take-into-account date on the first write by an account allowed to take a ticket into account, and the v2 Ticket schema exposes it read-only and ignores _do_not_compute_takeintoaccount. The new method on both clients PUTs the v1 Ticket route with a null date, a zero stored duration, the do-not-compute flag and notifications disabled. It needs the v1 session and raises RuntimeError without one; a refused write raises GlpiProtocolError. Released as 0.6.8. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #47 +/- ##
=======================================
Coverage 98.05% 98.06%
=======================================
Files 94 94
Lines 3700 3719 +19
=======================================
+ Hits 3628 3647 +19
Misses 72 72 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…ccount a call to it, with do_not_compute and disable_notifications exposed as booleans on both change_ticket_take_into_account writes the v1 takeintoaccountdate (an aware datetime is converted to server_timezone, a naive one is taken as already on it, sent as YYYY-MM-DD HH:MM:SS) and takeintoaccount_delay_stat. The two flags default to True, as the clear sent them before. A False flag is left out of the request, not sent as false: GLPI 11 tests _disablenotif with isset() (Ticket::post_updateItem), so false would still silence the notification. The clear passes a null date and a 0 duration, and its default request body is unchanged. The v1 error label now reads "take-into-account writes". The method-invocation suite synthesizes a datetime for a datetime parameter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two methods on
AsyncGlpiClientandGlpiClient, through the legacy v1Ticketroute:change_ticket_take_into_account(ticket_id, *, take_into_account_date, take_into_account_duration, do_not_compute=True, disable_notifications=True)writestakeintoaccountdateandtakeintoaccount_delay_stat.server_timezone. A naive date is taken as already on the server's clock. The date is sent asYYYY-MM-DD HH:MM:SS.clear_ticket_take_into_account(ticket_id, *, do_not_compute=True, disable_notifications=True)is that change with a null date and a 0 duration. Its default request body is the one measured on ticket 70082.The booleans control
_do_not_compute_takeintoaccountand_disablenotif.Falseflag is left out of the request, not sent asfalse. GLPI 11 tests_disablenotifwithisset()(Ticket::post_updateItem), sofalsewould still silence the notification.do_not_compute=Falseand a 0 duration, an account allowed to take the ticket into account stamps the ticket again in the same write (Ticket::pre_updateInDB). The docstrings say so.Why
GLPI stamps the take-into-account date on the first write by an account allowed to take a ticket into account, and when an assigned group is added. A connector that creates a ticket and assigns it a group therefore collapses the time-to-own (GTI) to about a second.
The v2
Ticketschema exposes the date read-only and ignores_do_not_compute_takeintoaccount, so the write goes through v1. itsm_synchronisation needs this: the GLPI tickets the sync creates must stay New with their GTI clock running.RuntimeErrorwithout one, the same pattern asset_group_recursive.GlpiProtocolError(ensure_v1_write_accepted). A non-2xx answer raisesGlpiStatusError.🤖 Generated with Claude Code