Run rubocop --fix-layout and remove encoding comments
This commit is contained in:
parent
fa63e6e81d
commit
ea2862fdef
283 changed files with 1164 additions and 1969 deletions
|
|
@ -1,4 +1,3 @@
|
|||
# encoding: utf-8
|
||||
class Supplier < ApplicationRecord
|
||||
include MarkAsDeletedWithName
|
||||
include CustomFields
|
||||
|
|
@ -9,7 +8,7 @@ class Supplier < ApplicationRecord
|
|||
has_many :deliveries
|
||||
has_many :invoices
|
||||
belongs_to :supplier_category
|
||||
belongs_to :shared_supplier, optional: true # for the sharedLists-App
|
||||
belongs_to :shared_supplier, optional: true # for the sharedLists-App
|
||||
|
||||
validates :name, :presence => true, :length => { :in => 4..30 }
|
||||
validates :phone, :presence => true, :length => { :in => 8..25 }
|
||||
|
|
@ -65,7 +64,7 @@ class Supplier < ApplicationRecord
|
|||
.find_each { |new_shared_article| new_articles << new_shared_article.build_new_article(self) }
|
||||
# make them unavailable when desired
|
||||
if shared_sync_method == 'all_unavailable'
|
||||
new_articles.each {|new_article| new_article.availability = false }
|
||||
new_articles.each { |new_article| new_article.availability = false }
|
||||
end
|
||||
end
|
||||
return [updated_article_pairs, outlisted_articles, new_articles]
|
||||
|
|
@ -77,7 +76,7 @@ class Supplier < ApplicationRecord
|
|||
# @param options [Hash] Options passed to {FoodsoftFile#parse} except when listed here.
|
||||
# @option options [Boolean] :outlist_absent Set to +true+ to remove articles not in spreadsheet.
|
||||
# @option options [Boolean] :convert_units Omit or set to +true+ to keep current units, recomputing unit quantity and price.
|
||||
def sync_from_file(file, options={})
|
||||
def sync_from_file(file, options = {})
|
||||
all_order_numbers = []
|
||||
updated_article_pairs, outlisted_articles, new_articles = [], [], []
|
||||
FoodsoftFile::parse file, options do |status, new_attrs, line|
|
||||
|
|
@ -108,7 +107,7 @@ class Supplier < ApplicationRecord
|
|||
all_order_numbers << article.order_number if article
|
||||
end
|
||||
if options[:outlist_absent]
|
||||
outlisted_articles += articles.undeleted.where.not(order_number: all_order_numbers+[nil])
|
||||
outlisted_articles += articles.undeleted.where.not(order_number: all_order_numbers + [nil])
|
||||
end
|
||||
return [updated_article_pairs, outlisted_articles, new_articles]
|
||||
end
|
||||
|
|
@ -116,6 +115,7 @@ class Supplier < ApplicationRecord
|
|||
# default value
|
||||
def shared_sync_method
|
||||
return unless shared_supplier
|
||||
|
||||
self[:shared_sync_method] || 'import'
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue