2017-01-31 17:13:45 +00:00
|
|
|
# Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
|
2017-05-02 15:21:13 +00:00
|
|
|
module ApplicationModel::ChecksImport
|
2017-01-31 17:13:45 +00:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
included do
|
|
|
|
before_create :check_attributes_protected
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_attributes_protected
|
|
|
|
|
|
|
|
import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::StateType', 'Ticket::Priority', 'Group', 'User', 'Role' ]
|
|
|
|
|
|
|
|
# do noting, use id as it is
|
|
|
|
return if !Setting.get('system_init_done')
|
|
|
|
return if Setting.get('import_mode') && import_class_list.include?(self.class.to_s)
|
2017-06-16 20:43:09 +00:00
|
|
|
return if !has_attribute?(:id)
|
2018-10-09 06:17:41 +00:00
|
|
|
|
2017-01-31 17:13:45 +00:00
|
|
|
self[:id] = nil
|
2017-06-16 22:53:20 +00:00
|
|
|
true
|
2017-01-31 17:13:45 +00:00
|
|
|
end
|
|
|
|
end
|