Skip to content

N°9629 - New fields Tags and Owner on Query class#963

Merged
v-dumas merged 8 commits into
developfrom
feature/9629-tags-on-queries
Jul 8, 2026
Merged

N°9629 - New fields Tags and Owner on Query class#963
v-dumas merged 8 commits into
developfrom
feature/9629-tags-on-queries

Conversation

@v-dumas

@v-dumas v-dumas commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Base information

Question Answer
Related to a Combodo ticket?
Type of change? Enhancement

Symptom (bug) / Objective (enhancement)

  1. Allow IA to identify Queries from iTop Query Phrasebook which are good examples for learning how to build OQL within a particular Datamodel
  2. Add additional tags to specify in which context the query can be used
  3. Add a contact owner of a query to identify a group/team using it and in charge of defining its evolution/obsolescence
  4. Lock technical computed fields on QueryOQL creation

Proposed solution (bug and enhancement)

Two new fields on OQL Query to specify the usages and a contact responsible for this query
This allow to better manage a large number of queries, proposing filtering criteria, more efficient than a simple naming convention of queries

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • I have added a unit test, otherwise I have explained why I couldn't
  • Is the PR clear and detailed enough so anyone can understand without digging in the code?

Copilot AI review requested due to automatic review settings July 7, 2026 10:16
@v-dumas v-dumas self-assigned this Jul 7, 2026
@CombodoApplicationsAccount CombodoApplicationsAccount added the internal Work made by Combodo label Jul 7, 2026
@v-dumas v-dumas changed the title Feature/9629 tags on queries N°9629 tags on queries Jul 7, 2026
@v-dumas v-dumas changed the title N°9629 tags on queries N°9629 - New fields Tags and Owner on Query class Jul 7, 2026
@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds two new fields to the Query class hierarchy: owner_id (an optional FK to Contact) and usages (a multi-select enum: export, reference, notif, draft, dashlet). It also introduces GetInitialStateAttributeFlags to make the three auto-computed export-tracking fields read-only at creation time, and tags all existing ticket notification queries in the reference data with usages=notif.

  • owner_id and usages are added to the abstract Query base class so they apply to all query types; search, list, and detail display layouts are updated accordingly.
  • All 21 language dictionaries are updated with the new attribute keys, and the 13 existing ticket QueryOQL reference records across three locales are updated to set usages=notif (replacing the now-redundant <finalclass> XML element).
  • GetInitialStateAttributeFlags mirrors the existing GetAttributeFlags read-only guard so that export_count, export_last_date, and export_last_user_id cannot be manually set during object creation.

Confidence Score: 5/5

Safe to merge — adds two optional, nullable fields to the Query hierarchy with no breaking changes to existing data or APIs.

All changes are additive: two new nullable attributes on the abstract Query class, a GetInitialStateAttributeFlags override that consistently mirrors the existing GetAttributeFlags read-only guard, reference-data updates that correctly tag pre-existing notification queries, and dictionary stubs across all locales. No existing behavior is broken, and schema migration is handled automatically by iTop's setup process.

No files require special attention; application/query.class.inc.php is the only logic file and its changes are straightforward.

Important Files Changed

Filename Overview
application/query.class.inc.php Core file adding owner_id (ExternalKey→Contact, DEL_AUTO) and usages (AttributeEnumSet, 5 values, max_items=12) to the abstract Query class, plus GetInitialStateAttributeFlags for read-only creation-time guards; display/search layouts updated for both Query and QueryOQL subclass.
datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml Reference data: replaces the redundant finalclass element with usages=notif on all 13 ticket-related QueryOQL records; the outer tag already identifies the class so removing finalclass is safe.
dictionaries/en.dictionary.itop.ui.php Adds the canonical English translations for the new usages and owner_id attributes; other dictionaries follow the same pattern with ~~ stubs for untranslated languages.
dictionaries/fr.dictionary.itop.ui.php Full French translations provided for both new fields; the usages+ tooltip includes helpful semantic notes on each enum value that are absent from the English description.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class cmdbAbstractObject {
    }
    class Query {
        +string name
        +text description
        +enum is_template
        +int export_count
        +datetime export_last_date
        +extkey export_last_user_id
        +extfield export_last_user_contact
        +extkey owner_id [NEW]
        +enumset usages [NEW]
        +GetAttributeFlags()
        +GetInitialStateAttributeFlags() [NEW]
        +UpdateLastExportInformation()
    }
    class QueryOQL {
        +oql oql
        +text fields
        +GetExportUrl()
        +DisplayBareProperties()
    }
    class Contact {
    }
    cmdbAbstractObject <|-- Query
    Query <|-- QueryOQL
    Query --> Contact : owner_id (DEL_AUTO)
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
classDiagram
    class cmdbAbstractObject {
    }
    class Query {
        +string name
        +text description
        +enum is_template
        +int export_count
        +datetime export_last_date
        +extkey export_last_user_id
        +extfield export_last_user_contact
        +extkey owner_id [NEW]
        +enumset usages [NEW]
        +GetAttributeFlags()
        +GetInitialStateAttributeFlags() [NEW]
        +UpdateLastExportInformation()
    }
    class QueryOQL {
        +oql oql
        +text fields
        +GetExportUrl()
        +DisplayBareProperties()
    }
    class Contact {
    }
    cmdbAbstractObject <|-- Query
    Query <|-- QueryOQL
    Query --> Contact : owner_id (DEL_AUTO)
Loading

Reviews (2): Last reviewed commit: "Fix missing blank line" | Re-trigger Greptile

Comment thread application/query.class.inc.php
Comment thread application/query.class.inc.php Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances iTop’s Query / QueryOQL objects by introducing metadata to better categorize and govern stored OQL queries (usage tags + an owner contact), and surfaces these fields in the UI (details, list, search). It also updates built-in ticketing sample queries to be tagged for notification usage and adds dictionary entries for the new fields.

Changes:

  • Add owner_id (Contact) and usages (enum set) attributes to Query, and display them in details/list/search for Query and QueryOQL.
  • Add translations for the new attributes/values across multiple core UI dictionaries.
  • Tag the ticketing module’s predefined QueryOQL templates with usages=notif.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
application/query.class.inc.php Adds owner_id and usages attributes to Query, updates Query/QueryOQL UI zlists and search criteria, and introduces initial-state read-only flags for export technical fields.
datamodels/2.x/itop-tickets/data/en_us.data.itop-tickets.xml Sets <usages>notif</usages> on predefined notification recipient QueryOQL templates.
datamodels/2.x/itop-tickets/data/fr_fr.data.itop-tickets.xml Sets <usages>notif</usages> on predefined notification recipient QueryOQL templates.
datamodels/2.x/itop-tickets/data/de_de.data.itop-tickets.xml Sets <usages>notif</usages> on predefined notification recipient QueryOQL templates.
dictionaries/en.dictionary.itop.ui.php Adds labels/helptext for Query.usages, usage values, and Query.owner_id.
dictionaries/fr.dictionary.itop.ui.php Adds French labels/helptext for Query.usages/values and Query.owner_id.
dictionaries/de.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/en_gb.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/es_cr.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/it.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/ja.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/nl.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/pl.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/pt_br.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/ru.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/sk.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/tr.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/cs.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/da.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/hu.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).
dictionaries/zh_cn.dictionary.itop.ui.php Adds dictionary keys for new query usage/owner fields (placeholder translations).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dictionaries/fr.dictionary.itop.ui.php Outdated
Comment thread application/query.class.inc.php
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 7, 2026 12:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 4 comments.

Comment thread dictionaries/en.dictionary.itop.ui.php Outdated
Comment thread dictionaries/fr.dictionary.itop.ui.php Outdated
Comment thread application/query.class.inc.php
Comment thread application/query.class.inc.php
Copilot AI review requested due to automatic review settings July 7, 2026 13:07
v-dumas and others added 2 commits July 7, 2026 15:10
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@v-dumas

v-dumas commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Comment thread dictionaries/fr.dictionary.itop.ui.php Outdated
Comment thread dictionaries/en.dictionary.itop.ui.php Outdated
Comment thread application/query.class.inc.php
Copilot AI review requested due to automatic review settings July 7, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated 1 comment.

Comment thread dictionaries/en.dictionary.itop.ui.php Outdated
@v-dumas v-dumas merged commit 127be19 into develop Jul 8, 2026
@v-dumas v-dumas deleted the feature/9629-tags-on-queries branch July 8, 2026 08:37
v-dumas added a commit that referenced this pull request Jul 8, 2026
* N°9629 - Add Usages EnumSet and Owner on Query class

* N°9629 - Add Usages on structural Queries

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants