priority_update.rb 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/
  2. module Import
  3. module OTRS
  4. class History
  5. class PriorityUpdate < Import::OTRS::History
  6. def init_callback(history)
  7. data = history['Name']
  8. # "%%3 normal%%3%%5 very high%%5"
  9. from = nil
  10. to = nil
  11. if data =~ %r{%%(.+?)%%(.+?)%%(.+?)%%(.+?)$}
  12. from = $1
  13. from_id = $2
  14. to = $3
  15. to_id = $4
  16. end
  17. @history_attributes = {
  18. id: history['HistoryID'],
  19. o_id: history['TicketID'],
  20. history_type: 'updated',
  21. history_object: 'Ticket',
  22. history_attribute: 'priority',
  23. value_from: from,
  24. value_to: to,
  25. id_from: from_id,
  26. id_to: to_id,
  27. created_at: history['CreateTime'],
  28. created_by_id: history['CreateBy']
  29. }
  30. end
  31. end
  32. end
  33. end
  34. end