view · edit · sidebar · attach · print · history

< Niklaus.20160510-ydim-html-cleanup-config | Index | Niklaus.20160504-ydim-html-to-utf8 >>



  • Ydim-Html: Fix creating invoices



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
  • remove obsolete ext from html-grid
  • Fix sbsm/htmlgrid when DEFAULT_FLAVOUR is nil

Ydim-Html: Fix creating invoices

Attacking the problem with missing Header/Logo in PDFs (eg. invoice 12438, Grünenthal). The following errors must be corrected:

  • Replace english name like "Description" by german "Beschreibung"
  • Ywesee logo is missing
  • Ywesee address and info like MwSt, IBAN is missing
  • Invoice is shown as "#012438" insted of "Rechnung 12438"
  • Missing space between "1 x Patinfo" and address
  • Invoice date is shown as 01.01.-4712 instead of 18.12.2015
  • Missing line "Bedingungen: zahlbar in 10 Tagen"
  • Missing greeting lines "Ohne Ihre Gegenmeldung .. 043 540 05 50"

Working on a unit test for generating the PDF. Added a copy of thinpowers /etc/pdfinvoice/config.yml to ydim/test/data and using it for an example PDF. Most problems were solved after adding a correct config.yml. Had to be changed to UTF-8. Some "'" had to be added, too, to avoid errors parsing the yaml file, e.g. currency: '%1.2f'.

Now must find the reason, why the Logo is not displayed. Okay. The Logo was missing, too. Changed the default value of creditor_address to Please set creditor_address etc in: ["$HOME/.pdfinvoice/config.yml", "/etc/pdfinvoice/config.yml"] to made a missing yml self explaining.

Now the invoice displays correctly with Umlaut, Logo, correct address and german texts.

Starting updating ydim and ydim-html on thinpower. First installing most uptodate Ruby version 2.3.1 via Attach:gen_ruby_231.txt.

Ultimately the Gemfile of ruby-dbi, odba, ydim, pdf-writer and ydim-html must have their references to having changed to I will leave however for later, once everything is running fine. The following steps are required.

  • Run ./gen_ruby_231. Verify that /usr/local/bin/ruby231 --version return the correct version. Done returns ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
  • /usr/local/bin/gem231 install bundler
  • cd /home/ywesee/git/ydim && git pull
  • cd /home/ywesee/git/ydim && /usr/local/bin/bundle install --path=vendor --without=test --without=debugger
  • cd /var/www/ && git pull
  • cd /var/www/ && /usr/local/bin/bundle install --path=vendor --without=test --without=debugger
  • Install changed config.yml into /etc/pdfinvoice (Saved old as config.yml.2013.03.05)
  • cd /home/ywesee/git/ydim && /usr/local/bin/bundle exec bin/migrate_to_utf_8@@
  • Change in /service/ydim/run exec sudo -u apache ruby -rubygems /usr/bin/ydimd by cd /home/ywesee/git/ydim && exec sudo -u apache /usr/local/bin/bundle exec bin/ydimd
  • Change in /service/ydim-html/run exec sudo -u apache ruby -rubygems /usr/bin/ydimd-html by cd /var/www/ && exec sudo -u apache /usr/local/bin/bundle exec bin/ydim-htmld
  • sudo /usr/local/bin/gem231 install sbsm --version=1.2.6
  • Fix apache2 configuration for

Got the following problem when running sudo -u apache /usr/local/bin/bundle exec bin/migrate_to_utf_8

2016-05-09 12:13:50 +0200: Loading bin/migrate_to_utf_8
/home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems
/home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems
/home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems
bundler: failed to load command: bin/migrate_to_utf_8 (bin/migrate_to_utf_8)
Psych::SyntaxError: (<unknown>): Invalid leading UTF-8 octet at line 1 column 1
  /usr/local/lib/ruby/2.3.0/psych.rb:377:in `parse'
  /usr/local/lib/ruby/2.3.0/psych.rb:377:in `parse_stream'
  /usr/local/lib/ruby/2.3.0/psych.rb:325:in `parse'
  /usr/local/lib/ruby/2.3.0/psych.rb:252:in `load'
  /home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:31:in `load'
  /home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:24:in `block in load'
  /home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:22:in `each'
  /home/ywesee/git/ydim/vendor/ruby/2.3.0/gems/rclconf-1.0.0/lib/rclconf/rclconf.rb:22:in `load'
  /home/ywesee/git/ydim/lib/ydim/server.rb:64:in `<class:Server>'
  /home/ywesee/git/ydim/lib/ydim/server.rb:20:in `<module:YDIM>'
  /home/ywesee/git/ydim/lib/ydim/server.rb:19:in `<top (required)>'
  /home/ywesee/git/ydim/lib/ydim/invoice.rb:9:in `require'
  /home/ywesee/git/ydim/lib/ydim/invoice.rb:9:in `<top (required)>'
  /home/ywesee/git/ydim/lib/ydim/factory.rb:6:in `require'
  /home/ywesee/git/ydim/lib/ydim/factory.rb:6:in `<top (required)>'
  bin/migrate_to_utf_8:20:in `require'
  bin/migrate_to_utf_8:20:in `<top (required)>'

Looks like a yml file has non UTF-8 chars in it. Fixed /etc/ydim/ydimd.yml. Now the migration worked without problems.

Now ydim and ydim-html seem to be running fine as verified by svstat /service/ydim*. But going to the background is white. Looks like the css is not yet loaded correctly.

Changed used locate of ydim-html from /home/ywesee/git/ydim-html to /var/www/ Moved /var/www/ to /var/www/ and copied the etc from /home/ywesee/git/ydim-html to /var/www/ Now ydim-html starts correctly and a the ydim.css is used (yellow background). See

Fixed the link to the commit-id with Fixed commit-link

Looking why I cannot restart on my machine.

Zeno wants and installation without bundler.

But first I must build the modified (ruby-dbi, odba, pdf-writer gems locally, as they are not available via rubygems. Created script Attach:install_ydim_html.txt to build and instal neede gems. Changed in /service/ydim*/run bundle by ruby231. Also replaced the shebang line for /home/ywesee/git/ydim/bin/ydimd and /var/www/ from #!/usr/bin/env ruby to #!/usr/bin/env ruby230

No I have no more complaints about not being able to connect to DRB-process 12375 (ydim). But after entering an invalid username/password combination, I don't see any log output in /service/ydim-html/log/main/current, /service/ydim/log/main/current nor /var/www/ But in the errorlog one sees somebody trying to access a non existent index.php from a different IP [Mon May 09 18:08:05 2016] [error] [client] script '/var/www/' not found or unable to stat

Found the corresponding MD5 for my xxx password like this

grep -B1 -A1 f561aaf6ef0bf14d4208bb46a4ccb3ad /etc/*/*yml /var/www/*/etc/*yml
/var/www/ 'f561aaf6ef0bf14d4208bb46a4ccb3ad'
/var/www/ '/etc/ydim/id_dsa'
/var/www/ 'f561aaf6ef0bf14d4208bb46a4ccb3ad'
/var/www/ '/etc/ydim/id_dsa'
view · edit · sidebar · attach · print · history
Page last modified on May 09, 2016, at 06:20 PM