checks_import.rb 639 B

1234567891011121314151617181920
  1. # Copyright (C) 2012-2016 Zammad Foundation, http://zammad-foundation.org/
  2. module ApplicationModel::ChecksImport
  3. extend ActiveSupport::Concern
  4. included do
  5. before_create :check_attributes_protected
  6. end
  7. def check_attributes_protected
  8. import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::StateType', 'Ticket::Priority', 'Group', 'User', 'Role' ]
  9. # do noting, use id as it is
  10. return if !Setting.get('system_init_done')
  11. return if Setting.get('import_mode') && import_class_list.include?(self.class.to_s)
  12. return if !has_attribute?(:id)
  13. self[:id] = nil
  14. true
  15. end
  16. end