From ca63a9ce01885bf38bb9fc57d339e5c3f387efe4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 15 Sep 2025 10:40:44 +0200 Subject: [PATCH] Bug 37622: Fix add_debit We should not call discard_changes after accessing ->id but before Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- Koha/REST/V1/Patrons/Account.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/REST/V1/Patrons/Account.pm b/Koha/REST/V1/Patrons/Account.pm index f0f6ac17eb4..71bc9f3c7bc 100644 --- a/Koha/REST/V1/Patrons/Account.pm +++ b/Koha/REST/V1/Patrons/Account.pm @@ -220,9 +220,9 @@ sub add_debit { my $debit = $patron->account->add_debit($data); $debit = Koha::Account::Debit->_new_from_dbic( $debit->{_result} ); + $debit->discard_changes; $c->res->headers->location( $c->req->url->to_string . '/' . $debit->id ); - $debit->discard_changes; return $c->render( status => 201, -- 2.51.0