diff --git a/app/models/my_module.rb b/app/models/my_module.rb index 00fbaf71c..177768b14 100644 --- a/app/models/my_module.rb +++ b/app/models/my_module.rb @@ -371,9 +371,13 @@ class MyModule < ApplicationRecord ) end rows.find_each do |row| + row_tags = [] + row_tags << "[#{I18n.t('general.archived')}]" if row.archived + row_tags << "[#{I18n.t('general.output')}]" if row.output? && id == row.my_module_id + row_json = [] row_json << row.code - row_json << (row.archived ? "#{escape_script_tag(row.name)} [#{I18n.t('general.archived')}]" : escape_script_tag(row.name)) + row_json << "#{escape_script_tag(row.name)} #{row_tags.join(' ')}" row_json << I18n.l(row.created_at, format: :full) row_json << escape_script_tag(row.created_by.full_name) if repository.has_stock_management? && repository.has_stock_consumption? @@ -414,7 +418,7 @@ class MyModule < ApplicationRecord end records = repository.assigned_rows(self) - .select(:id, :name, :created_at, :created_by_id, :repository_id, :parent_id, :archived) + .select(:id, :name, :created_at, :created_by_id, :repository_id, :parent_id, :archived, :my_module_id) { headers: headers, rows: records, custom_columns: custom_columns, excluded_columns: excluded_columns } end diff --git a/app/services/reports/docx/repository_helper.rb b/app/services/reports/docx/repository_helper.rb index d8166ca9b..fe7069e5c 100644 --- a/app/services/reports/docx/repository_helper.rb +++ b/app/services/reports/docx/repository_helper.rb @@ -14,7 +14,10 @@ module Reports::Docx::RepositoryHelper row = [] row.push(record.code) unless excluded_columns.include?(-1) unless excluded_columns.include?(-2) - row.push(escape_input(record.archived ? "#{record.name} [#{I18n.t('general.archived')}]" : record.name)) + row_tags = [] + row_tags << "[#{I18n.t('general.archived')}]" if record.archived + row_tags << "[#{I18n.t('general.output')}]" if my_module && record.output? && my_module.id == record.my_module_id + row.push(escape_input("#{record.name} #{row_tags.join(' ')}")) end row.push(I18n.l(record.created_at, format: :full)) unless excluded_columns.include?(-3) row.push(escape_input(record.created_by.full_name)) unless excluded_columns.include?(-4)