view · edit · sidebar · attach · print · history




  • Setup on oddb-ci2 in clean git repository
  • empty oddb2.csv file in invoice



Keep in Mind for work to do
  • Fix dojo error
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for, too.
  • Use refdatabase for, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views
  • Fix sbsm/htmlgrid when DEFAULT_FLAVOUR is nil

empty oddb2.csv file in invoice

An invoice contained an empty oddb2c.csv file. Why?

Setup on oddb-ci2 in clean git repository

Uninstalled rbenv from oddb-ci2. Changed /service/ to contain

cd /var/www/
exec sudo -u bbmb /usr/local/bin/ruby231  -I/var/www/ -rydim/invoice /usr/local/bin/bbmbd config=/var/www/

to avoid error about the missing git repository.

Verified that the _session_id cookie is present after loading

There are occurrences of 'cookie' in the test directory under /var/www/ But as test/selenium.rb is local copy of Selenium and test/stub/http_server.rb is the stub for the mod_ruby (desribed in the top of the file as "## compatibility-brainfuck for integrating Apache-SBSM-Requests with WEBrick") I must check with other means, whether cookies work or not.

After setting a pry debug at line 156 of /usr/local/lib64/ruby/gems/2.3.0/gems/sbsm-1.2.7/lib/sbsm/request.rb I started manually sudo -u bbmb /usr/local/bin/ruby231 -I/var/www/ -rydim/invoice /usr/local/bin/bbmbd config=/var/www/ After the login I did not fall into the pry debug.

Setting pry breakpoints in lines 11 of /usr/local/lib64/ruby/gems/2.3.0/gems/sbsm-1.2.7/lib/cgi/drbsession.rb.

Last week I started debugging via a pry at line 19 in /usr/local/lib64/ruby/gems/2.3.0/gems/bbmb-2.0.1/lib/bbmb/html/state/login.rb.

Redoing I get

[1] pry(#<BBMB::Html::Util::Session>)> user_input(:email)
=> ""
[2] pry(#<BBMB::Html::Util::Session>)> user_input(:pass)
=> "7289563ea270842e082c08199f07ed81"
[3] pry(#<BBMB::Html::Util::Session>)> next

From: /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.2/lib/bbmb/html/util/session.rb @ line 21 BBMB::Html::Util::Session#login:

    19: def login
    20:   @user = @app.login(user_input(:email), user_input(:pass))
 => 21:   @user.session = self if(@user.respond_to?(:session=))
    22:   @user
    23: end

[3] pry(#<BBMB::Html::Util::Session>)> @user
=> #<BBMB::Html::Util::KnownUser:0x007f55b017c980 @auth_session=#<DRb::DRbObject:0x007f55b0162698 @ref=70036191732660, @uri="druby://localhost:12005">>
[4] pry(#<BBMB::Html::Util::Session>)> @user.respond_to?(:session=)
=> false
[5] pry(#<BBMB::Html::Util::Session>)> continue
D, [2016-06-06T10:21:36.615860 #31577] DEBUG -- User: allowed?(login, ch.bbmb.sandoz.Admin) -> true
D, [2016-06-06T10:21:36.638994 #31577] DEBUG -- User: allowed?(login, ch.bbmb.sandoz.Customer) -> false
D, [2016-06-06T10:21:36.924016 #31577] DEBUG -- State: Customers#init: loaded 1661 customers in 0.28389s

From: /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.2/lib/bbmb/html/state/login.rb @ line 19 BBMB::Html::State::Login#login:
[1] pry(#<BBMB::Html::State::Login>)> step

From: /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.2/lib/bbmb/html/util/session.rb @ line 20 BBMB::Html::Util::Session#login:

    19: def login
 => 20:   @user = @app.login(user_input(:email), user_input(:pass))
[1] pry(#<BBMB::Html::Util::Session>)> @user.respond_to?(:session=)
=> false
[2] pry(#<BBMB::Html::Util::Session>)> self.class
=> BBMB::Html::Util::Session

I suspect that with Ruby 1.8.6 @user hat a method session= and therefore the @user was set to self. Trying to set @user.session = self results in the following error

[3] pry(#<BBMB::Html::Util::Session>)> @user
=> #<BBMB::Html::Util::KnownUser:0x007f55b0cf3f48 @auth_session=#<DRb::DRbObject:0x007f55b0ce5448 @ref=70036191908700, @uri="druby://localhost:12005">>
[4] pry(#<BBMB::Html::Util::Session>)> @user.session = self
NoMethodError: undefined method `session=' for #<Yus::EntitySession:0x7f6524ae2aa0>
from /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.2/lib/bbmb/html/util/known_user.rb:43:in `remote_call'

The error is probably causes by on of the following reasons:

  • Difference between Ruby 1.8.6 and 2.3.0
  • A commit in one of concerned gems while porting from 1.8 to 2.3.0, must check
    • yus
    • bbmb
    • ydim-html
    • ydim
    • sbsm
    • htmlgrid
  • difference in login handling of sandoz.bbmb and ydim.

Installed cookie-inspector. which shows ERR_TO_MANY_REDIRECTS

After replacing most references from CGI to ::CGI in the sbsm files, I could see the cookie bbmb-barcodereader. Here the list of replaced occcurrences:

 grep -rn '::CGI' /usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/cgi/drbsession.rb:7:class ::CGI
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/request.rb:40:    def initialize(drb_uri, html_version = "html4", cgiclass = ::CGI)
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/request.rb:149:        'database_manager'     =>      ::CGI::Session::DRbSession,
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/request.rb:162:                       @session =, args)
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/request.rb:196:                                               (@cgi.params.has_key?("pretty")) ? ::CGI.pretty( res ) : res
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:54:                @@cgi ='html4')
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:210:          ::CGI.parse(::CGI.unescape(cuki_str)).each { |key, val|
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/lookandfeel.rb:77:                    args = args.collect { |value| ::CGI.escape(value.to_s) }
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/cgi.rb:29:class ::CGI
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/cgi.rb:39:              '="' + ::CGI::escapeHTML(value) + '"'
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/trans_handler.rb:71:        values.add(key.to_s, ::CGI.unescape(value.to_s))
/usr/local/lib64/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/trans_handler.rb:86:                                         ::CGI.unescape(pair.value.value.to_s)

ydim-html and bb have different method to establish a connection. Trying, whether I can create a similar setup to ydim-html. For this I have to

  • remove lib/bbmb/html/util/known_user.rb
  • make lib/bbmb/html/util/session.rb similar to lib/ydim/html/util/session.rb
  • leave lib/bbmb/html/util/multilingual.rb as is
  • leave lib/bbmb/html/util/validator as is
  • copy and adapt /lib/ydim/html/util/server.rb to lib/bbmb/html/util/server.rb

Made the adjustments. Now I have problems because I get the following error

In /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/html/state/info.rb:7
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/html/state/info.rb:11:in `<module:State>': uninitialized constant SBSM::Global (NameError)

This stems from the fact that lib/bbmb/html/state/global.rb and lib/ydim/html/state/global.rb implment different methods.

If I move require 'bbmb/html/state/login' to the end of lib/bbmb/html/state/global.rb I can avoid the uninitialized constant SBSM::Global. Looking at the next error about the LOOKANDFEEL. Now it starts up. It does not have the correct lnf and after a login I get undefined method `pagestep' for #<SBSM::UnknownUser:0x00000003426cd0>

Fixed the error with the lookandfeel. Now I am getting the correct login screen again:

But the pagestep error persists. Now I must have look how ydim handles this feature. After adding empty implementations for the following methods for the class SBSM::UnknownUser in lib/bbmb/html/util/known_user.rb

  • pagestep
  • entity_valid?(email)
  • last_login(param)

I could view the list of customers, but they are all of the class UnknownUser. There is still something fundamentally wrong!

Placed a pry debug at /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/html/view/customers.rb @ line 122 BBMB::Html::View::CustomersComposite#customers. And I get

[1] pry(#<BBMB::Html::View::CustomersComposite>)> model.customers.first
=> #<BBMB::Model::Customer:0x000000029568c8
 @address1="Boulevard de P\xC3\xA9rolles 6",
 @archive=#<ODBA::Stub:21672400#139367 @odba_class= @odba_container=21673060#139365>,
 @current_order=#<ODBA::Stub:21672580#139451 @odba_class=BBMB::Model::Order @odba_container=21673060#139365>,
 @favorites=#<ODBA::Stub:21672980#139366 @odba_class=BBMB::Model::Order @odba_container=21673060#139365>,
 @fax="026 321 12 12",
 @organisation="some SA",
 @phone_business="026 012345",
 @quotas=#<ODBA::Stub:21672280#139368 @odba_class= @odba_container=21673060#139365>,

Setting a pry debug statement into /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/util/server.rb:73 (login). This goes to /usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.3/lib/bbmb/html/state/login.rb:19 and calls trigger(:home)

But I still have no idea why while processing the request the user is a SBSM::UnkownUser.

List of customers appears now. Discovered that lib/bbmb/html/util/server.rb is not needed. Used the following patch. See Attach:0001-List-of-customers-is-displayed-now.patch.txt

But it does not work correctly, eg. navigation to does not sort by login.

Removing and reinstalling sbsm-1.2.3 to see whether the changes to ::CGI are required or not. No. It is not needed, neither are the monkey methods for SBSM::UnknownUser.

Todo for tomorrow:

  • are the following changes correct in
    • include SBSM::Redirector (removed)
    • EXPIRES (removed)
    • invoices (addded)
    • validate (removed)
    • method_missing (added)


view · edit · sidebar · attach · print · history
Page last modified on June 07, 2016, at 08:07 AM