Looking at several suggestions made by Zeno:
I am adding debug printfs in the ydim/html/state/global.rb, as I think some paths are not taken correctly. It looks like Invoice.new(@session, @session.invoice(id.to_i))
work. But after pressing "Speichern" and "Kunden" the URL switches to https://ydim.oddb-ci2.dyndns.org/de/debitors/, but no debitors are visible.
See
As pressing "Email" or "Name" to sort by E-Mail does not work neither, I added debug statements and see now
SBSM::Request.drb_process cgi.params {"default_flavor"=>nil, "language"=>"de", "flavor"=>"sort", "event"=>"state_id", "69911742359600"=>"sortvalue", "email"=>"", "ssl-secure-reneg"=>"1"} @request.unparsed_uri /de/sort/state_id/69911742359600/sortvalue/email
SBSM::Request.drb_process cgi.params {"default_flavor"=>nil, "language"=>"de", "flavor"=>"sort", "event"=>"state_id", "69911742359600"=>"sortvalue", "name"=>"", "ssl-secure-reneg"=>"1"} @request.unparsed_uri /de/sort/state_id/69911742359600/sortvalue/name
YDIM::Html::Util::Session process /de/sort/state_id/69911742359600/sortvalue/email
sbsm process /de/sort/state_id/69911742359600/sortvalue/email @state.request_path /de @active_state.zone
sbsm process state #<YDIM::Html::State::Debitors:0x007f2b31235060> zone
YDIM::Html::Util::Session process /de/sort/state_id/69911742359600/sortvalue/name
sbsm process /de/sort/state_id/69911742359600/sortvalue/name @state.request_path /de @active_state.zone
sbsm process state #<YDIM::Html::State::Debitors:0x007f2b31235060> zone
I think I have resolved the problem. For ODDB.ORG we had to introduce flavor (after working with ydim). Therefore a debitor is displayed correctly when using an URL like https://ydim.oddb-ci2.dyndns.org/de/gcc/debitor/unique_id/9 instead of https://ydim.oddb-ci2.dyndns.org/de/debitor/unique_id/9. gcc has no influence, as ydim has no notion of flavor. It may be any string, even an empty one.
After adding DEFAULT_FLAVOR = "gcc"
into ib/ydim/html/util/session.rb
, the link work, but the lnf has changed and displays a white background. Renaming the DEFAULT_FLAVOR to 'ydim' and moving doc/resources/ydim.css into doc/resources/ydim/ydim.yss fixed this problem.
See
Adding a new invoice does not work correctly. It is possible to add the header, but when trying to add a position, I cannot enter number and prices. But the invoice can be saved (even when containing Umlaute). See
Investigating the necessary changes to make the AJAX-scripts work again.
When looking at the output I see
error in SBSM::Session#process: /de/ydim/ajax_create_item/state_id/70080653642640/unique_id/10002 NoMethodError undefined method `collect' for "10002":String (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/storage.rb:441:in `retrieve_from_condition_index' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/index.rb:333:in `fetch_ids' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/cache.rb:458:in `retrieve_from_index' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/persistable.rb:135:in `block (2 levels) in odba_index'
Loaded ydim database from thinpower. All debitors display, but some names are ugly (UTF-8 problem). When creating a PDF, only a PDF containing NoMethodError undefined method `each' for "<b>#012470</b>":String
is created.
Callstack is
error in SBSM::Session#to_html: /de/ydim/pdf/unique_id/12470 NoMethodError undefined method `each' for "<b>#012470</b>":String (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:2375:in `text' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/pdfinvoice/invoice.rb:61:in `pdf_header' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/pdfinvoice/invoice.rb:26:in `to_pdf' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/invoice.rb:131:in `to_pdf' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/drbwrapper.rb:28:in `method_missing' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop' /mnt/src/ydim-html/lib/ydim/html/view/pdf.rb:12:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/state.rb:181:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:449:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:173:in `block in drb_process' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `synchronize' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `drb_process' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop'
Committed Bumped version to 1.3.2, use bundler/gemtasks and using my Ruby 2.x compatible version of the pdf-writer. Now the errors are no longer in the PDF-header but
error in SBSM::Session#to_html: /de/ydim/pdf/unique_id/12470 NoMethodError undefined method `each' for "":String (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/pdfinvoice/invoice.rb:191:in `pdf_lines' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/pdfinvoice/invoice.rb:65:in `pdf_header' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/pdfinvoice/invoice.rb:26:in `to_pdf' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/invoice.rb:131:in `to_pdf' (druby://localhost:12375) /usr/local/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/drbwrapper.rb:28:in `method_missing' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' (druby://localhost:12375) /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop' /mnt/src/ydim-html/lib/ydim/html/view/pdf.rb:12:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/state.rb:181:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:449:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:173:in `block in drb_process' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `synchronize' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `drb_process' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop'
After handling strings and arrays differently in lib/pdfinvoice/invoice.rb:191:in `pdf_lines'
the first PDF was generated correctly and display a 'é' without problems.
But I want to resolve first the problem that customer get displayed like 68 V�toquinol AG info@vetoquinol.ch
.
While visiting https://ydim.oddb-ci2.dyndns.org/de/ydim/debitor/unique_id/389 (Grünenthal) I got the error Encoding::CompatibilityError incompatible character encodings: ISO-8859-1 and UTF-8
error in SBSM::Session#to_html: /de/ydim/debitor/unique_id/389 Encoding::CompatibilityError incompatible character encodings: ISO-8859-1 and UTF-8 /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/grid.rb:296:in `join' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/grid.rb:296:in `block in to_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:15:in `nn_element' /usr/local/lib/ruby/2.3.0/cgi/html.rb:21:in `nn_element_def' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/grid.rb:295:in `to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/composite.rb:266:in `to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/form.rb:59:in `block in to_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:324:in `form' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/form.rb:58:in `to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:42:in `block (3 levels) in to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `each' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `inject' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `block (2 levels) in to_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:15:in `nn_element' /usr/local/lib/ruby/2.3.0/cgi/html.rb:21:in `nn_element_def' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:39:in `block in to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `each' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `each_with_index' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:42:in `block (3 levels) in to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `each' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `inject' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:40:in `block (2 levels) in to_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:15:in `nn_element' /usr/local/lib/ruby/2.3.0/cgi/html.rb:21:in `nn_element_def' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:39:in `block in to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `each' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `each_with_index' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/divcomposite.rb:38:in `to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:123:in `block in to_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:116:in `template_tags' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:111:in `block (2 levels) in template_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:55:in `nO_element' /usr/local/lib/ruby/2.3.0/cgi/html.rb:62:in `nO_element_def' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:110:in `block in template_html' /usr/local/lib/ruby/2.3.0/cgi/html.rb:55:in `nO_element' /usr/local/lib/ruby/2.3.0/cgi/html.rb:62:in `nO_element_def' /usr/local/lib/ruby/2.3.0/cgi/html.rb:423:in `html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:109:in `template_html' /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8.1/lib/htmlgrid/template.rb:122:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/state.rb:181:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:449:in `to_html' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:173:in `block in drb_process' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `synchronize' /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/sbsm/session.rb:171:in `drb_process' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1624:in `perform_without_block' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1584:in `perform' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1657:in `block (2 levels) in main_loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `loop' /usr/local/lib/ruby/2.3.0/drb/drb.rb:1653:in `block in main_loop'
Do we need a migrate script to change all database entries to UTF_8? And how should I call it?
After adding a number of calls to force_encoding I was able to generate a new invoice containing Umlauts. See
But loading customer with umlaut still leads to ArgumentError invalid byte sequence in UTF-8
Copied relevant methods from oddb.org/util/oddbapp.rb to ydim/bin/migrate_to_utf8 and adapted all needed classes. The method itself needs some updating, too, as iconv has gone with ruby 2.x.
Added bin/migrate_to_utf (see Attach:migrate_to_utf8.txt). But when running no tables are found
sudo -u apache /usr/local/bin/bundle exec bin/migrate_to_utf_8 2016-05-03 17:31:55 +0200: Loading bin/migrate_to_utf_8 /mnt/src/ydim/vendor/ruby/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems /mnt/src/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 /mnt/src/ydim/vendor/ruby/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems 2016-05-03 17:32:04 +0200: Calling migrate_to_utf8 FEHLER: Relation �object� existiert bereits FEHLER: Relation �prefetchable_index� existiert bereits FEHLER: Relation �extent_index� existiert bereits FEHLER: Relation �object_connection� existiert bereits FEHLER: Relation �target_id_index� existiert bereits FEHLER: Relation �collection� existiert bereits FEHLER: Relation �target_id_ydim_autoinvoice_unique_id� existiert bereits FEHLER: Relation �target_id_ydim_debitor_email� existiert bereits FEHLER: Relation �target_id_ydim_debitor_name� existiert bereits FEHLER: Relation �target_id_ydim_debitor_unique_id� existiert bereits FEHLER: Relation �target_id_ydim_invoice_status� existiert bereits FEHLER: Relation �target_id_ydim_invoice_unique_id� existiert bereits Migrating table {nil=>true, :serialized=>{}, :finalizer=>#<Proc:0x007f59a04df8b8@bin/migrate_to_utf_8:32>} 60: Migrating NilClass 2016-05-03 17:32:05 +0200: Finished migrate_to_utf8
The bin/admin command migrate_to_utf8 from odddb.org probably does not work anymore. Therefore I need to adapt even more stuff. Adding a RootUser and RootSession. Trying to convert first all debitors. Loop is not yet perfect, as it only goes over one item. Will continue tomorrow.
Reverted Yasuhiros commit for Zeno Revert "Update path to use absolut_path via expand_path"