From 92084681e7bf150be6b5d94adfdcc4c90c8651e6 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 14 Oct 2025 11:51:42 +0100 Subject: [PATCH] Bug 20253: (follow-up) Fix undefined variable $b and test plan count In bug 40587 we renamed a variable from $b to $basketno. After rebasing, the auto-orders blocking code had a bug where it referenced an undefined variable $b instead of $basketno when checking for PO number conflicts. This caused warnings: "Use of uninitialized value $Koha::EDI::b in exists" This patch: - Renames $b to $basketno throughout the conflict checking code - Updates test plan from 7 to 8 to match actual subtest count Test plan: 1. Run prove t/db_dependent/Koha/EDI.t 2. Verify all tests pass without warnings 3. Confirm auto-orders blocking works correctly for duplicate PO numbers --- Koha/EDI.pm | 8 ++++---- t/db_dependent/Koha/EDI.t | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Koha/EDI.pm b/Koha/EDI.pm index 87bd0b14813..8d0dc84e3c3 100644 --- a/Koha/EDI.pm +++ b/Koha/EDI.pm @@ -782,14 +782,14 @@ sub process_quote { my $basketno = $added_baskets[$i]; # Check if this basket has a PO number conflict - if ( exists $baskets_with_po_conflicts{$b} ) { - my $conflict_info = $baskets_with_po_conflicts{$b}; - $logger->warn( "Auto-order blocked for basket $b due to duplicate PO number '" + if ( exists $baskets_with_po_conflicts{$basketno} ) { + my $conflict_info = $baskets_with_po_conflicts{$basketno}; + $logger->warn( "Auto-order blocked for basket $basketno due to duplicate PO number '" . $conflict_info->{po_number} . "' (existing basket: " . $conflict_info->{existing_basket} . ")" ); - $logger->info("Basket $b remains open due to PO number conflict"); + $logger->info("Basket $basketno remains open due to PO number conflict"); next; } diff --git a/t/db_dependent/Koha/EDI.t b/t/db_dependent/Koha/EDI.t index a608dbae2d5..9c8b9d02b12 100755 --- a/t/db_dependent/Koha/EDI.t +++ b/t/db_dependent/Koha/EDI.t @@ -38,7 +38,7 @@ my $builder = t::lib::TestBuilder->new; my $logger = t::lib::Mocks::Logger->new(); subtest 'process_quote' => sub { - plan tests => 7; + plan tests => 8; $schema->storage->txn_begin; -- 2.51.0