Bug 27145: Wrap delete and move_to_deleted in a transaction
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
83dcdf2a5a
commit
6fdf64e06b
1 changed files with 10 additions and 3 deletions
|
@ -127,11 +127,18 @@ if ( $op eq 'delete_confirm' or $countissues > 0 or $debits or $is_guarantor ) {
|
|||
session_id => $input->cookie('CGISESSID'),
|
||||
token => scalar $input->param('csrf_token'),
|
||||
});
|
||||
|
||||
my $patron = Koha::Patrons->find( $member );
|
||||
$patron->move_to_deleted;
|
||||
|
||||
try {
|
||||
$patron->delete;
|
||||
print $input->redirect("/cgi-bin/koha/members/members-home.pl");
|
||||
my $schema = Koha::Database->new->schema;
|
||||
$schema->txn_do(
|
||||
sub {
|
||||
$patron->move_to_deleted;
|
||||
$patron->delete;
|
||||
print $input->redirect( "/cgi-bin/koha/members/members-home.pl" );
|
||||
}
|
||||
);
|
||||
}
|
||||
catch {
|
||||
if ( $_->isa('Koha::Exceptions::Patron::FailedDeleteAnonymousPatron') ) {
|
||||
|
|
Loading…
Reference in a new issue