Only show configured article types.

This commit is contained in:
Martin Edenhofer 2013-01-04 09:26:14 +01:00
parent 314c545671
commit bfb32e6933
2 changed files with 21 additions and 6 deletions

View file

@ -101,7 +101,7 @@ class Index extends App.Controller
] ]
@configure_attributes_article = [ @configure_attributes_article = [
{ name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', default: '9', translate: true, class: 'medium', item_class: '' }, { name: 'ticket_article_type_id', display: 'Type', tag: 'select', multiple: false, null: true, relation: 'TicketArticleType', filter: @edit_form, default: '9', translate: true, class: 'medium', item_class: '' },
{ name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' }, { name: 'to', display: 'To', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
{ name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' }, { name: 'cc', display: 'Cc', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },
{ name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' }, { name: 'subject', display: 'Subject', tag: 'input', type: 'text', limit: 100, null: true, class: 'span7', item_class: 'hide' },

View file

@ -86,7 +86,22 @@ class Ticket < ApplicationModel
ticket_priority_ids.push priority.id ticket_priority_ids.push priority.id
} }
ticket_article_type_ids = []
if params[:ticket]
ticket_article_types = ['note', 'phone']
if params[:ticket].group.email_address_id
ticket_article_types.push 'email'
end
ticket_article_types.each {|ticket_article_type_name|
ticket_article_type = Ticket::Article::Type.lookup( :name => ticket_article_type_name )
if ticket_article_type
ticket_article_type_ids.push ticket_article_type.id
end
}
end
return { return {
:ticket_article_type_id => ticket_article_type_ids,
:ticket_state_id => ticket_state_ids, :ticket_state_id => ticket_state_ids,
:ticket_priority_id => ticket_priority_ids, :ticket_priority_id => ticket_priority_ids,
:owner_id => owner_ids, :owner_id => owner_ids,