dropdown.rb 1004 B

123456789101112131415161718192021222324252627282930313233
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Import
  3. module OTRS
  4. class DynamicField
  5. class Dropdown < Import::OTRS::DynamicField
  6. include Import::OTRS::DynamicField::Mixin::HasOptions
  7. def init_callback(dynamic_field)
  8. tree_select = dynamic_field['Config']['TreeView'] == '1'
  9. @attribute_config.merge!(
  10. data_type: tree_select ? 'tree_select' : 'select',
  11. data_option: {
  12. default: '',
  13. multiple: false,
  14. options: option_list(dynamic_field['Config']['PossibleValues'], tree_select),
  15. nulloption: dynamic_field['Config']['PossibleNone'] == '1',
  16. null: true,
  17. translate: dynamic_field['Config']['TranslatableValues'] == '1',
  18. }
  19. )
  20. end
  21. private
  22. def skip?(dynamic_field)
  23. !dynamic_field['Config']['PossibleValues']
  24. end
  25. end
  26. end
  27. end
  28. end