triggers.rb 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
  2. Trigger.create_or_update(
  3. name: 'auto reply (on new tickets)',
  4. condition: {
  5. 'ticket.action' => {
  6. 'operator' => 'is',
  7. 'value' => 'create',
  8. },
  9. 'ticket.state_id' => {
  10. 'operator' => 'is not',
  11. 'value' => Ticket::State.by_category(:closed).first.id,
  12. },
  13. 'article.type_id' => {
  14. 'operator' => 'is',
  15. 'value' => [
  16. Ticket::Article::Type.lookup(name: 'email').id,
  17. Ticket::Article::Type.lookup(name: 'phone').id,
  18. Ticket::Article::Type.lookup(name: 'web').id,
  19. ],
  20. },
  21. 'article.sender_id' => {
  22. 'operator' => 'is',
  23. 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
  24. },
  25. },
  26. perform: {
  27. 'notification.email' => {
  28. 'body' => '<div>Your request <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
  29. <br/>
  30. <div>To provide additional information, please reply to this email or click on the following link (for initial login, please request a new password):
  31. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  32. </div>
  33. <br/>
  34. <div>Your #{config.product_name} Team</div>
  35. <br/>
  36. <div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
  37. 'recipient' => 'article_last_sender',
  38. 'subject' => 'Thanks for your inquiry (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  39. },
  40. },
  41. active: true,
  42. created_by_id: 1,
  43. updated_by_id: 1,
  44. )
  45. Trigger.create_or_update(
  46. name: 'auto reply (on follow-up of tickets)',
  47. condition: {
  48. 'ticket.action' => {
  49. 'operator' => 'is',
  50. 'value' => 'update',
  51. },
  52. 'article.sender_id' => {
  53. 'operator' => 'is',
  54. 'value' => Ticket::Article::Sender.lookup(name: 'Customer').id,
  55. },
  56. 'article.type_id' => {
  57. 'operator' => 'is',
  58. 'value' => [
  59. Ticket::Article::Type.lookup(name: 'email').id,
  60. Ticket::Article::Type.lookup(name: 'phone').id,
  61. Ticket::Article::Type.lookup(name: 'web').id,
  62. ],
  63. },
  64. },
  65. perform: {
  66. 'notification.email' => {
  67. 'body' => '<div>Your follow-up for <b>(#{config.ticket_hook}#{ticket.number})</b> has been received and will be reviewed by our support staff.</div>
  68. <br/>
  69. <div>To provide additional information, please reply to this email or click on the following link:
  70. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  71. </div>
  72. <br/>
  73. <div>Your #{config.product_name} Team</div>
  74. <br/>
  75. <div><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></div>',
  76. 'recipient' => 'article_last_sender',
  77. 'subject' => 'Thanks for your follow-up (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  78. },
  79. },
  80. active: false,
  81. created_by_id: 1,
  82. updated_by_id: 1,
  83. )
  84. Trigger.create_or_update(
  85. name: 'customer notification (on owner change)',
  86. condition: {
  87. 'ticket.owner_id' => {
  88. 'operator' => 'has changed',
  89. 'pre_condition' => 'current_user.id',
  90. 'value' => '',
  91. 'value_completion' => '',
  92. }
  93. },
  94. perform: {
  95. 'notification.email' => {
  96. 'body' => '<p>The owner of ticket (Ticket##{ticket.number}) has changed and is now "#{ticket.owner.firstname} #{ticket.owner.lastname}".<p>
  97. <br/>
  98. <p>To provide additional information, please reply to this email or click on the following link:
  99. <a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}</a>
  100. </p>
  101. <br/>
  102. <p><i><a href="https://zammad.com">Zammad</a>, your customer support system</i></p>',
  103. 'recipient' => 'ticket_customer',
  104. 'subject' => 'Owner has changed (#{ticket.title})', # rubocop:disable Lint/InterpolationCheck
  105. },
  106. },
  107. active: false,
  108. created_by_id: 1,
  109. updated_by_id: 1,
  110. )