Merge pull request #4162 from okriuchykhin/ok_SCI_6907

Fix repository export with enabled stock management [SCI-6907]
This commit is contained in:
Alex Kriuchykhin 2022-06-13 10:14:53 +02:00 committed by GitHub
commit 49f05f3df9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,15 +31,15 @@ module RepositoryZipExport
zip = ZipExport.create(user: current_user)
zip.generate_exportable_zip(
current_user,
to_csv(rows, params[:header_ids], current_user, repository),
to_csv(rows, params[:header_ids], current_user, repository, nil, params[:my_module_id].present?),
:repositories
)
end
def self.to_csv(rows, column_ids, user, repository, handle_file_name_func = nil)
def self.to_csv(rows, column_ids, user, repository, handle_file_name_func = nil, in_module = false)
# Parse column names
csv_header = []
add_consumption = !repository.is_a?(RepositorySnapshot) && repository.has_stock_management?
add_consumption = in_module && !repository.is_a?(RepositorySnapshot) && repository.has_stock_management?
column_ids.each do |c_id|
csv_header << case c_id.to_i
when -1, -2