Merge branch 'private-seed_improve_state_ids_state_type' into develop
This commit is contained in:
commit
49c3d4c2ec
2 changed files with 18 additions and 30 deletions
|
@ -16,7 +16,7 @@ class Ticket::State < ApplicationModel
|
|||
|
||||
looks up states for a given category
|
||||
|
||||
states = Ticket::State.by_category(:open) # :open|:closed|:work_on|:work_on_all|:viewable|:pending_reminder|:pending_action|:merged
|
||||
states = Ticket::State.by_category(:open) # :open|:closed|:work_on|:work_on_all|:viewable|:viewable_agent_new|:viewable_agent_edit|:viewable_customer_new|:viewable_customer_edit|:pending_reminder|:pending_action|:pending|:merged
|
||||
|
||||
returns:
|
||||
|
||||
|
@ -33,12 +33,22 @@ returns:
|
|||
state_types = ['pending reminder']
|
||||
when :pending_action
|
||||
state_types = ['pending action']
|
||||
when :pending
|
||||
state_types = ['pending reminder', 'pending action']
|
||||
when :work_on
|
||||
state_types = %w(new open)
|
||||
when :work_on_all
|
||||
state_types = ['new', 'open', 'pending reminder']
|
||||
when :viewable
|
||||
state_types = ['new', 'open', 'pending reminder', 'pending action', 'closed', 'removed']
|
||||
when :viewable_agent_new
|
||||
state_types = ['new', 'open', 'pending reminder', 'pending action', 'closed']
|
||||
when :viewable_agent_edit
|
||||
state_types = ['open', 'pending reminder', 'pending action', 'closed']
|
||||
when :viewable_customer_new
|
||||
state_types = %w(new closed)
|
||||
when :viewable_customer_edit
|
||||
state_types = %w(open closed)
|
||||
when :closed
|
||||
state_types = %w(closed)
|
||||
when :merged
|
||||
|
|
36
db/seeds.rb
36
db/seeds.rb
|
@ -3846,13 +3846,7 @@ ObjectManager::Attribute.add(
|
|||
null: false,
|
||||
default: Ticket::State.find_by(name: 'open').id,
|
||||
translate: true,
|
||||
filter: [
|
||||
Ticket::State.find_by(name: 'new').id,
|
||||
Ticket::State.find_by(name: 'open').id,
|
||||
Ticket::State.find_by(name: 'pending reminder').id,
|
||||
Ticket::State.find_by(name: 'closed').id,
|
||||
Ticket::State.find_by(name: 'pending close').id,
|
||||
],
|
||||
filter: Ticket::State.by_category(:viewable).pluck(:id),
|
||||
},
|
||||
editable: false,
|
||||
active: true,
|
||||
|
@ -3861,15 +3855,13 @@ ObjectManager::Attribute.add(
|
|||
Agent: {
|
||||
null: false,
|
||||
item_class: 'column',
|
||||
filter: Ticket::State.by_category(:viewable_agent_new).pluck(:id),
|
||||
},
|
||||
Customer: {
|
||||
item_class: 'column',
|
||||
nulloption: false,
|
||||
null: true,
|
||||
filter: [
|
||||
Ticket::State.find_by(name: 'new').id,
|
||||
Ticket::State.find_by(name: 'closed').id
|
||||
],
|
||||
filter: Ticket::State.by_category(:viewable_customer_new).pluck(:id),
|
||||
default: Ticket::State.find_by(name: 'new').id,
|
||||
},
|
||||
},
|
||||
|
@ -3877,20 +3869,12 @@ ObjectManager::Attribute.add(
|
|||
Agent: {
|
||||
nulloption: false,
|
||||
null: false,
|
||||
filter: [
|
||||
Ticket::State.find_by(name: 'open').id,
|
||||
Ticket::State.find_by(name: 'pending reminder').id,
|
||||
Ticket::State.find_by(name: 'closed').id,
|
||||
Ticket::State.find_by(name: 'pending close').id,
|
||||
],
|
||||
filter: Ticket::State.by_category(:viewable_agent_edit).pluck(:id),
|
||||
},
|
||||
Customer: {
|
||||
nulloption: false,
|
||||
null: true,
|
||||
filter: [
|
||||
Ticket::State.find_by(name: 'open').id,
|
||||
Ticket::State.find_by(name: 'closed').id
|
||||
],
|
||||
filter: Ticket::State.by_category(:viewable_customer_edit).pluck(:id),
|
||||
default: Ticket::State.find_by(name: 'open').id,
|
||||
},
|
||||
},
|
||||
|
@ -3913,16 +3897,10 @@ ObjectManager::Attribute.add(
|
|||
null: true,
|
||||
translate: true,
|
||||
required_if: {
|
||||
state_id: [
|
||||
Ticket::State.find_by(name: 'pending reminder').id,
|
||||
Ticket::State.find_by(name: 'pending close').id,
|
||||
]
|
||||
state_id: Ticket::State.by_category(:pending).pluck(:id),
|
||||
},
|
||||
shown_if: {
|
||||
state_id: [
|
||||
Ticket::State.find_by(name: 'pending reminder').id,
|
||||
Ticket::State.find_by(name: 'pending close').id,
|
||||
]
|
||||
state_id: Ticket::State.by_category(:pending).pluck(:id),
|
||||
},
|
||||
},
|
||||
editable: false,
|
||||
|
|
Loading…
Reference in a new issue