2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2016-11-25 16:10:37 +00:00
|
|
|
module Import
|
|
|
|
module OTRS
|
|
|
|
module Helper
|
|
|
|
extend self
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def from_mapping(record)
|
|
|
|
result = {}
|
|
|
|
# use the mapping of the class in which
|
|
|
|
# this module gets extended
|
2017-10-01 12:25:52 +00:00
|
|
|
self.class::MAPPING.each do |key_sym, value|
|
2016-11-25 16:10:37 +00:00
|
|
|
key = key_sym.to_s
|
|
|
|
next if !record.key?(key)
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2016-11-25 16:10:37 +00:00
|
|
|
result[value] = record[key]
|
2017-10-01 12:25:52 +00:00
|
|
|
end
|
2016-11-25 16:10:37 +00:00
|
|
|
result
|
|
|
|
end
|
|
|
|
|
|
|
|
def active?(record)
|
|
|
|
case record['ValidID'].to_s
|
2020-11-12 11:42:44 +00:00
|
|
|
when '3', '2', '0'
|
2016-11-25 16:10:37 +00:00
|
|
|
false
|
|
|
|
else
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|