From d0ef15717f0d6ea0b9e0406e865631d17e1f585a Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 14 Jul 2023 10:20:27 -0300 Subject: [PATCH] Bug 30979: Fix regression This patch fixes a regression introduced by the 'Fix public availability 500' follow-up. To test: 1. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/checkouts.t => FAIL: Tests fail! 2. Apply this patch 3. Repeat 1 => SUCCESS: Tests pass! Tests are useful! 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/Checkouts.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm index 1571c227b6..f6b69055e8 100644 --- a/Koha/REST/V1/Checkouts.pm +++ b/Koha/REST/V1/Checkouts.pm @@ -160,9 +160,12 @@ sub get_availability { my ( $impossible, $confirmation, $warnings ) = $c->_check_availability( $patron, $item ); - my $confirm_keys = join( ":", sort keys %{$confirmation} ); - $confirm_keys = $user ? $user->id : '' . ":" . $item->id . ":" . $confirm_keys; - my $token = Koha::Token->new->generate_jwt( { id => $confirm_keys } ); + my @confirm_keys = sort keys %{$confirmation}; + unshift @confirm_keys, $item->id; + unshift @confirm_keys, $user->id + if $user; + + my $token = Koha::Token->new->generate_jwt( { id => join( ':', @confirm_keys ) } ); my $response = { blockers => $impossible, -- 2.39.5