[Bug 41601] New: Bug 38516 breaks PDF export for basket groups when using API2::PDF > 2.042
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Bug ID: 41601 Summary: Bug 38516 breaks PDF export for basket groups when using API2::PDF > 2.042 Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: critical Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org We noticed that the PDF export for basket groups broke with the security update 24.11.11. We tracked it down to the change in bug 38516. The error from the logs is: Can't locate object method "to_string" via package "PDF::API2" at /usr/share/koha/lib/Koha/pdfformat/layout2pagesde.pm line 250. The problem is that to_string and from_string only exist since 2.0.42. See change log: https://metacpan.org/dist/PDF-API2/changes - Renamed several methods in the PDF::API2 base class: - end -> close - open_scalar -> from_string - stringify -> to_string - pages -> page_count ... We are using packages with Debian 11. This seems to include 2.0.38. Koha names the minimal required version as 2 on the about page. I believe this means more libraries are probably affected. Changing the method names to the old ones fixed the PDF export for us. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |38516 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38516 [Bug 38516] Closed group basket not able to open PDF file with Adobe - The root object is missing or invalid -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anna.leissle@bsz-bw.de, | |cornelius.hertfelder@bsz-bw | |.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Bug 38516 breaks PDF export |Bug 38516 breaks PDF export |for basket groups when |for basket groups when |using API2::PDF > 2.042 |using API2::PDF < 2.042 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #1 from David Cook <dcook@prosentient.com.au> --- That's fun... but I do have an idea! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 191398 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191398&action=edit Bug 41601: Create Koha::PDF::Loader wrapper for PDF::API2 This patch adds a wrapper around PDF::API2 so that we can use the right method names depending on the version of PDF::API2 being used when we're loading in PDF templates Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. chmod 444 /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/pdf/*.pdf 2. Create a basket with a vendor 3. Add an order to the basket 4. Close basket (and attach the basket to a new basket group with the same name) 5. Go to "Closed" tab and click "Export as PDF" 6. Note that there's no error and your PDF opens fine 7. Repeat the "Export as PDF" process for every option of the system preference "OrderPdfFormat". Every option should work without errors. 8. Celebrate! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 --- Comment #3 from David Cook <dcook@prosentient.com.au> --- Alternatively, I suppose we could subclass PDF::API2 and use our own namespace for names, but I thought this was a fairly light touch, which works well. The unit test uses both the new and old method names, but this should still be tested on Debian 11 to make sure the automatic method name setting happens. I've only tested this on Debian 12. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191398|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 191591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191591&action=edit Bug 41601: Create Koha::PDF::Loader wrapper for PDF::API2 This patch adds a wrapper around PDF::API2 so that we can use the right method names depending on the version of PDF::API2 being used when we're loading in PDF templates Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. chmod 444 /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/pdf/*.pdf 2. Create a basket with a vendor 3. Add an order to the basket 4. Close basket (and attach the basket to a new basket group with the same name) 5. Go to "Closed" tab and click "Export as PDF" 6. Note that there's no error and your PDF opens fine 7. Repeat the "Export as PDF" process for every option of the system preference "OrderPdfFormat". Every option should work without errors. 8. Celebrate! Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This fixes the PDF export release notes| |for basket groups when the | |Debian or Ubuntu operating | |system is using a version | |of the API2::PDF Perl | |module that is less than | |version 2.042 (includes | |Debian 11). | | | |An error was generated when | |using the "Export as PDF" | |action for basket groups: | | | |Can't locate object method | |"to_string" via package | |"PDF::API2" at | |/usr/share/koha/lib/Koha/pd | |fformat/layout2pagesde.pm | |line 250. | | | | | |(This is related to Bug | |38516 - Closed group basket | |not able to open PDF file | |with Adobe - The root | |object is missing or | |invalid, which is in Koha | |25.11.00, 25.05.06, and | |24.11.11.) --- Comment #5 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. Current main uses Debian 12 (Bookworm) and has PDF::API2 2.044, so you can't reproduce the error. 2. To test with a Debian version that has API2::PDF less than 2.042, start up KTD with Debian 11 (Bullseye) (Debian 11 has 2.038 of the Perl module): . Change your .env file to: KOHA_IMAGE-main-bullseye . ktd pull . ktd up -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Thanks for the patch David C. and for testing David N.! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #191591|0 |1 is obsolete| | --- Comment #7 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 191793 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191793&action=edit Bug 41601: Create Koha::PDF::Loader wrapper for PDF::API2 This patch adds a wrapper around PDF::API2 so that we can use the right method names depending on the version of PDF::API2 being used when we're loading in PDF templates Test plan: 0. Apply the patch and koha-plack --restart kohadev 1. chmod 444 /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/pdf/*.pdf 2. Create a basket with a vendor 3. Add an order to the basket 4. Close basket (and attach the basket to a new basket group with the same name) 5. Go to "Closed" tab and click "Export as PDF" 6. Note that there's no error and your PDF opens fine 7. Repeat the "Export as PDF" process for every option of the system preference "OrderPdfFormat". Every option should work without errors. 8. Celebrate! Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com --- Comment #8 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Worth noting, the tests fail on bullseye:L not ok 2 - No tests run for subtest "PDF loader tests" # Failed test 'No tests run for subtest "PDF loader tests"' # at /kohadevbox/koha/t/Koha/PDF/Loader.t line 51. invalid method invocation: use 'saveas' instead. at /usr/share/perl5/PDF/API2.pm line 989. as long as we are okay assuming tests will not run on bullseye this seems okay -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41601 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA --- Comment #9 from David Cook <dcook@prosentient.com.au> --- (In reply to Nick Clemens (kidclamp) from comment #8)
Worth noting, the tests fail on bullseye:L not ok 2 - No tests run for subtest "PDF loader tests"
# Failed test 'No tests run for subtest "PDF loader tests"' # at /kohadevbox/koha/t/Koha/PDF/Loader.t line 51. invalid method invocation: use 'saveas' instead. at /usr/share/perl5/PDF/API2.pm line 989.
as long as we are okay assuming tests will not run on bullseye this seems okay
Bullseye is a supported OS so I think we have to fail this one. I'll have to take another look at this.. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org