Added example trigger. Re-assigned ticket_subject_size and ticket_subject_re in admin interface.

This commit is contained in:
Martin Edenhofer 2016-07-17 00:18:08 +02:00
parent e2bb6cce56
commit 5bbb249240
2 changed files with 136 additions and 36 deletions

View file

@ -0,0 +1,71 @@
class UpdateSettingEmail < ActiveRecord::Migration
def up
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
Setting.create_or_update(
title: 'Ticket Subject Size',
name: 'ticket_subject_size',
area: 'Email::Base',
description: 'Max size of the subjects in an email reply.',
options: {
form: [
{
display: '',
null: false,
name: 'ticket_subject_size',
tag: 'input',
},
],
},
state: '110',
frontend: false
)
Setting.create_or_update(
title: 'Ticket Subject Reply',
name: 'ticket_subject_re',
area: 'Email::Base',
description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
options: {
form: [
{
display: '',
null: true,
name: 'ticket_subject_re',
tag: 'input',
},
],
},
state: 'RE',
frontend: false
)
Trigger.create_or_update(
name: 'customer notification (on owner change)',
condition: {
'ticket.owner_id' => {
'operator' => 'has changed',
'pre_condition' => 'current_user.id',
'value' => '',
'value_completion' => '',
}
},
perform: {
'notification.email' => {
'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
<br/>
<p>To provide additional information, please reply to this email or click on the following link:
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
</p>
<br/>
<p><i><a href="http://zammad.com">Zammad</a>, your customer support system</i></p>',
'recipient' => 'ticket_customer',
'subject' => 'Owner has changed (#{ticket.title})',
},
},
active: false,
created_by_id: 1,
updated_by_id: 1,
)
end
end

View file

@ -825,42 +825,6 @@ Setting.create_if_not_exists(
state: 'right', state: 'right',
frontend: false frontend: false
) )
Setting.create_if_not_exists(
title: 'Ticket Subject Size',
name: 'ticket_subject_size',
area: 'Ticket::Base',
description: 'Max size of the subjects in an email reply.',
options: {
form: [
{
display: '',
null: false,
name: 'ticket_subject_size',
tag: 'input',
},
],
},
state: '110',
frontend: false
)
Setting.create_if_not_exists(
title: 'Ticket Subject Reply',
name: 'ticket_subject_re',
area: 'Ticket::Base',
description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
options: {
form: [
{
display: '',
null: true,
name: 'ticket_subject_re',
tag: 'input',
},
],
},
state: 'RE',
frontend: false
)
Setting.create_if_not_exists( Setting.create_if_not_exists(
title: 'Ticket Number Format', title: 'Ticket Number Format',
name: 'ticket_number', name: 'ticket_number',
@ -1056,6 +1020,43 @@ Setting.create_if_not_exists(
frontend: false, frontend: false,
) )
Setting.create_if_not_exists(
title: 'Ticket Subject Size',
name: 'ticket_subject_size',
area: 'Email::Base',
description: 'Max size of the subjects in an email reply.',
options: {
form: [
{
display: '',
null: false,
name: 'ticket_subject_size',
tag: 'input',
},
],
},
state: '110',
frontend: false
)
Setting.create_if_not_exists(
title: 'Ticket Subject Reply',
name: 'ticket_subject_re',
area: 'Email::Base',
description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
options: {
form: [
{
display: '',
null: true,
name: 'ticket_subject_re',
tag: 'input',
},
],
},
state: 'RE',
frontend: false
)
Setting.create_if_not_exists( Setting.create_if_not_exists(
title: 'Sender Format', title: 'Sender Format',
name: 'ticket_define_email_from', name: 'ticket_define_email_from',
@ -4403,6 +4404,34 @@ Trigger.create_or_update(
updated_by_id: 1, updated_by_id: 1,
) )
Trigger.create_or_update(
name: 'customer notification (on owner change)',
condition: {
'ticket.owner_id' => {
'operator' => 'has changed',
'pre_condition' => 'current_user.id',
'value' => '',
'value_completion' => '',
}
},
perform: {
'notification.email' => {
'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
<br/>
<p>To provide additional information, please reply to this email or click on the following link:
<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
</p>
<br/>
<p><i><a href="http://zammad.com">Zammad</a>, your customer support system</i></p>',
'recipient' => 'ticket_customer',
'subject' => 'Owner has changed (#{ticket.title})',
},
},
active: false,
created_by_id: 1,
updated_by_id: 1,
)
# reset primary key sequences # reset primary key sequences
if ActiveRecord::Base.connection_config[:adapter] == 'postgresql' if ActiveRecord::Base.connection_config[:adapter] == 'postgresql'
ActiveRecord::Base.connection.tables.each do |t| ActiveRecord::Base.connection.tables.each do |t|