20160717000001_update_setting_email.rb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. class UpdateSettingEmail < ActiveRecord::Migration
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. Setting.create_or_update(
  6. title: 'Ticket Subject Size',
  7. name: 'ticket_subject_size',
  8. area: 'Email::Base',
  9. description: 'Max size of the subjects in an email reply.',
  10. options: {
  11. form: [
  12. {
  13. display: '',
  14. null: false,
  15. name: 'ticket_subject_size',
  16. tag: 'input',
  17. },
  18. ],
  19. },
  20. state: '110',
  21. frontend: false
  22. )
  23. Setting.create_or_update(
  24. title: 'Ticket Subject Reply',
  25. name: 'ticket_subject_re',
  26. area: 'Email::Base',
  27. description: 'The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.',
  28. options: {
  29. form: [
  30. {
  31. display: '',
  32. null: true,
  33. name: 'ticket_subject_re',
  34. tag: 'input',
  35. },
  36. ],
  37. },
  38. state: 'RE',
  39. frontend: false
  40. )
  41. Trigger.create_or_update(
  42. name: 'customer notification (on owner change)',
  43. condition: {
  44. 'ticket.owner_id' => {
  45. 'operator' => 'has changed',
  46. 'pre_condition' => 'current_user.id',
  47. 'value' => '',
  48. 'value_completion' => '',
  49. }
  50. },
  51. perform: {
  52. 'notification.email' => {
  53. 'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
  54. <br/>
  55. <p>To provide additional information, please reply to this email or click on the following link:
  56. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  57. </p>
  58. <br/>
  59. <p><i><a href="http://zammad.com">Zammad</a>, your customer support system</i></p>',
  60. 'recipient' => 'ticket_customer',
  61. 'subject' => 'Owner has changed (#{ticket.title})',
  62. },
  63. },
  64. active: false,
  65. created_by_id: 1,
  66. updated_by_id: 1,
  67. )
  68. end
  69. end