provides_initial_values.rb 537 B

123456789101112131415161718192021
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module FormUpdater::Concerns::ProvidesInitialValues
  3. extend ActiveSupport::Concern
  4. def resolve
  5. if meta[:initial] && respond_to?(:initial_values)
  6. initial_values.each do |name, value|
  7. next if data[name].present?
  8. # Provide value as part of data payload too, so core workflow can work with it.
  9. data[name] = value
  10. result[name] ||= {}
  11. result[name][:initialValue] = value
  12. end
  13. end
  14. super
  15. end
  16. end