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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2025-10-14 11:51:42 +01:00 committed by Lucas Gass
parent e5add0fd96
commit ebfca0edb4
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}

View File

@ -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;