diff --git a/app/services/storage_locations/import_service.rb b/app/services/storage_locations/import_service.rb index 74f55c883..70bcb6ab0 100644 --- a/app/services/storage_locations/import_service.rb +++ b/app/services/storage_locations/import_service.rb @@ -15,7 +15,7 @@ module StorageLocations end def import_items - @rows = SpreadsheetParser.spreadsheet_enumerator(@sheet).reject { |r| r.all?(&:blank?) } + @rows = SpreadsheetParser.spreadsheet_enumerator(@sheet).to_a # Check if the file has proper headers header = SpreadsheetParser.parse_row(@rows[0], @sheet) @@ -73,6 +73,8 @@ module StorageLocations repository_row_id: (row[1].to_s.gsub('IT', '') if row[1].present?) } end + + @rows.reject! { |r| r[:repository_row_id].blank? && r[:position].blank? } end def import_row!(row) diff --git a/config/locales/en.yml b/config/locales/en.yml index 8fbd20bce..780dbbe20 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2709,7 +2709,7 @@ en: import_modal: import_button: 'Import items' title: "Import items to a box" - description: "Import items to a box allows for assigning items to a box and updating positions within a grid box. First, export the current box data to download a file listing the items already in the box. Then, edit the exported file to add or update the items you want to place in the box. When importing the file, ensure it includes the ‘Position’ and ‘Item ID’ columns for a successful import." + description: "Import items to a box allows for assigning items to a box and updating positions within a grid box. First, export the current box data to download a file listing the items already in the box. Then, edit the exported file to add or update the items you want to place in the box. When importing the file, ensure it includes the ‘Box position’ and ‘Item ID’ columns for a successful import." export: "Export" export_button: "Export current box" import: "Import"