mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-11 06:35:58 +08:00
Add relationship columns to inventory exports [SCI-9673] (#6634)
This commit is contained in:
parent
29f43d42af
commit
f80046418a
2 changed files with 16 additions and 0 deletions
|
|
@ -23,6 +23,8 @@ module RepositoryZipExport
|
||||||
I18n.t('repositories.table.archived_by')
|
I18n.t('repositories.table.archived_by')
|
||||||
when -8
|
when -8
|
||||||
I18n.t('repositories.table.archived_on')
|
I18n.t('repositories.table.archived_on')
|
||||||
|
when 'relationship'
|
||||||
|
next
|
||||||
else
|
else
|
||||||
column = repository.repository_columns.find_by(id: c_id)
|
column = repository.repository_columns.find_by(id: c_id)
|
||||||
column ? column.name : nil
|
column ? column.name : nil
|
||||||
|
|
@ -30,6 +32,11 @@ module RepositoryZipExport
|
||||||
end
|
end
|
||||||
csv_header << I18n.t('repositories.table.row_consumption') if add_consumption
|
csv_header << I18n.t('repositories.table.row_consumption') if add_consumption
|
||||||
|
|
||||||
|
if column_ids.include? 'relationship'
|
||||||
|
csv_header << I18n.t('repositories.table.parents')
|
||||||
|
csv_header << I18n.t('repositories.table.children')
|
||||||
|
end
|
||||||
|
|
||||||
CSV.generate do |csv|
|
CSV.generate do |csv|
|
||||||
csv << csv_header
|
csv << csv_header
|
||||||
rows.each do |row|
|
rows.each do |row|
|
||||||
|
|
@ -50,6 +57,8 @@ module RepositoryZipExport
|
||||||
row.archived? && row.archived_by.present? ? row.archived_by.full_name : ''
|
row.archived? && row.archived_by.present? ? row.archived_by.full_name : ''
|
||||||
when -8
|
when -8
|
||||||
row.archived? && row.archived_on.present? ? I18n.l(row.archived_on, format: :full) : ''
|
row.archived? && row.archived_on.present? ? I18n.l(row.archived_on, format: :full) : ''
|
||||||
|
when 'relationship'
|
||||||
|
next
|
||||||
else
|
else
|
||||||
cell = row.repository_cells.find_by(repository_column_id: c_id)
|
cell = row.repository_cells.find_by(repository_column_id: c_id)
|
||||||
|
|
||||||
|
|
@ -66,6 +75,11 @@ module RepositoryZipExport
|
||||||
end
|
end
|
||||||
|
|
||||||
csv_row << row.row_consumption(row.stock_consumption) if add_consumption
|
csv_row << row.row_consumption(row.stock_consumption) if add_consumption
|
||||||
|
if column_ids.include? 'relationship'
|
||||||
|
csv_row << "\"#{row.parent_repository_rows.map(&:code).join("\;\s")}\""
|
||||||
|
csv_row << "\"#{row.child_repository_rows.map(&:code).join("\;\s")}\""
|
||||||
|
end
|
||||||
|
|
||||||
csv << csv_row
|
csv << csv_row
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2053,6 +2053,8 @@ en:
|
||||||
archived_on: "Archived on"
|
archived_on: "Archived on"
|
||||||
archived_by: "Archived by"
|
archived_by: "Archived by"
|
||||||
relationship: "Relationship"
|
relationship: "Relationship"
|
||||||
|
children: "Children"
|
||||||
|
parents: "Parents"
|
||||||
row_consumption: "Consumed"
|
row_consumption: "Consumed"
|
||||||
enter_row_name: "Enter name"
|
enter_row_name: "Enter name"
|
||||||
locked_item: "This is read-only item."
|
locked_item: "This is read-only item."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue