Scheduler action to close taskbar tabs + condition "Has open taskbar tabs"

Hi everyone,

I would like to propose a small enhancement for scheduler jobs that could help with periodic cleanup of taskbar tabs.

Problem

In larger installations, open taskbar tabs (ticket tabs) can accumulate over time, especially for closed or inactive tickets.

Currently, there is no way to:

  • automatically close these tabs
  • or restrict scheduler jobs to tickets that actually have open taskbar entries

As a result, scheduler jobs may process a large number of tickets unnecessarily.


Proposed solution

1. New scheduler action

“Close taskbar tab”

  • closes all taskbar entries for a ticket
  • internally calls the existing taskbar cleanup logic
  • behaves exactly like manually closing a tab (including WebSocket updates)

2. New ticket condition

“Has open taskbar tabs”

  • boolean condition:
    • is
    • is not
  • allows restricting scheduler jobs to relevant tickets only

Example use case

A weekly cleanup job:

  • Condition:
    • Ticket state = closed
    • Has open taskbar tabs = true
  • Action:
    • Close taskbar tab

This ensures:

  • only relevant tickets are processed
  • avoids unnecessary full scans over all tickets

Implementation

I already implemented a working version following existing patterns (PerformChanges, selector logic, etc.).

The changes include:

  • new perform action (close_taskbars)
  • new selector condition (ticket.has_taskbar_entries)
  • support for both SQL and SearchIndex selectors
  • UI integration in scheduler jobs

Code is available here:


Questions

  • Does this feature fit into Zammad’s roadmap?
  • Is the naming (“Has open taskbar tabs”) acceptable?
  • Should this also be available for triggers/macros, or scheduler-only?

I’d be happy to open a PR against develop if this direction is considered useful.

Thanks!

Example from the Scheduler: