view · edit · sidebar · attach · print · history

< Niklaus.20170516-virbac | Index | Niklaus.20170510-virbac-rack-importer >>

0170515-virbac-yus

Summary

  • Fix remaining problems (importer) in new rack based virbac
  • Keep in Mind

Commits

Index

Fix remaining problems (importer) in new rack based virbac

Must fix the the error seen last wednesday virbac_admin shows

ch.bbmb.virbac> BBMB::Model::Customer.find_by_email('claude.meier@gmx.net').class
-> NilClass
ch.bbmb.virbac> BBMB::Model::Customer.odba_extent.find{|x| x.email.eql?('claude.meier@gmx.net')}.class
-> NilClass

Somehow my changes for the _admin interface broke the connections. Suspects are:

  • variable @persistenc in VIRBAC::App
  • Why we have a nil @model in bbmb/lib/bbmb/html/state/current_order.rb @ line 21 BBMB::Html::State::CurrentOrder#init?

Debugging the login method in lib/bbmb/html/state/login.rb showed that it returned as session @session=BBMB::Persistence::ODBA whereas with the Rack-based it returns a session of BBMB::Html::Util::Session:0x00556d320b89d0.

Tracking it down that in /usr/local/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/sbsm-1.3.0/lib/sbsm/state.rb @ line 196 SBSM::State#trigger: the self.default.class is a BBMB::Html::State::Login, which contains @session=BBMB::Persistence::ODBA attribute.

Reverted my last SBSM commit 8955bd9f57fdd5406009a5e71e94146dc572f885 "SBSM: Changes needed for rack, viral modules and KnownUser". After that I am able to login as admin user, but not as claude.meier. But this did only work as I had not removed manually lib/sbsm/admin_server.rb. Must undo some changes in BBMB, too.

Tried to rollback my changes in BBMB, too. But here I do not have a commit before I started working on the admin functionality. Therefore it breaks when using the old SBSM without the new admin-functionality. Mus fix now the problem

NoMethodError: undefined method `name' for #<BBMB::Html::Util::KnownUser:0x007fb50991e478>
        /home/niklaus/git/bbmb/lib/bbmb/html/view/head.rb:19:in `logged_in_as'
        /var/www/virbac_rack.bbmb.ch/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:145:in `create'

when logging in as normal user.

Creating a branch virbac_rack in sbsm, bbmb and virbac.bbmb.ch to save my current state. Pushed commits

Running sudo -u bbmb /usr/local/bin/bundle-240 exec bin/update_abschluss_artikel_artikel_fr_kunden config=etc/config.yml fails with

d is /var/www/virbac_rack.bbmb.ch
bundler: failed to load command: bin/update_abschluss_artikel_artikel_fr_kunden (bin/update_abschluss_artikel_artikel_fr_kunden)
NameError: uninitialized constant BBMB::Util::Server
Did you mean?  TCPServer
  /var/www/virbac_rack.bbmb.ch/lib/bbmb/virbac/app.rb:33:in `get_server'
  bin/update_abschluss_artikel_artikel_fr_kunden:28:in `<module:BBMB>'
  bin/update_abschluss_artikel_artikel_fr_kunden:7:in `<top (required)>'

Fixed this problem. Fixed another problem, because in the polling.yml I had placed an absolute path, where BBMB expected a relative path. Now the customers get imported but when sending the email I get an error. Looking customer_id/708427 still gets error NoMethodError at /de/bbmb/customer/customer_id/708427 undefined method `total' for nil:NilClas

Found a work-around. Now it display an empty order like this 26.04.2017 11:22 0 0 Pushed commit Fix calculating turnover when an order is invalid

Testing whether I can change the password of a customer and login with the new password. When trying to login with the new password I get the following backtrace

Was allowed via user #<BBMB::Html::Util::KnownUser:0x007f5d6c651578> for BBMB::Html::State::Viral::Customer
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/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:112:in `method_missing'
        /home/niklaus/git/bbmb/lib/bbmb/html/state/current_order.rb:21:in `init'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:223:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:207:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:207:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'

Why do we try here to fetch the customer 2617, when I changed the password for the customer 708427? Trying to change the email to test@test.xx. This gives the error

NoMethodError: undefined method `rename_user' for nil:NilClass
        /home/niklaus/git/bbmb/lib/bbmb/model/customer.rb:68:in `email='
        /home/niklaus/git/bbmb/lib/bbmb/html/state/customer.rb:92:in `update_user'
        /home/niklaus/git/bbmb/lib/bbmb/html/state/customer.rb:67:in `_save'
        /home/niklaus/git/bbmb/lib/bbmb/html/state/customer.rb:55:in `save'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:197:in `_trigger'
        /home/niklaus/git/sbsm/lib/sbsm/state.rb:186:in `trigger'
        /home/niklaus/git/bbmb/lib/bbmb/html/state/global.rb:58:in `trigger'
        /home/niklaus/git/sbsm/lib/sbsm/viralstate.rb:38:in `trigger'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:216:in `block in process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:207:in `synchronize'
        /home/niklaus/git/sbsm/lib/sbsm/session.rb:207:in `process_rack'
        /home/niklaus/git/sbsm/lib/sbsm/app.rb:119:in `call'

Changing the password as normal user doest not work neither. Looking on how to start the invoicer and the updater. Changed the DRB-Serverport to 12009 from the 12002 found in the virbac/etc/config.yml

Pushed commit Fixed changing password for a logged in user

Folgende Tests habe ich selber mit manuell klicken ausprobiert und sie funktionieren.

  • login as a normal user The home Warenkorb should appear with a least of product
    • visiting the following links should work
      • Warenkorb (Home)
      • Archiv
      • Schnellbestellung
      • Katalog
      • Abschlüsse
      • Promotionen
      • Kalkulieren
      • Passwort ändern
      • Abmelden
  • login as admin user
    • All customers should appear
    • Search via name/id/address should work
    • Changing the language to french and back should work
    • Select a user and

Was um 15:55 noch nicht läuft is:

  • Wenn man als admin-Benutzer eingeloggt is
    • Generate a new password
    • Set a new password

Folgende Tests habe ich noch nicht durchgeführt:

  • Set in etc/config.yml the update_hour to the next hour and verify that the import start
    • Select a user and
      • Changing a street address (and other fields should work). Values should persist after restarting the app
    • Clicking on Umsatz should display a list of orders (total should match)

The importer fails while imorting the ABSCHLUSS.CSV

csv_importer.rb: UTF-8 importing /var/www/virbac.bbmb.ch/var/ftp/ABSCHLUSS.CSV 6490 lines
./home/niklaus/git/bbmb/lib/bbmb/model/customer.rb:26:in `add_quota'
/var/www/virbac_rack.bbmb.ch/lib/bbmb/util/csv_importer.rb:351:in `import_record'
/var/www/virbac_rack.bbmb.ch/lib/bbmb/util/csv_importer.rb:47:in `block in import'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/csv.rb:1771:in `each'
/var/www/virbac_rack.bbmb.ch/lib/bbmb/util/csv_importer.rb:40:in `each_with_index'
/var/www/virbac_rack.bbmb.ch/lib/bbmb/util/csv_importer.rb:40:in `import'
/home/niklaus/git/bbmb/lib/bbmb/util/updater.rb:20:in `import'
/home/niklaus/git/bbmb/lib/bbmb/util/updater.rb:14:in `block in run'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:34:in `block in poll_path'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:33:in `open'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:33:in `poll_path'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:29:in `block in poll'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:28:in `each'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:28:in `poll'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:144:in `block in poll_sources'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:137:in `block in load_sources'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych/deprecated.rb:32:in `each'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/psych/deprecated.rb:32:in `load_documents'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:136:in `load_sources'
/home/niklaus/git/bbmb/lib/bbmb/util/polling_manager.rb:143:in `poll_sources'
/home/niklaus/git/bbmb/lib/bbmb/util/updater.rb:11:in `run'
/home/niklaus/git/bbmb/lib/bbmb/util/server.rb:39:in `update'
bin/update_abschluss_artikel_artikel_fr_kunden:33:in `<module:BBMB>'
bin/update_abschluss_artikel_artikel_fr_kunden:8:in `<top (required)>'
view · edit · sidebar · attach · print · history
Page last modified on May 15, 2017, at 05:41 PM