Allow synchronising units when uploading
This commit is contained in:
parent
4d1e102f47
commit
c30ec67548
6 changed files with 37 additions and 11 deletions
|
|
@ -138,8 +138,9 @@ class ArticlesController < ApplicationController
|
|||
# Update articles from a spreadsheet
|
||||
def parse_upload
|
||||
uploaded_file = params[:articles]['file']
|
||||
outlist_absent = (params[:articles]['outlist_absent'] == '1')
|
||||
options = {filename: uploaded_file.original_filename, outlist_absent: outlist_absent}
|
||||
options = {filename: uploaded_file.original_filename}
|
||||
options[:outlist_absent] = (params[:articles]['outlist_absent'] == '1')
|
||||
options[:convert_units] = (params[:articles]['convert_units'] == '1')
|
||||
@updated_article_pairs, @outlisted_articles, @new_articles = @supplier.sync_from_file uploaded_file.tempfile, options
|
||||
if @updated_article_pairs.empty? && @outlisted_articles.empty? && @new_articles.empty?
|
||||
redirect_to supplier_articles_path(@supplier), :notice => I18n.t('articles.controller.parse_upload.notice')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue