Folgende Tests habe ich selber mit manuell klicken ausprobiert und sie funktionieren.
ODBA::Stub was unable to replace #269599 from BBMB::Model::Customer:#2617 NoMethodError: undefined method `calculate_effective_prices' for nil:NilClass /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:112:in `method_missing' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.4/lib/bbmb/html/state/current_order.rb:21:in `init' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:223:in `block in process_rack' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:207:in `synchronize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:207:in `process_rack' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/app.rb:119:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:49:in `_call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:37:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/show_exceptions.rb:23:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/content_length.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/static.rb:149:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/common_logger.rb:33:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/tempfile_reaper.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:49:in `_call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:37:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/show_exceptions.rb:23:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/common_logger.rb:33:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/chunked.rb:54:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/content_length.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/handler/webrick.rb:86:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread' 172.25.1.75 - - [16/May/2017:08:18:12 +0200] "POST /de/bbmb HTTP/1.1" 500 77607 0.0467
produced the following backtrace
172.25.1.75 - - [16/May/2017:08:11:28 +0200] "GET /resources/bbmb/logo.gif HTTP/1.1" 200 1263 0.0014 ODBA::Stub was unable to replace BBMB::Model::Order::Position#269595 from Array:#269468 /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:157: warning: Hash#index is deprecated; use Hash#key NoMethodError: undefined method `quantity' for nil:NilClass /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:112:in `method_missing' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.4/lib/bbmb/model/order.rb:124:in `block in item_count' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.4/lib/bbmb/model/order.rb:124:in `each' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.4/lib/bbmb/model/order.rb:124:in `inject' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/bbmb-2.1.4/lib/bbmb/model/order.rb:124:in `item_count' (eval):2:in `send' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/value.rb:33:in `init' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/namedcomponent.rb:34:in `initialize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:87:in `new' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:87:in `create' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:67:in `block in compose_list' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `each_with_index' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:65:in `compose_list' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:54:in `compose' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:129:in `init' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/template.rb:67:in `new' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/template.rb:67:in `__standard_component' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/template.rb:54:in `content' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:145:in `create' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/divcomposite.rb:33:in `block in compose' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/divcomposite.rb:15:in `each' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/divcomposite.rb:15:in `compose' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/state.rb:240:in `new' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/state.rb:240:in `view' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/state.rb:173:in `to_html' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:478:in `to_html' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:238:in `block in process_rack' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:207:in `synchronize' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/session.rb:207:in `process_rack' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/sbsm-1.3.8/lib/sbsm/app.rb:119:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:49:in `_call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:37:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/show_exceptions.rb:23:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/content_length.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/static.rb:149:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/common_logger.rb:33:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/tempfile_reaper.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:49:in `_call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/lint.rb:37:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/show_exceptions.rb:23:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/common_logger.rb:33:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/chunked.rb:54:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/content_length.rb:15:in `call' /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/rack-2.0.2/lib/rack/handler/webrick.rb:86:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run' /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
Folgende Tests laufen um 8:20 nicht.
Folgende Tests habe ich noch nicht durchgeführt:
Trying to debug the error when displaying the Umsatz for 708427
[1] pry(#<BBMB::Model::Order>)> error => #<NoMethodError: undefined method `quantity' for nil:NilClass> [2] pry(#<BBMB::Model::Order>)> @positions.size => 4 [3] pry(#<BBMB::Model::Order>)> @positions ODBA::Stub was unable to replace BBMB::Model::Order::Position#269595 from Array:#269468 ODBA::Stub was unable to replace BBMB::Model::Order::Position#269594 from Array:#269468 ODBA::Stub was unable to replace BBMB::Model::Order::Position#269596 from Array:#269468 ODBA::Stub was unable to replace BBMB::Model::Order::Position#269597 from Array:#269468 => [nil, nil, nil, nil] [9] pry(#<BBMB::Model::Order>)> ODBA.cache.fetch(269595) ODBA::OdbaError: Unknown odba_id 269595 from /var/www/virbac_rack.bbmb.ch/vendor/bundle/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:639:in `restore_object'
But fixing this error just goes a little bit farther, because the position itself is no longer valid. Should I replace it with an empty position?
Pushed commit Added some more manual tests
Reloaded the database again. Manual tests for displaying customer 708427 Umsatz and numerical total were successfull. Running bin/update_abschluss_artikel_artikel_fr_kunden. It finished without problems. Looking at 708427 I was able to see the umsatz by article and the orders, where the order/order_id/708427-162 did not have any items.
The following tasks are completed:
Pending
sudo -u bbmb /usr/local/bin/bundle-240 exec rackup
. This leads to problem, as it cannot create a log directory Permission denied @ rb_sysopen - /var/www/virbac.bbmb.ch/log/2017/05/16/app_log
. The directory /var/www/virbac.bbmb.ch/log/2017/05/16 belongs to the root user. This must be fixed by changing the CustomLog in the apache config to use also the bbmb user. E.g. replace |CustomLog
by |sudo -u bbmb /usr/sbin/cronolog
sudo -u bbmb /usr/local/bin/bundle-240 exec rackup
starts successfully
Folgende Tests habe ich selber mit manuell klicken auf virbac.bbmb.ch ausprobiert und sie funktionieren.
Pushed commit Fix sorting customers by last_login
Found also that SBSM.warn was used inside lib/sbsm/state.rb but not implmented anywhere. Fixed with commit Fixed and tested SBSM.warn and SBSM.error
Added some debug statements to see whether updater and invoicer start at 12 00. Pushed commits
Result: Updater will start at the specified hours. Invoicer will
start on first day of next month (15 days from now). At the moment there is no easy way to force running the invoicer at an earlier day/hour.
Pushed Bumped version to 2.1.6
As admin user setting the password for a user work. Generating a new one however has the problem that trying to display it start a loop which can be interrupte on firefox, but not on chrome. Must fix this problem.
By placing a binding.pry for POST requests in lib/sbsm/app.rb I was able to see, that the requests for the show_pass were mostly identical, e.g parameter like cookie match). Only some Ruby object-id do not match. Looking at the implementation I find that it is one of the rare view which have the VOLATILE constant set to true. Is this something I do not handle yet correctly in the rack based SBSM?
The state changes. Here some log entries
DEBUG -- : session.rb:373:in `logout' logout "/" setting @state 70204269719000 BBMB::Html::State::Login remember nil SBSM::UnknownUser DEBUG -- : session.rb:217:in `block in process_rack' active_state.trigger state 70204269719000 BBMB::Html::State::Login remember nil DEBUG -- : session.rb:226:in `block in process_rack' Changing from 70204269719000 to state BBMB::Html::State::Login 70204269719000 remember nil SBSM::UnknownUser DEBUG -- : session.rb:217:in `block in process_rack' active_state.trigger state 70204269003620 BBMB::Html::State::Customers remember nil DEBUG -- : session.rb:226:in `block in process_rack' Changing from 70204269719000 to state BBMB::Html::State::Customers 70204269003620 remember nil BBMB::Html::Util::KnownUser "POST /de/bbmb HTTP/1.1" 200 10924 2.1983 session.rb:217:in `block in process_rack' active_state.trigger state 70204194367780 BBMB::Html::State::Customer remember nil session.rb:226:in `block in process_rack' Changing from 70204269003620 to state BBMB::Html::State::Customer 70204194367780 remember nil BBMB::Html::Util::KnownUser session.rb:217:in `block in process_rack' active_state.trigger state 70204194367780 BBMB::Html::State::Customer remember nil session.rb:226:in `block in process_rack' Changing from 70204194367780 to state BBMB::Html::State::Customer 70204194367780 remember nil BBMB::Html::Util::KnownUser "POST /de/bbmb HTTP/1.1" 200 5751 1.7063 session.rb:217:in `block in process_rack' active_state.trigger state 70204281411940 BBMB::Html::State::ShowPass remember nil session.rb:230:in `block in process_rack' Stay in volatile state 70204281411940 BBMB::Html::State::ShowPass session.rb:217:in `block in process_rack' active_state.trigger state 70204194367780 BBMB::Html::State::Customer remember nil session.rb:226:in `block in process_rack' Changing from 70204194367780 to state BBMB::Html::State::Customer 70204194367780 remember nil BBMB::Html::Util::KnownUser "POST /de/bbmb HTTP/1.1" 200 5751 17.2648 session.rb:217:in `block in process_rack' active_state.trigger state 70204279803720 BBMB::Html::State::ShowPass remember nil session.rb:230:in `block in process_rack' Stay in volatile state 70204279803720 BBMB::Html::State::ShowPass session.rb:217:in `block in process_rack' active_state.trigger state 70204194367780 BBMB::Html::State::Customer remember nil session.rb:226:in `block in process_rack' Changing from 70204194367780 to state BBMB::Html::State::Customer 70204194367780 remember nil BBMB::Html::Util::KnownUser "POST /de/bbmb HTTP/1.1" 200 5751 10.9499 session.rb:217:in `block in process_rack' active_state.trigger state 70204277991800 BBMB::Html::State::ShowPass remember nil session.rb:230:in `block in process_rack' Stay in volatile state 702042779
Moved some methods (start_service) for the App class from virbac to bbmb. Now I am able to change the email-address the user 4039, but when trying to change the email-address of the 702329 I get the error => #<Yus::DuplicateNameError: Duplicate name: balber@bluewin.ch>
Pushed commit
When trying to the the (old) e-Mail address for customer 702329 I get the following error message
Ihre Eingaben konnten nicht gespeichert werden da Angaben fehlen oder nicht korrekt sind. Bitte ergänzen Sie die rot gekennzeichneten Felder. Das Benutzerprofil wurde nicht gespeichert! Es gibt bereits ein Benutzerprofil für diese Email-Adresse
I must find a way to work around the database problem. In the pry session it was easy to set the email attribute of the given customer to the name wrongly returned as duplicate entry. After setting the password I was able to login as this user, but the old orders are gone, but I could still see Quotas and over 10 promotions. Looks like the orders were really damaged.
But I think it would be better to see, whether I can get the admin interface working again.
Zeno found another error. Eg. it is easily possible to set the customer 4325 the e-mail address of another customer. This may not happen.
Using the old virbac to try to understand how it worked before. See in a a pry session that in lib/bbmb/util/server.rb @ line the autosession is defined like this.
[2] pry(#<BBMB::Util::Server>)> session2 = BBMB.auth.autosession(BBMB.config.auth_domain) DRb::DRbRemoteError: undefined method `call' for nil:NilClass (NoMethodError) from (druby://127.0.01:12003) /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/yus-1.0.4/lib/yus/server.rb:22:in `autosession'
Looks like we have two implementations to change the email: rename_user in lib/bbmb/html/state/customer.rb @ line 91 and update_user lib/bbmb/util/server.rb @ line 62. This is wrong! Will be fixed tomorrow.