assets.rb 509 B

1234567891011121314151617181920212223
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Checklist::Item
  3. module Assets
  4. extend ActiveSupport::Concern
  5. def assets(data)
  6. app_model = self.class.to_app_model
  7. if !data[ app_model ]
  8. data[ app_model ] = {}
  9. end
  10. return data if data[ app_model ][ id ]
  11. data[ app_model ][ id ] = attributes_with_association_ids
  12. ticket&.assets(data) if ticket&.authorized_asset?
  13. checklist.assets(data)
  14. data
  15. end
  16. end
  17. end