https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Bug ID: 40387 Summary: t/db_dependent/Koha/EDI.t Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Test Suite Assignee: chris@bigballofwax.co.nz Reporter: jonathan.druart@gmail.com QA Contact: testopia@bugs.koha-community.org Blocks: 25515 03:27:57 koha_1 | substr outside of string at /kohadevbox/koha/Koha/Edifact/Segment.pm line 101. 03:27:57 koha_1 | Use of uninitialized value $seg in substitution (s///) at /kohadevbox/koha/Koha/Edifact/Segment.pm line 103. 03:27:57 koha_1 | Use of uninitialized value $seg in split at /kohadevbox/koha/Koha/Edifact/Segment.pm line 104. 03:27:57 koha_1 | substr outside of string at /kohadevbox/koha/Koha/Edifact/Segment.pm line 101. 03:27:57 koha_1 | Use of uninitialized value $seg in substitution (s///) at /kohadevbox/koha/Koha/Edifact/Segment.pm line 103. 03:27:57 koha_1 | Use of uninitialized value $seg in split at /kohadevbox/koha/Koha/Edifact/Segment.pm line 104. 03:27:57 koha_1 | # Loaded QUOTE file with 1 Message that contains 2 LIN segments with the first 03:27:57 koha_1 | # consistent of 1 item and the second with 3 items with 2 different funds. 03:27:57 koha_1 | No matching EAN found for 5412345000013 at t/db_dependent/Koha/EDI.t line 385. 03:27:57 koha_1 | # Looking at order: 1 03:27:57 koha_1 | # Looking at order: 2 03:27:57 koha_1 | # Looking at order: 3 03:27:57 koha_1 | # Second LIN split into 2 Orderlines, one for each Fund 03:27:57 koha_1 | # Loading QUOTE file with 1 Message that contains 2 LIN segments with the first 03:27:57 koha_1 | # consistent of 1 item and the second with 3 items with 2 different undefined funds. 03:27:57 koha_1 | # Loading QUOTE file with 2 messages 03:27:57 koha_1 | No orderlines for basket 285 at t/db_dependent/Koha/EDI.t line 618. 03:27:57 koha_1 | No orderlines for basket 286 at t/db_dependent/Koha/EDI.t line 618. 03:27:57 koha_1 | Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/EDI.pm line 420. 03:27:57 koha_1 | Use of uninitialized value in multiplication (*) at /kohadevbox/koha/Koha/EDI.pm line 420. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25515 [Bug 25515] [OMNIBUS] Remove warnings and errors from tests output -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|t/db_dependent/Koha/EDI.t |t/db_dependent/Koha/EDI.t | |generates warnings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|chris@bigballofwax.co.nz |martin.renvoize@openfifth.c | |o.uk CC| |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |40444 Blocks|25515 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25515 [Bug 25515] [OMNIBUS] Remove warnings and errors from tests output https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40444 [Bug 40444] Add a test to ensure all Perl test files use Test::NoWarnings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |40386 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40386 [Bug 40386] t/Edifact.t generates warnings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184379 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184379&action=edit Bug 40387: Fix undefined tax rate warnings in EDI invoice processing When processing EDI invoices without TAX segments, warnings were generated due to undefined tax rates in multiplication operations. The tax_rate() method in Koha::Edifact::Line correctly returns undef when no TAX segments are present in the EDI message. However, the invoice processing code in Koha::EDI didn't handle this case properly. This patch fixes the issue by: - Adding checks for undefined tax rates before using them in calculations - Defaulting to 0 tax rate when no tax information is present - Ensuring tax_value calculations use 0 instead of undefined values This eliminates "Use of uninitialized value in multiplication" warnings while maintaining correct processing of invoices without tax information. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184380 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184380&action=edit Bug 40387: Add test for undefined tax rate handling in EDI processing This adds a test to verify that EDI invoice processing correctly handles invoices without TAX segments (undefined tax rates). The test covers: 1. Processing invoices without TAX segments 2. Verifying no warnings about uninitialized values in multiplication 3. Confirming tax rates are set to 0 when no tax information is present 4. Ensuring invoice processing completes successfully -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #3 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184381 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184381&action=edit Bug 40387: Add Test::NoWarnings and replace carp with Koha::Logger This patch adds Test::NoWarnings to our EDI unit tests. In doing so, it reminded me that we still had some old carp style error handling in the process_quote section and that we shoudl replace those with calls to Koha::Logger instead. Changes made: 1. Added Test::NoWarnings import to catch any warnings 2. Replace 'carp "Message"' appropriately with '$logger->warn("Message")' -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #4 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184382 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184382&action=edit Bug 40387: Add tests for create_edi_order logger calls Tests for the logger calls introduced in the create_edi_order in the last commit. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 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=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184379|0 |1 is obsolete| | --- Comment #5 from David Nind <david@davidnind.com> --- Created attachment 184414 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184414&action=edit Bug 40387: Fix undefined tax rate warnings in EDI invoice processing When processing EDI invoices without TAX segments, warnings were generated due to undefined tax rates in multiplication operations. The tax_rate() method in Koha::Edifact::Line correctly returns undef when no TAX segments are present in the EDI message. However, the invoice processing code in Koha::EDI didn't handle this case properly. This patch fixes the issue by: - Adding checks for undefined tax rates before using them in calculations - Defaulting to 0 tax rate when no tax information is present - Ensuring tax_value calculations use 0 instead of undefined values This eliminates "Use of uninitialized value in multiplication" warnings while maintaining correct processing of invoices without tax information. 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=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184380|0 |1 is obsolete| | --- Comment #6 from David Nind <david@davidnind.com> --- Created attachment 184415 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184415&action=edit Bug 40387: Add test for undefined tax rate handling in EDI processing This adds a test to verify that EDI invoice processing correctly handles invoices without TAX segments (undefined tax rates). The test covers: 1. Processing invoices without TAX segments 2. Verifying no warnings about uninitialized values in multiplication 3. Confirming tax rates are set to 0 when no tax information is present 4. Ensuring invoice processing completes successfully 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=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184381|0 |1 is obsolete| | --- Comment #7 from David Nind <david@davidnind.com> --- Created attachment 184416 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184416&action=edit Bug 40387: Add Test::NoWarnings and replace carp with Koha::Logger This patch adds Test::NoWarnings to our EDI unit tests. In doing so, it reminded me that we still had some old carp style error handling in the process_quote section and that we shoudl replace those with calls to Koha::Logger instead. Changes made: 1. Added Test::NoWarnings import to catch any warnings 2. Replace 'carp "Message"' appropriately with '$logger->warn("Message")' 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=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184382|0 |1 is obsolete| | --- Comment #8 from David Nind <david@davidnind.com> --- Created attachment 184417 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184417&action=edit Bug 40387: Add tests for create_edi_order logger calls Tests for the logger calls introduced in the create_edi_order in the last commit. 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=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #9 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. prove t/db_dependent/Koha/EDI.t 2. Output from running tests: prove t/db_dependent/Koha/EDI.t t/db_dependent/Koha/EDI.t .. # Loaded QUOTE file with 1 Message that contains 2 LIN segments with the first # consistent of 1 item and the second with 3 items with 2 different funds. # Looking at order: 1 # Looking at order: 2 # Looking at order: 3 # Second LIN split into 2 Orderlines, one for each Fund # Loading QUOTE file with 1 Message that contains 2 LIN segments with the first # consistent of 1 item and the second with 3 items with 2 different undefined funds. # Loading QUOTE file with 2 messages t/db_dependent/Koha/EDI.t .. ok All tests successful. Files=1, Tests=5, 5 wallclock secs ( 0.02 usr 0.00 sys + 3.04 cusr 1.19 csys = 4.25 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #10 from Jonathan Druart <jonathan.druart@gmail.com> --- Martin, do you think it's useful to keep the diag output here? I've been tempted to remove all kind of output from the tests if there were passing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #11 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 184539 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184539&action=edit Bug 40387: Comment some of the superflous diag The test output was a little verbose in places, however the diag's can be helpful when debugging failures. I've opted to comment rather than completely remove them. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25515 Depends on|40444 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25515 [Bug 25515] [OMNIBUS] Remove warnings and errors from tests output https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40444 [Bug 40444] Add a test to ensure all Perl test files use Test::NoWarnings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|25515 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25515 [Bug 25515] [OMNIBUS] Remove warnings and errors from tests output -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |40444 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40444 [Bug 40444] Add a test to ensure all Perl test files use Test::NoWarnings -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Jonathan Druart <jonathan.druart@gmail.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=40387 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184414|0 |1 is obsolete| | Attachment #184415|0 |1 is obsolete| | Attachment #184416|0 |1 is obsolete| | Attachment #184417|0 |1 is obsolete| | Attachment #184539|0 |1 is obsolete| | --- Comment #12 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184544 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184544&action=edit Bug 40387: Fix undefined tax rate warnings in EDI invoice processing When processing EDI invoices without TAX segments, warnings were generated due to undefined tax rates in multiplication operations. The tax_rate() method in Koha::Edifact::Line correctly returns undef when no TAX segments are present in the EDI message. However, the invoice processing code in Koha::EDI didn't handle this case properly. This patch fixes the issue by: - Adding checks for undefined tax rates before using them in calculations - Defaulting to 0 tax rate when no tax information is present - Ensuring tax_value calculations use 0 instead of undefined values This eliminates "Use of uninitialized value in multiplication" warnings while maintaining correct processing of invoices without tax information. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #13 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184545 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184545&action=edit Bug 40387: Add test for undefined tax rate handling in EDI processing This adds a test to verify that EDI invoice processing correctly handles invoices without TAX segments (undefined tax rates). The test covers: 1. Processing invoices without TAX segments 2. Verifying no warnings about uninitialized values in multiplication 3. Confirming tax rates are set to 0 when no tax information is present 4. Ensuring invoice processing completes successfully Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #14 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184546 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184546&action=edit Bug 40387: Add Test::NoWarnings and replace carp with Koha::Logger This patch adds Test::NoWarnings to our EDI unit tests. In doing so, it reminded me that we still had some old carp style error handling in the process_quote section and that we shoudl replace those with calls to Koha::Logger instead. Changes made: 1. Added Test::NoWarnings import to catch any warnings 2. Replace 'carp "Message"' appropriately with '$logger->warn("Message")' Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184547 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184547&action=edit Bug 40387: Add tests for create_edi_order logger calls Tests for the logger calls introduced in the create_edi_order in the last commit. Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #16 from Jonathan Druart <jonathan.druart@gmail.com> --- Created attachment 184548 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184548&action=edit Bug 40387: Comment some of the superflous diag The test output was a little verbose in places, however the diag's can be helpful when debugging failures. I've opted to comment rather than completely remove them. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |jonathan.druart@gmail.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |25.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #17 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 25.11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Paul Derscheid <paul.derscheid@lmscloud.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to main |Pushed to stable Version(s)|25.11.00 |25.11.00,25.05.03 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 --- Comment #18 from Paul Derscheid <paul.derscheid@lmscloud.de> --- Nice work everyone! Pushed to 25.05.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Status|Pushed to stable |Needs documenting --- Comment #19 from Fridolin Somers <fridolin.somers@biblibre.com> --- Depends on Bug 40386 not in 24.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs documenting |RESOLVED --- Comment #20 from David Nind <david@davidnind.com> --- Test suite changes, no changes required to the manual. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40387 Bug 40387 depends on bug 40386, which changed state. Bug 40386 Summary: t/Edifact.t generates warnings https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40386 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org