From 7270ab17532baebc29e6378df716c0a276582852 Mon Sep 17 00:00:00 2001 From: Niklaus Giger Date: Fri, 22 Nov 2013 22:00:18 +0100 Subject: [PATCH] Support (only) the new swissmedi package format --- lib/oddb2xml/extractor.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/oddb2xml/extractor.rb b/lib/oddb2xml/extractor.rb index 5bb4f31..5f7ceb8 100644 --- a/lib/oddb2xml/extractor.rb +++ b/lib/oddb2xml/extractor.rb @@ -235,13 +235,14 @@ def to_hash # Packungen.xls eht = 12 # :einheit_swissmedic sub = 14 # :substance_swissmedic @sheet.each_with_index do |row, i| - next if (i== 0) - no8 = extract_number(row, i_5).to_s + extract_number(row, i_3, /^\d{3}$/).to_s + next if (i <= 1) + no8 = sprintf('%05d',row[i_5].to_i) + sprintf('%03d',row[i_3].to_i) + prodno = sprintf('%05d',row[i_5].to_i) + row[p_1_2].to_i.to_s unless no8.empty? ean_base12 = "7680#{no8}" data[no8.intern] = { :ean => (ean_base12.ljust(12, '0') + calc_checksum(ean_base12)), - :prodno => row[p_5].to_s + row[p_1_2].to_i.to_s, + :prodno => prodno, :ith_swissmedic => row[ith].to_s, :swissmedic_category => row[cat].to_s, :atc_code => row[atc].to_s,