move.rb 889 B

123456789101112131415161718192021222324252627282930313233
  1. module Import
  2. module OTRS
  3. class History
  4. class Move < Import::OTRS::History
  5. def init_callback(history)
  6. data = history['Name']
  7. # "%%Queue1%%5%%Postmaster%%1"
  8. from = nil
  9. to = nil
  10. if data =~ /%%(.+?)%%(.+?)%%(.+?)%%(.+?)$/
  11. from = $1
  12. from_id = $2
  13. to = $3
  14. to_id = $4
  15. end
  16. @history_attributes = {
  17. id: history['HistoryID'],
  18. o_id: history['TicketID'],
  19. history_type: 'updated',
  20. history_object: 'Ticket',
  21. history_attribute: 'group',
  22. value_from: from,
  23. value_to: to,
  24. id_from: from_id,
  25. id_to: to_id,
  26. created_at: history['CreateTime'],
  27. created_by_id: history['CreateBy']
  28. }
  29. end
  30. end
  31. end
  32. end
  33. end