oddb2xml 1.9.3 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWZjMWMxOTA4NzhhZTVjYmFjOTk5Nzg4NGFkYjk0ZjkzMmFhN2IyNg==
4
+ Njk4OTQyNjMxODA2YTY1Yzk5MjU5ZDRkZDM2NzAwYWUyMGVkNWM4Yw==
5
5
  data.tar.gz: !binary |-
6
- YjNjMTFkMjQ0YmRhNTFiMDg0ZTczNjlmYmZkN2UzYjQxMjQyYjcxNg==
6
+ NTU0N2NjMWViNmRlMDNjYjI5NDMzMmUwMDgyMmExZGFmN2Q0MmE3OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDliYjgzZWUzNGYwZGJhNjgxMTBlYTg2YzdkOTUyODlkNjQ3MGViMjFjY2Vi
10
- OWRiMTU0Yjk3MDVlNDNhM2QzODk5N2E4YzM4ZDgyMmEwZjg1NmM0ZTlmZDNk
11
- NDlmZTFkZTlkMWVhYjk0NjVhMjI1M2U3ZDgyZWM1OTI1ZmYwOWY=
9
+ YmUwZDVjYWU3NGNkN2I3ZGMzZDg1MTNiZTYxYTAwMTZkNDdhNjQ5YzdjOTYx
10
+ YTlmZWZjZWE4MzczN2YzMTM2MDIzYjNhMjI4MWUzNGM2M2MxMGE2ZmUzMWFh
11
+ NjI0NDkwMjM1MmNkYjc3N2FmZjA4OTFiOWRjNmViYzdjY2NmYTk=
12
12
  data.tar.gz: !binary |-
13
- N2YyZmIzNjQ0MjQ1NzIxNTI4NzUxZDZlZmVhMzUwNjE0M2JmNTdlZDlmYTA4
14
- NWY0NzU2YzM5OGRjZmU2MWQ0ZmQzYTA5YjBjZjk4MWJiNmJhOTJkZjExOThk
15
- YzNkZTQ0OGNkYTY3MDRiZGE0OWNiYjJmMzZlZjU2ZmEwMTc5MDM=
13
+ OWFhYTNiODdiMmI2Yzk4MDA1YTRiMjg0NDUzYzZkMWI0MWM0NDVjZTQyMThk
14
+ YjI5NjI2ZTM5NjcwYWZkY2U3ZjA0MmFkODgyYTM1OWNkMGQzN2JlYjE0MjIz
15
+ MDY3NmY5NDJmOGFjMGVkZWM0ODUyMDc2ODEwOTRlMDU5YTc0NTQ=
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oddb2xml (1.9.2)
4
+ oddb2xml (1.9.3)
5
5
  archive-tar-minitar (~> 0.5.2)
6
6
  mechanize (~> 2.5.1)
7
7
  nokogiri (~> 1.5.10)
@@ -1,7 +1,15 @@
1
+ === 1.9.4 /21.01.2015
2
+
3
+ * Create additional field resellerpub in oddb_article.xml
4
+ * Adapted xsd for this change
5
+ * Adapted -h message
6
+
1
7
  === 1.9.3 / 19.01.2015
8
+
2
9
  * Fixed missing DSCRD/DSCF in oddb_product.xml because BAG-Preparation.xml ships without Pharmacode now
3
10
 
4
11
  === 1.9.2 / 19.01.2015
12
+
5
13
  * Niklaus did not run all necesary tests!
6
14
  * Fixed bin/oddbxml
7
15
 
@@ -734,18 +734,23 @@ module Oddb2xml
734
734
  end
735
735
  end
736
736
  if info_zur_rose
737
+ price = info_zur_rose[:price]
738
+ vdat = Time.parse(datetime).strftime("%d.%m.%Y")
737
739
  xml.ARTPRI {
738
- xml.VDAT Time.parse(datetime).strftime("%d.%m.%Y")
740
+ xml.VDAT vdat
739
741
  xml.PTYP "ZURROSE"
740
- price = info_zur_rose[:price]
741
- price = (price.to_f*(1 + (@options[:percent].to_f/100))).round_by(0.05).round(2) if @options[:percent] != nil
742
742
  xml.PRICE price
743
743
  }
744
744
  xml.ARTPRI {
745
- xml.VDAT Time.parse(datetime).strftime("%d.%m.%Y")
745
+ xml.VDAT vdat
746
746
  xml.PTYP "ZURROSEPUB"
747
747
  xml.PRICE info_zur_rose[:pub_price]
748
748
  }
749
+ xml.ARTPRI {
750
+ xml.VDAT vdat
751
+ xml.PTYP "RESELLERPUB"
752
+ xml.PRICE (price.to_f*(1 + (@options[:percent].to_f/100))).round_by(0.05).round(2)
753
+ } if @options[:percent] != nil
749
754
  end
750
755
  #xml.ARTMIG {
751
756
  #xml.VDAT
@@ -1031,19 +1036,18 @@ module Oddb2xml
1031
1036
  (pac ? pac[:name_de].to_s : '') +
1032
1037
  (idx[:additional_desc] ? idx[:additional_desc] : '')
1033
1038
  ).gsub(/"/, '')
1034
- price_doctor = pac ? format_price(pac[:prices][:exf_price][:price]).to_s : nil
1035
- price_public = pac ? format_price(pac[:prices][:pub_price][:price]).to_s : nil
1036
1039
  if @infos_zur_rose[ean]
1037
- price_public ||= sprintf('%06i', ((@infos_zur_rose[ean][:pub_price].to_f)*100).to_i)
1038
- if @infos_zur_rose[ean][:pub_price]
1039
- price_doctor ||= sprintf('%06i', ((@infos_zur_rose[ean][:price].to_f)*100).to_i) if @infos_zur_rose[ean][:price]
1040
- if @options[:percent] != nil
1041
- price_doctor = sprintf('%06i', (price_doctor.to_f*(1 + (@options[:percent].to_f/100))).round_by(0.05).round(2))
1042
- end
1040
+ price_exf = sprintf('%06i', ((@infos_zur_rose[ean][:price].to_f)*100).to_i)
1041
+ price_public = sprintf('%06i', ((@infos_zur_rose[ean][:pub_price].to_f)*100).to_i)
1042
+ if @options[:percent] != nil
1043
+ price_public = sprintf('%06i', (price_exf.to_f*(1 + (@options[:percent].to_f/100))).round_by(0.05).round(2))
1043
1044
  end
1045
+ elsif pac and pac[:prices]
1046
+ price_exf = sprintf('%06i', (pac[:prices][:exf_price][:price].to_f*100).to_i) if pac[:prices][:exf_price] and pac[:prices][:exf_price][:price]
1047
+ price_public = sprintf('%06i', (pac[:prices][:pub_price][:price].to_f*100).to_i) if pac[:prices][:pub_price] and pac[:prices][:pub_price][:price]
1044
1048
  end
1045
1049
  row << format_name(abez)
1046
- row << "%#{DAT_LEN[:PRMO]}s" % (price_doctor ? price_doctor.to_s : ('0' * DAT_LEN[:PRMO]))
1050
+ row << "%#{DAT_LEN[:PRMO]}s" % (price_exf ? price_exf.to_s : ('0' * DAT_LEN[:PRMO]))
1047
1051
  row << "%#{DAT_LEN[:PRPU]}s" % (price_public ? price_public.to_s : ('0' * DAT_LEN[:PRPU]))
1048
1052
  row << "%#{DAT_LEN[:CKZL]}s" % if (@lppvs[ean])
1049
1053
  '2'
@@ -19,7 +19,7 @@ module Oddb2xml
19
19
  :ean14 => false,
20
20
  :skip_download=> false,
21
21
  :log => false,
22
- :percent => 0,
22
+ :percent => nil,
23
23
  }
24
24
  end
25
25
  def Options.help
@@ -34,6 +34,10 @@ Usage:
34
34
  -f F, --format=F File format F, default is xml. {xml|dat}
35
35
  If F is given, -o option is ignored.
36
36
  -I x, --increment=x Increment price by x percent. Forces -f dat -p zurrose.
37
+ -I x, --increment=x create additional field price_resellerpub as
38
+ price_extfactory incremented by x percent (rounded to the next 0.05 francs)
39
+ in oddb_article.xml. In generated zurrose_transfer.dat PRPU is set to this price
40
+ Forces -f dat -p zurrose.
37
41
  -i, --include Include target option for ean14 for 'dat' format.
38
42
  'xml' format includes always ean14 records.
39
43
  -o, --option Optional fachinfo output.
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "1.9.3"
2
+ VERSION = "1.9.4"
3
3
  end
@@ -252,6 +252,7 @@
252
252
  <xs:enumeration value="PPUB" />
253
253
  <xs:enumeration value="ZURROSE" />
254
254
  <xs:enumeration value="ZURROSEPUB" />
255
+ <xs:enumeration value="RESELLERPUB" />
255
256
  </xs:restriction>
256
257
  </xs:simpleType>
257
258
  </xs:element>
@@ -192,10 +192,12 @@ describe Oddb2xml::Builder do
192
192
  File.exists?(product_filename).should eq true
193
193
  doc = REXML::Document.new File.new(@article_xml)
194
194
  unless /1\.8\.7/.match(RUBY_VERSION)
195
- price_zur_rose = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='ZURROSE']/PRICE").first.text
196
- price_zur_rose.should eq '12.9'
197
195
  price_zur_rose_pub = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='ZURROSEPUB']/PRICE").first.text
198
196
  price_zur_rose_pub.should eq '15.45'
197
+ price_reseller_pub = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='RESELLERPUB']/PRICE").first.text
198
+ price_reseller_pub.should eq '12.9'
199
+ price_zur_rose = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='ZURROSE']/PRICE").first.text
200
+ price_zur_rose.should eq '7.18'
199
201
  end
200
202
  end
201
203
  end
@@ -218,9 +220,11 @@ describe Oddb2xml::Builder do
218
220
  doc = REXML::Document.new File.new(@article_xml)
219
221
  unless /1\.8\.7/.match(RUBY_VERSION)
220
222
  price_zur_rose = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='ZURROSE']/PRICE").first.text
221
- price_zur_rose.should eq '7.2'
223
+ price_zur_rose.should eq '7.18'
222
224
  price_zur_rose_pub = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='ZURROSEPUB']/PRICE").first.text
223
225
  price_zur_rose_pub.should eq '15.45'
226
+ price_reseller_pub = XPath.match( doc, "//ART[DSCRD='SOFRADEX Gtt Auric']/ARTPRI[PTYP='RESELLERPUB']/PRICE")
227
+ price_reseller_pub.size.should eq 0
224
228
  end
225
229
  end
226
230
 
@@ -436,8 +440,9 @@ describe Oddb2xml::Builder do
436
440
  options.parser.parse!('-e -I 80 --skip-download'.split(' '))
437
441
  Oddb2xml::Cli.new(options.opts)
438
442
  end
439
- search_path_rose = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSE']/PRICE"
440
- search_path_pub = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSEPUB']/PRICE"
443
+ search_path_reseller = "//ART[PHAR=0023722]/ARTPRI[PTYP='RESELLERPUB']/PRICE"
444
+ search_path_rose = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSE']/PRICE"
445
+ search_path_pub = "//ART[PHAR=0023722]/ARTPRI[PTYP='ZURROSEPUB']/PRICE"
441
446
  # sl-entries have a PPUB price
442
447
  search_path_desitin = "//ART[SMNO='62069008']/ARTPRI[PTYP='PPUB']/PRICE"
443
448
 
@@ -455,6 +460,7 @@ describe Oddb2xml::Builder do
455
460
  smno = article.elements['SMNO'] ? article.elements['SMNO'].text : 'nil'
456
461
  XPath.match( doc, search_path_rose).size.should eq 1
457
462
  XPath.match( doc, search_path_rose).first.text.should eq '9.85'
463
+ XPath.match( doc, search_path_reseller).size.should eq 0
458
464
  price = 15.20 # This is the zurrose pub price.
459
465
  XPath.match( doc, search_path_pub).first.text.to_f.should eq price
460
466
  XPath.match( doc, search_path_desitin).first.text.should eq '27.8'
@@ -472,43 +478,52 @@ describe Oddb2xml::Builder do
472
478
  refdata = article.elements['REF_DATA'].text
473
479
  smno = article.elements['SMNO'] ? article.elements['SMNO'].text : 'nil'
474
480
  XPath.match( doc, search_path_rose).size.should eq 1
475
- XPath.match( doc, search_path_rose).first.text.should eq '17.75'
481
+ XPath.match( doc, search_path_rose).first.text.should eq '9.85'
476
482
  XPath.match( doc, search_path_pub).first.text
477
483
  XPath.match( doc, search_path_pub).first.text.should eq '15.20'
484
+ XPath.match( doc, search_path_reseller).size.should eq 1
485
+ XPath.match( doc, search_path_reseller).first.text.should eq '17.75'
486
+
478
487
  XPath.match( doc, search_path_desitin).first.text.should eq '27.8'
488
+
479
489
  # sl-entries have a PPUB price, but no ZURROSEPUB, and vice versa
480
490
  XPath.match( doc, "//ART[PHAR=0023722]/ARTPRI[PTYP='PPUB']").size.should eq 0
481
491
  XPath.match( doc, "//ART[SMNO='62069008']/ARTPRI[PTYP='ZURROSEPUB']").size.should eq 0
492
+ XPath.match( doc, "//ART[SMNO='62069008']/ARTPRI[PTYP='RESELLERPUB']").size.should eq 0
482
493
  end
483
494
  end
484
495
 
496
+ # Check IGM-Format
485
497
  def check_article(line, check_prices = false, add_80_percents=0)
486
- name = line[10..59]
487
- ckzl = line[72]
488
- ciks = line[75]
489
- price_doctor = line[60..65].to_i
490
- price_public = line[66..71].to_i
498
+ typ = line[0..1]
499
+ name = line[10..59]
500
+ ckzl = line[72]
501
+ ciks = line[75]
502
+ price_exf = line[60..65].to_i
503
+ price_reseller = line[66..71].to_i
504
+ price_public = line[66..71].to_i
505
+ typ.should eq '11'
491
506
  puts "check_article: #{price_doctor} #{price_public} CKZL is #{ckzl} CIKS is #{ciks} name #{name} " if $VERBOSE
492
507
  return unless check_prices
493
508
  if /11116999473TC/.match(line)
494
- price_doctor.should eq 16455
495
509
  line[60..65].should eq '016455'
510
+ price_exf.should eq 16455
496
511
  ckzl.should eq '1'
497
512
  price_public.should eq 20530 # this is a SL-product. Therefore we may not have a price increase
498
513
  line[66..71].should eq '020530' # the dat format requires leading zeroes and not point
499
514
  end
500
515
  if /1130598003SOFRADEX/.match(line)
501
- price_public.should eq 1545 # this is a non SL-product, but no price increase was requested
502
- line[66..71].should eq '001545' # the dat format requires leading zeroes and not point
503
-
516
+ # 1130598003SOFRADEX Gtt Auric 8 ml 000718001545300B120130076803169501572
504
517
  ckzl.should eq '3'
505
518
  if add_80_percents
506
- price_doctor.should eq 1292 # = 1545*1.8 this is a non SL-product. Therefore we must increase its price as requsted
507
- line[60..65].should eq '001292' # dat format requires leading zeroes and not poin
519
+ price_reseller.should eq 1292 # = 1545*1.8 this is a non SL-product. Therefore we must increase its price as requsted
520
+ line[66..71].should eq '001292' # dat format requires leading zeroes and not poin
508
521
  else
509
- price_doctor.should eq 718 # this is a non SL-product, but no price increase was requested
510
- line[60..65].should eq '000718' # the dat format requires leading zeroes and not point
511
- end
522
+ price_reseller.should eq 718 # this is a non SL-product, but no price increase was requested
523
+ line[66..71].should eq '000718' # the dat format requires leading zeroes and not point
524
+ end if false
525
+ line[60..65].should eq '000718' # the dat format requires leading zeroes and not point
526
+ price_exf.should eq 718 # this is a non SL-product, but no price increase was requested
512
527
  end
513
528
  end
514
529
 
@@ -541,6 +556,7 @@ describe Oddb2xml::Builder do
541
556
  end
542
557
  it 'should contain the corect prices' do
543
558
  res = buildr_capture(:stdout){ cli.run }
559
+ # res = cli.run
544
560
  res.should match(/products/)
545
561
  dat_filename = File.join(Oddb2xml::WorkDir, 'oddb.dat')
546
562
  File.exists?(dat_filename).should eq true
@@ -31,7 +31,7 @@ describe Oddb2xml::Options do
31
31
  :ean14 => false,
32
32
  :skip_download=> false,
33
33
  :log => false,
34
- :percent => 0,
34
+ :percent => nil,
35
35
  }
36
36
  context 'when default_opts' do
37
37
  specify { expect(Oddb2xml::Options.default_opts).to eq Default_opts }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oddb2xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.3
4
+ version: 1.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-19 00:00:00.000000000 Z
11
+ date: 2015-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip