From 993508e951544c2c74e8576e9d551f52db6fe37d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 25 Mar 2019 19:04:08 +0000 Subject: [PATCH] Bug 22577: Prevent deletion of system users --- Koha/Patron.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index eeaf0e4dc2..33056d7483 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -317,6 +317,11 @@ other lists are kept. sub delete { my ($self) = @_; + unless ( $self->borrowernumber > 0 ) { + Koha::Exceptions::CannotDeleteDefault->throw( + { message => "Cannot delete system user" } ); + } + my $deleted; $self->_result->result_source->schema->txn_do( sub { -- 2.20.1