oddb2xml 1.4.9 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ === 1.5.0 / 08.06.2013
2
+
3
+ * Fix NINCD and NonPharma products report
4
+
1
5
  === 1.4.9 / 07.06.2013
2
6
 
3
7
  * Update NINCD for oddb_article.xml
@@ -665,12 +665,14 @@ module Oddb2xml
665
665
  #xml.ARTLIM {
666
666
  # xml.LIMCD
667
667
  #}
668
+ seq = @items[de_idx[:pharmacode]]
668
669
  nincd = if @lppvs[de_idx[:ean]] # LPPV
669
670
  20
670
- elsif de_idx[:migel] # MiGel
671
- 13
672
- elsif no8 # BAG-XML (SL/LS)
671
+ elsif seq # BAG-XML (SL/LS)
673
672
  10
673
+ elsif (de_idx[:migel] or # MiGel (xls)
674
+ de_idx[:_type] == :nonpharma) # MiGel (swissindex)
675
+ 13
674
676
  else
675
677
  nil
676
678
  end
@@ -289,10 +289,16 @@ module Oddb2xml
289
289
  LANGUAGES.each do |lang|
290
290
  lines << lang
291
291
  types.each do |type|
292
- key = (type == :nonpharma ? 'NonPharma' : 'Pharma')
293
292
  if @index[lang][type]
294
- lines << sprintf(
295
- "\t#{key} products: %i", @index[lang][type].values.length)
293
+ indices = @index[lang][type].values.flatten.length
294
+ if type == :nonpharma
295
+ migel_xls = @migel.values.compact.select{|m| !m[:pharmacode].empty? }.map{|m| m[:pharmacode] }
296
+ nonpharmas = @index[lang][type].keys
297
+ indices += (migel_xls - nonpharmas).length # ignore duplicates, null
298
+ lines << sprintf("\tNonPharma products: %i", indices)
299
+ else
300
+ lines << sprintf("\tPharma products: %i", indices)
301
+ end
296
302
  end
297
303
  end
298
304
  end
@@ -161,6 +161,7 @@ module Oddb2xml
161
161
  doc.remove_namespaces!
162
162
  doc.xpath("//Envelope/Body/#{@type}/ITEM").each do |pac|
163
163
  item = {}
164
+ item[:_type] = @type.downcase.intern
164
165
  item[:ean] = (gtin = pac.at_xpath('.//GTIN')) ? gtin.text : ''
165
166
  item[:pharmacode] = (phar = pac.at_xpath('.//PHAR')) ? phar.text : ''
166
167
  item[:status] = (stat = pac.at_xpath('.//STATUS')) ? stat.text : ''
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "1.4.9"
2
+ VERSION = "1.5.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oddb2xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.9
4
+ version: 1.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: