view · edit · sidebar · attach · print · history

Index>

20160706-virbac-calculator

Summary

Commits

Index

Fix calculato for virbac.bbmb.ngiger.ch

I must rework the calculation and pack the with VAT, VAT-rate and factor into session parameters. Maybe https://dojotoolkit.org/documentation/tutorials/1.10/ajax/ helps me.

A similar problem is handling the ZSR in oddb.org. Analysing the HTTP request using the virbac.bbmb.ch. After clicking the "inkl. MwSt" checkbox I see only one POST request which content is the HTML source (Tabble) for all displayed items. The "POST Daten" have the raw values factor=1.7&flavor=&language=de&event=ajax&state_id=70081935878140&

Dojo.io.bind should be replaced by dojo/request/xhr as documented under https://dojotoolkit.org/reference-guide/1.10/dojo/request/xhr.html#post.

Making slowly progress. Now clicking on "inkl. MwSt" does not change anything, but pressing "Kalkulieren" refreshes the values with the correct content, but changes the URL from http://virbac.bbmb.ngiger.ch/de/bbmb/calculator/ to http://virbac.bbmb.ngiger.ch/de/bbmb. This is not the case on virbac.bbmb.ch.

Was able to trigger the submit even by adding require(['dojo']); document.getElementsByName('#{EVENT}')[0].click(); to the onChange attribute (aka javascript).

After pullig the changes from yasuhiro I see in the console the following error

dojo.js.uncompressed.js:1070 Uncaught TypeError: mid.match is not a function 
getModule @ dojo.js.uncompressed.js:1070
contextRequire @ dojo.js.uncompressed.js:825
req @ dojo.js.uncompressed.js:137
(anonymous function) @ bbmb:4
Navigated to http://virbac.bbmb.ngiger.ch/de/bbmb

Now looking at the problem why calculator gets dropped from the URL when changing a VAT or factor. POST-rawdata for

  • virbac.bbmb.ch: factor=2&flavor=&language=de&event=ajax&state_id=70081934869400&
  • virbac.bbmb.ch: factor=1.5&calculate=Berechnen&flavor=bbmb&language=de&event=calculate&state_id=28029260
  • virbac.bbmb.ch: factor=1.5&calculate=Berechnen&show_vat=1&flavor=bbmb&language=de&event=calculate&state_id=28029260

Why do I have a calculate=Berechnen and event=calculate?

Fixed the problem by adding this.setAttribute('method', 'POST'); this.setAttribute('action', window.location.href); to the onSubmit javascript.

Pushed commit Replaced calculator.js

There are still references to dojo.io.bind in doc/resources/javascript/bcreader.js and doc/resources/javascript/order.js.

Clicking "Löschen" in a row of http://virbac.bbmb.ngiger.ch/de/bbmb/favorites/ has no effet. Verified that the procedure delete_position in order.js gets called. They are loaded in bbmb/lib/bbmb/html/view/current_order.rb and bbmb/lib/bbmb/html/view/favorites.rb. Deleting the whole Schnellbestellung worked.

Adding Zoletil to the favorites via Artikel..Suchen worked. And now deleting a single item from http://virbac.bbmb.ngiger.ch/de/bbmb/favorites/ works. But again the URL looses the last part /favorites

Reloading the database from fastpower. The dump contains SET client_encoding = 'UTF8'. After loading the database here I could not find any problem displaying Umlauts or accented characters.

Must test import and sending invoices. For sending invoices I must change order_destinations and mail_order_to in etc/config.yml.

Making test/util/*.rb pass again. Replaced parseexcel by spreadsheet gem. Had to correct the following errors:

  • Delete empty spaces at end of word
  • VAT rate changed from 7.6 to 8.0

Now the 3 tests in test/util/ pass. But I skip all selenium tests.

Added in etc/config.yml the line update_hour: 17. After restaring virbad I see in the log [2016-07-06T16:09:45.637316 #13264] DEBUG -- updater: sleeping 3014.36 seconds

Creating an updater job name bin/update_abschluss_artikel_artikel_fr_kunden. (similar to bbmb/bin/update_articles_and_products). When running it I get the following error

2016-07-06 16:44:26 +0200: Calling update
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/mail.rb:60 Suppress sending mail with subject: Bbmb(Virbac): (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 4 column 15
    from orders.virbac@bbmb.ch to: ["ngiger@ywesee.com"] cc: [] reply_to: 
2016-07-06 16:44:26 +0200: Finished update

Using pry I see that it comes from

 "/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/mail.rb:60:in `sendmail'",
 "/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/mail.rb:37:in `notify_error'",
 "/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/server.rb:160:in `rescue in update'",
 "/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/server.rb:158:in `update'",
 "bin/update_abschluss_artikel_artikel_fr_kunden:40:in `<module:BBMB>'",
 "bin/update_abschluss_artikel_artikel_fr_kunden:12:in `<main>'"]

After pushing commit Show first 10kB of mail body if sending is suppressed I see the following log output

2016-07-06 16:57:24 +0200: Calling update
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/mail.rb:60 Suppress sending mail with subject: Bbmb(Virbac): (<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 4 column 15
    from orders.virbac@bbmb.ch to: ["ngiger@ywesee.com"] cc: [] reply_to: 
Psych::SyntaxError
(<unknown>): did not find expected alphabetic or numeric character while scanning an alias at line 4 column 15
/usr/local/lib/ruby/2.3.0/psych.rb:380:in `parse'
/usr/local/lib/ruby/2.3.0/psych.rb:380:in `parse_stream'
/usr/local/lib/ruby/2.3.0/psych.rb:463:in `load_stream'
/usr/local/lib/ruby/2.3.0/psych/deprecated.rb:30:in `load_documents'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/polling_manager.rb:129:in `load_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/polling_manager.rb:136:in `poll_sources'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/updater.rb:12:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/bbmb-2.0.5/lib/bbmb/util/server.rb:158:in `update'
bin/update_abschluss_artikel_artikel_fr_kunden:39:in `<module:BBMB>'
bin/update_abschluss_artikel_artikel_fr_kunden:12:in `<main>'
2016-07-06 16:57:24 +0200: Finished update

Will fix this problem tomorrow.

view · edit · sidebar · attach · print · history
Page last modified on July 06, 2016, at 05:02 PM