bbmb 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b487ee07c8fd64af7c360241bf8c3c4a9ccb3778
4
- data.tar.gz: a7198aa78b2da4fbf68ed8a9c89793cb5880eac8
3
+ metadata.gz: 2ff9459b32c6df0de3e361c40cab590525be4e23
4
+ data.tar.gz: dca078b97bb5d78f8e0eccf46d9936c3145eb617
5
5
  SHA512:
6
- metadata.gz: 26ab6091e17afc1581e1fec5c4907fdebaf286a846c66cc3aba6bb09fa0af1f96ffa8d7f6bd3ede97b705a07e901281c3bdb5438253f8d774ff37d9765babb90
7
- data.tar.gz: 1c01e22b9cbc39a7cdb6b593d2701c9f81bcc351d8c6955d9e38d6d8d2293f14f400d1155d2092cfefdc70c15ef75d526b829b80a0cf6e2d97e6072234023af3
6
+ metadata.gz: 594ade1264d92c1996750076cfbef881c13679daccad97a8ebd630754521bace73435ffb335d3b9e2558ecf738c616c46fff66c990f1283a24c9b5afba565152
7
+ data.tar.gz: 3a0907bcfd4a9d80096ea3f29f29b3dafb0b53ea23e46b1adab850e41896bdffca6d7573c3eae54c018e8722831907030895edde530b361f433f07667148fea7
@@ -1,3 +1,8 @@
1
+ === 2.3.3 / 25.07.2017
2
+
3
+ * Handle transfer.dat with ISO 8859-1 encoding
4
+ * Create new product if only pharmacode is giving and none exists
5
+
1
6
  === 2.3.2 / 20.06.2017
2
7
 
3
8
  * Use SBSM 1.4.5 and adapt KnownUser
File without changes
@@ -59,23 +59,28 @@ module BBMB
59
59
  end
60
60
  end
61
61
  order = Model::Order.new(customer)
62
- products.each { |info|
63
- if(product = Model::Product.find_by_pcode(info[:pcode]) \
62
+ products.each do |info|
63
+ product = Model::Product.find_by_pcode(info[:pcode]) \
64
64
  || Model::Product.find_by_ean13(info[:ean13]) \
65
- || Model::Product.find_by_article_number(info[:article_number]))
65
+ || Model::Product.find_by_article_number(info[:article_number])
66
+ if info[:pcode] || product
67
+ unless product
68
+ product = Model::Product.new(info[:pcode])
69
+ product.description.de = "pharmacode #{info[:pcode]}"
70
+ product.odba_store
71
+ end
66
72
  order.add(info[:quantity], product)
67
73
  [:article_number, :backorder].each do |key|
68
74
  info.store key, product.send(key)
69
75
  end
70
- info.store :description, product.description.de
76
+
77
+ info.store :description, product.description.de
71
78
  info[:deliverable] = info[:quantity]
72
79
  else
73
80
  info[:deliverable] = 0
74
81
  end
75
- }
76
- infos.each { |key, value|
77
- order.send("#{key}=", value)
78
- }
82
+ end
83
+ infos.each { |key, value| order.send("#{key}=", value) }
79
84
  customer.inject_order(order)
80
85
  if opts[:deliver]
81
86
  @app.send_order order, customer
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- # TransferDat -- bbmb -- 31.10.2002 -- hwyss@ywesee.com
2
+ # TransferDat -- bbmb -- 31.10.2002 -- hwyss@ywesee.com
3
3
 
4
4
  require 'bbmb/model/order'
5
5
 
@@ -7,9 +7,15 @@ module BBMB
7
7
  module Util
8
8
  module TransferDat
9
9
  def TransferDat.parse(io)
10
- io.rewind
11
- data = io.read
12
- data.split(/[\r\n]+/).collect { |line|
10
+ begin
11
+ io.rewind
12
+ data = io.read
13
+ lines = data.split(/[\r\n]+/)
14
+ rescue ArgumentError => error
15
+ raise error unless io.is_a?(File)
16
+ lines = File.open(io, external_encoding: Encoding::ISO_8859_1).read.split(/[\r\n]+/)
17
+ end
18
+ lines.collect { |line|
13
19
  if(parsed = parse_line(line))
14
20
  yield parsed
15
21
  end
@@ -1,3 +1,3 @@
1
1
  module BBMB
2
- VERSION = '2.3.2'
2
+ VERSION = '2.3.3'
3
3
  end
@@ -9,7 +9,7 @@ module BBMB
9
9
  class TestServer < Minitest::Test
10
10
  include FlexMock::TestCase
11
11
  def setup
12
- skip ('This does not yet work with the new rack based')
12
+ # skip ('This does not yet work with the new rack based')
13
13
  require 'bbmb/util/server'
14
14
 
15
15
  super
@@ -43,6 +43,16 @@ class TestTransferDat < Minitest::Test
43
43
  end
44
44
  assert_equal(2, count)
45
45
  end
46
+ def test_parse_iso_8859
47
+ data_dir = File.expand_path(File.join(__FILE__, '../../data'))
48
+ src = File.open(File.join(data_dir, 'transfer_leima_iso_8859-1.dat'))
49
+ count = 0
50
+ TransferDat.parse(src) do |info|
51
+ assert_instance_of(Model::Order::Info, info)
52
+ count += 1
53
+ end
54
+ assert_equal(92, count)
55
+ end
46
56
  end
47
57
  end
48
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbmb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.2
4
+ version: 2.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-20 00:00:00.000000000 Z
11
+ date: 2017-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: odba
@@ -426,6 +426,7 @@ files:
426
426
  - lib/bbmb/util/updater.rb
427
427
  - lib/bbmb/version.rb
428
428
  - readme.md
429
+ - test/data/transfer_leima_iso_8859-1.dat
429
430
  - test/data/ydim.yml
430
431
  - test/examples/sandoz.xundart@bbmb.ch.20110524001038.928592
431
432
  - test/examples/simple_email.txt
@@ -470,6 +471,7 @@ signing_key:
470
471
  specification_version: 4
471
472
  summary: browser based orders of medical drugs
472
473
  test_files:
474
+ - test/data/transfer_leima_iso_8859-1.dat
473
475
  - test/data/ydim.yml
474
476
  - test/examples/sandoz.xundart@bbmb.ch.20110524001038.928592
475
477
  - test/examples/simple_email.txt