Skip to content

Add change/clear_ticket_take_into_account: write or reset a ticket's take-into-account stamp through v1 (0.6.8) - #47

Merged
baraline merged 2 commits into
mainfrom
feat/clear-take-into-account
Nov 2, 2026
Merged

baraline merged 2 commits into
mainfrom
feat/clear-take-into-account

Conversation

@baraline

@baraline baraline commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

What

Two methods on AsyncGlpiClient and GlpiClient, through the legacy v1 Ticket route:

  • change_ticket_take_into_account(ticket_id, *, take_into_account_date, take_into_account_duration, do_not_compute=True, disable_notifications=True) writes takeintoaccountdate and takeintoaccount_delay_stat.
    • An aware date is converted to server_timezone. A naive date is taken as already on the server's clock. The date is sent as YYYY-MM-DD HH:MM:SS.
    • GLPI writes a null date whenever the duration is 0.
  • 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_takeintoaccount and _disablenotif.

  • 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.
  • With do_not_compute=False and 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 Ticket schema 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.

  • Needs the v1 session and raises RuntimeError without one, the same pattern as set_group_recursive.
  • A refused v1 write raises GlpiProtocolError (ensure_v1_write_accepted). A non-2xx answer raises GlpiStatusError.
  • Version 0.6.8, with the changelog, a user guide section and a ticket-workflow skill step.

🤖 Generated with Claude Code

…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-commenter

codecov-commenter commented Nov 2, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.06%. Comparing base (18d113e) to head (5baec9e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…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>
@baraline baraline changed the title Add clear_ticket_take_into_account: reset a ticket's take-into-account stamp through v1 (0.6.8) Add change/clear_ticket_take_into_account: write or reset a ticket's take-into-account stamp through v1 (0.6.8) Nov 2, 2026
@baraline
baraline merged commit af750ee into main Nov 2, 2026
7 checks passed
@baraline
baraline deleted the feat/clear-take-into-account branch November 2, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants