From b210605ef79d54e1a98a542b6d758ce05c9a0244 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 8 Sep 2026 14:53:09 +0100 Subject: [PATCH] Bug 30144: (QA follow-up) Fix t/Ediorder.t for JSON servicing_instruction format Bug 30144 changed Koha::Edifact::Order::gir_segments() to expect servicing_instruction as a JSON-encoded array of instruction groups (added by Bug 41709 while working with the older plain-string format that predated Bug 30144's change was never adapted to match). As a plain string no longer decodes as JSON, gir_segments() silently skipped the servicing instruction elements, leaving the GIR split and special-character tests comparing against undef. Test plan: 1. prove t/Ediorder.t => 4 tests failed before this patch, all pass after 2. prove t/db_dependent/Koha/Edifact/Order.t => still passes Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- t/Ediorder.t | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/Ediorder.t b/t/Ediorder.t index eadcfa0aea..6de791c097 100755 --- a/t/Ediorder.t +++ b/t/Ediorder.t @@ -3,6 +3,8 @@ use strict; use warnings; use FindBin qw( $Bin ); +use JSON qw( encode_json ); + use Test::NoWarnings; use Test::More tests => 16; use t::lib::Mocks; @@ -119,7 +121,7 @@ cmp_ok( 'Single Gir field OK' ); -$orderfields->{servicing_instruction} = 'S_I'; +$orderfields->{servicing_instruction} = encode_json( [ [ { type => 'LVT', value => 'S_I' } ] ] ); @gsegs = Koha::Edifact::Order::gir_segments( { ol_fields => $orderfields, @@ -140,7 +142,7 @@ cmp_ok( # Test that special characters are properly escaped in GIR segments my $special_orderfields = { budget_code => 'BUDGET?+', - servicing_instruction => "Note with 'special' chars:", + servicing_instruction => encode_json( [ [ { type => 'LVT', value => "Note with 'special' chars:" } ] ] ), }; my @special_items = ( {