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.
Created attachment 184379 [details] [review] 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.
Created attachment 184380 [details] [review] 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
Created attachment 184381 [details] [review] 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")'
Created attachment 184382 [details] [review] 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.
Created attachment 184414 [details] [review] 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>
Created attachment 184415 [details] [review] 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>
Created attachment 184416 [details] [review] 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>
Created attachment 184417 [details] [review] 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>
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
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.
Created attachment 184539 [details] [review] 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.
Created attachment 184544 [details] [review] 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>
Created attachment 184545 [details] [review] 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>
Created attachment 184546 [details] [review] 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>
Created attachment 184547 [details] [review] 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>
Created attachment 184548 [details] [review] 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>
Nice work everyone! Pushed to main for 25.11
Nice work everyone! Pushed to 25.05.x