Ticket State issue

We have a problem in the UI in Zammad status “Open After”.

If you set the state and update, it will work. However, the marker for “unsaved changes” remains.

Only when you close the ticket and “Changes discarded” the marker disappears. The new status remains set nevertheless.

As soon as this ticket is opened again, the marker “Unsaved changes” reappears.

To understand why a new status was created.

We are coming from OTRS and the import to Zammad has messed up all the states. It was partly English and German mixed and other errors.

So we disabled all states of Zammad to avoid collisions. The new state came later.

Infos:

  • Used Zammad version: 3.4.x
  • Installation method (source, package, …): Debian PPA
  • Operating system: Debian 9
  • Database + version: Postgres 9
  • Elasticsearch version: 5.6.16
  • Browser + version: Firefox 78.0.2

Expected behavior:

The status is saved correctly and there is no mark with “Unsaved changes”.

Actual behavior:

If you set the state and update, it will work. However, the marker for “unsaved changes” remains.

Only when you close the ticket and “Changes discarded” the marker disappears. The new status remains set nevertheless.

As soon as this ticket is opened again, the marker “Unsaved changes” reappears.

strong text

Steps to reproduce the behavior:

Follow this Guide for Pending and add time/date
https://docs.zammad.org/en/latest/admin/console/working-on-tickets.html#add-a-date-and-time-picker-pending-till-for-pending-states

The following commands were used for this status.

1. Create State

Ticket::State.create_or_update( name: 'Öffnen nach', state_type_id: 4, ignore_escalation: true, next_state_id: 2, created_by_id: 1, updated_by_id: 1, )

2. Add Timetable

ObjectManager::Attribute.add( force: true, object: 'Ticket', name: 'pending_time', display: 'Pending till', data_type: 'datetime', data_option: { future: true, past: false, diff: 24, null: true, translate: true, required_if: { state_id: 15, }, shown_if: { state_id: 15, }, }, editable:false, active: true, screens: { create_middle: { '-all-' => { null: false, item_class: 'column', }, }, edit: { '-all-' => { null: false, }, }, }, to_create: false, to_migrate: false, to_delete: false, position: 41, )

3. Update Zammad-UI

attribute = ObjectManager::Attribute.get( object: 'Ticket', name: 'state_id', )
attribute.data_option[:filter] = Ticket::State.by_category(:viewable).pluck(:id)
attribute.screens[:create_middle]['ticket.agent'][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
attribute.screens[:create_middle]['ticket.customer'][:filter] = Ticket::State.by_category(:viewable_customer_new).pluck(:id)
attribute.screens[:edit]['ticket.agent'][:filter] = Ticket::State.by_category(:viewable_agent_new).pluck(:id)
attribute.screens[:edit]['ticket.customer'][:filter] = Ticket::State.by_category(:viewable_customer_edit).pluck(:id)
attribute.save!

I’m confused.
I recall the exact phrases of this post…

Anyway, there’s absolutely no reason to add a new ticket attribute for a pending time selection.
In fact by default Zammad does come with one!

So let’s clean up that a bit, because I get the feeling a lot goes wrong here.

First of all, please provide the output of zammad run rails r "p Ticket::State::Type.find(4).

In my opinion you can remove the “pending_time” attribute as Zammad -as already mentioned- does have such a functionality by default.

Then you’ll want to run the code part you actually referenced ( Add a date and time picker (pending till) for pending states) [following in a rails console zammad run rails c]

attribute = ObjectManager::Attribute.get(
     object: 'Ticket',
     name: 'pending_time',
   )
attribute.data_option[:required_if][:state_id] = Ticket::State.by_category(:pending).pluck(:id)
attribute.data_option[:shown_if][:state_id] = Ticket::State.by_category(:pending).pluck(:id)
attribute.save!

Then make the states available to UI again.
The pending till field should appear as expected and disappear if you choose any other state than a pending state.


If above doesn’t help, please provide a screenshot of the meta information of your ticket.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.