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:
parent
41f97d6f50
commit
6161c9f0f2
4 changed files with 59 additions and 24 deletions
|
@ -238,6 +238,23 @@ class App.TicketCreate extends App.Controller
|
||||||
else
|
else
|
||||||
@$('[data-name="body"]').find('[data-signature=true]').remove()
|
@$('[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(
|
new App.ControllerForm(
|
||||||
el: @$('.ticket-form-top')
|
el: @$('.ticket-form-top')
|
||||||
form_id: @form_id
|
form_id: @form_id
|
||||||
|
@ -290,6 +307,7 @@ class App.TicketCreate extends App.Controller
|
||||||
filter: @formMeta.filter
|
filter: @formMeta.filter
|
||||||
params: params
|
params: params
|
||||||
)
|
)
|
||||||
|
App.Ticket.configure_attributes.pop()
|
||||||
|
|
||||||
# set type selector
|
# set type selector
|
||||||
@setFormTypeInUi( params['formSenderType'] )
|
@setFormTypeInUi( params['formSenderType'] )
|
||||||
|
|
|
@ -126,6 +126,41 @@ add a new attribute entry for an object
|
||||||
|
|
||||||
=begin
|
=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
|
get the attribute model based on object and name
|
||||||
|
|
||||||
attribute = ObjectManager::Attribute.get(
|
attribute = ObjectManager::Attribute.get(
|
||||||
|
|
6
db/migrate/20160506000002_email_ticket_cc_remove.rb
Normal file
6
db/migrate/20160506000002_email_ticket_cc_remove.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
class EmailTicketCcRemove < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
ObjectManager::Attribute.remove(object: 'Ticket', name: 'cc', force: true)
|
||||||
|
end
|
||||||
|
end
|
24
db/seeds.rb
24
db/seeds.rb
|
@ -2533,30 +2533,6 @@ ObjectManager::Attribute.add(
|
||||||
pending_migration: false,
|
pending_migration: false,
|
||||||
position: 10,
|
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(
|
ObjectManager::Attribute.add(
|
||||||
object: 'Ticket',
|
object: 'Ticket',
|
||||||
name: 'type',
|
name: 'type',
|
||||||
|
|
Loading…
Reference in a new issue