13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/active_import/import_excel.rb', line 13
def ()
mappings = @converter.columns
@missing_headers_mandatory = []
= []
found_at_least_one = false
mappings.each_pair do |column_name, mapping|
if [column_name].nil?
if mapping[:mandatory]
@missing_headers_mandatory << column_name
else
<< column_name
end
else
found_at_least_one = true
end
end
if found_at_least_one
.each { |field| puts "Missing optional column #{field.to_s.yellow}" }
@missing_headers_mandatory.each { |field| puts "Missing mandatory column #{field.to_s.red}" }
end
return false unless @missing_headers_mandatory.empty?
true
end
|