date.rb 753 B

123456789101112131415161718192021222324
  1. # this require is required (hehe) because of Rails autoloading
  2. # which causes strange behavior not inheriting correctly
  3. # from Import::OTRS::DynamicField
  4. require_dependency 'import/otrs/dynamic_field'
  5. module Import
  6. module OTRS
  7. class DynamicField
  8. class Date < Import::OTRS::DynamicField
  9. def init_callback(dynamic_field)
  10. @attribute_config.merge!(
  11. data_type: 'date',
  12. data_option: {
  13. future: dynamic_field['Config']['YearsInFuture'] != '0',
  14. past: dynamic_field['Config']['YearsInPast'] != '0',
  15. diff: dynamic_field['Config']['DefaultValue'].to_i / 60 / 60 / 24,
  16. null: true,
  17. }
  18. )
  19. end
  20. end
  21. end
  22. end
  23. end