From 9e7fe7545f9ddc76b1396237d7e50399d4b5988a 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 --- 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 fcfe29d0ff4..347c58251f2 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.34.1