Bug 37622: Fix add_debit

We should not call discard_changes after accessing ->id but before

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-09-15 10:40:44 +02:00 committed by Lucas Gass
parent a32495bf58
commit 9e8b9f607a
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 1 additions and 1 deletions

View File

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