Set Cc attribute in agent ticket create via outbound email at runtime (to not show ticket.cc in placeholder and ticket selectors widgets).

This commit is contained in:
Martin Edenhofer 2016-05-06 12:37:23 +02:00
parent 41f97d6f50
commit 6161c9f0f2
4 changed files with 59 additions and 24 deletions

View file

@ -238,6 +238,23 @@ class App.TicketCreate extends App.Controller
else
@$('[data-name="body"]').find('[data-signature=true]').remove()
App.Ticket.configure_attributes.push {
name: 'cc'
display: 'Cc'
tag: 'input'
type: 'text'
maxlength: 1000
null: true
screen: {
create_top: {
Agent: {
null: true
}
}
create_middle: {}
edit: {}
}
}
new App.ControllerForm(
el: @$('.ticket-form-top')
form_id: @form_id
@ -290,6 +307,7 @@ class App.TicketCreate extends App.Controller
filter: @formMeta.filter
params: params
)
App.Ticket.configure_attributes.pop()
# set type selector
@setFormTypeInUi( params['formSenderType'] )

View file

@ -126,6 +126,41 @@ add a new attribute entry for an object
=begin
remove attribute entry for an object
ObjectManager::Attribute.remove(
object: 'Ticket',
name: 'group_id',
)
use "force: true" to delete also not editable fields
=end
def self.remove(data)
# lookups
if data[:object]
data[:object_lookup_id] = ObjectLookup.by_name(data[:object])
end
# check newest entry - is needed
result = ObjectManager::Attribute.find_by(
object_lookup_id: data[:object_lookup_id],
name: data[:name],
)
if !result
raise "ERROR: No such field #{data[:object]}.#{data[:name]}"
end
if !data[:force] && !result.editable
raise "ERROR: #{data[:object]}.#{data[:name]} can't be removed!"
end
result.destroy
end
=begin
get the attribute model based on object and name
attribute = ObjectManager::Attribute.get(

View file

@ -0,0 +1,6 @@
class EmailTicketCcRemove < ActiveRecord::Migration
def up
ObjectManager::Attribute.remove(object: 'Ticket', name: 'cc', force: true)
end
end

View file

@ -2533,30 +2533,6 @@ ObjectManager::Attribute.add(
pending_migration: false,
position: 10,
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'cc',
display: 'Cc',
data_type: 'input',
data_option: {
type: 'text',
maxlength: 1000,
null: true,
},
editable: false,
active: true,
screens: {
create_top: {
Agent: {
null: true,
},
},
create_middle: {},
edit: {}
},
pending_migration: false,
position: 11,
)
ObjectManager::Attribute.add(
object: 'Ticket',
name: 'type',