Continuing work of yesterday. Looks like we have some weird data in the DB. Eg. my debug output prints
child has encoding ISO-8859-1 Grünenthal Pharma AG child has encoding ISO-8859-1 8756 Mitlödi child has encoding UTF-8 Frau 62: Migrating Array [] child has encoding ISO-8859-1 Christine.Unsinn@grunenthal.com 62: Migrating Array ["SÀndli 2  "] child has encoding UTF-8 SÀndli 2  child has encoding ISO-8859-1 Unsinn child has encoding UTF-8 dt_info 62: Migrating YDIM::Debitor #<YDIM::Debitor:0x007f6dbe193c68> ArgumentError: invalid byte sequence in UTF-8 when updating index 'ydim_debitor_name' with a YDIM::Debitor ["/mnt/src/ydim/vendor/ruby/2.3.0/bundler/gems/odba-065f94642746/lib/odba/index.rb:278:in `downcase'", "/mnt/src/ydim/vendor/ruby/2.3.0/bundler/gems/odba-065f94642746/lib/odba/index.rb:278:in `block in search_terms'", "/mnt/src/ydim/vendor/ruby/2.3.0/bundler/gems/odba-065f94642746/lib/odba/index.rb:278:in `collect'", "/mnt/src/ydim/vendor/ruby/2.3.0/bundler/gems/odba-065f94642746/lib/odba/index.rb:278:in `search_terms'"]
Most of the stuff could be fixed, but found
[1] pry(#<YDIM::Server>)> child => "G\xE9rard Brugger" [2] pry(#<YDIM::Server>)> sanitize_utf8(child) => "G\xE9rard Brugger" [7] pry(#<YDIM::Server>)> child.valid_encoding? => false 18] pry(#<YDIM::Server>)> child.force_encoding(Encoding::ISO_8859_1).clone.encode(Encoding::UTF_8) => "Gérard Brugger"
Fixed some more border cases. Now the script runs find (Takes about two minutes, if nothing has to be changed). Verifying visual output. Generated PDF does not contain logo and some header info.
Reloading the databse and running migration again (as my first test 'eated' some invalid characters, which should no longer be the case). This looks fine.
Attacking the problem with missing Header/Logo in PDFs (eg. invoice 12438, Grünenthal). The following errors must be corrected:
The display of the invoice looks okay. See
When looking at https://ydim.oddb-ci2.dyndns.org/de/ydim/autoinvoice/unique_id/10030 I got an ArgumentError invalid byte sequence in UTF-8
After adding autoinvoices to the table to be migrated, this page displays correctly, too.
Dateformat is wrong (shows 01.01.-4712
in https://ydim.oddb-ci2.dyndns.org/de/ydim/debitor/unique_id/334 for a paid invoice.
Okay. This roots in bad values read from the database, e.g pry shows the following when invoice in the view invoices.
from (pry):7:in `date' [8] pry(#<YDIM::Html::View::InvoiceInnerComposite>)> model.items.first.time.to_date => #<Date: 2009-10-15 ((2455120j,0s,0n),+0s,2299161j)> [9] pry(#<YDIM::Html::View::InvoiceInnerComposite>)> model.date => #<Date: -4712-01-01 ((0j,43200s,(172800000000000/4910239)n),+0s,2299161j)> [10] pry(#<YDIM::Html::View::InvoiceInnerComposite>)> model.date.year => -4712 [11] pry(#<YDIM::Html::View::InvoiceInnerComposite>)> model.items.first.time.year => 2009
Therefore I will patch the model.date when being displayed. No, I think I must patch the value inside the YDIM::Invoice class. Added a test case, ported all unit test of ydim to Minitest.
Pushed commits
Merged the changes from branch ruby2x into my master branch with commit Merged changes from ruby2x
Must also push some changes made to htmlgrid and sbsm.
Must fix a few unit test failures in sbsm before pushing it.