assets.rb 604 B

123456789101112131415161718192021222324252627
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Checklist
  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. if ticket && !ticket.authorized_asset?
  13. data[app_model][id]['ticket_inaccessible'] = true
  14. end
  15. items.each { |elem| elem.assets(data) }
  16. ticket.assets(data)
  17. data
  18. end
  19. end
  20. end