From a258567c16af6a14eba84f2955701f1a80ca5fae Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 25 Oct 2021 09:43:49 -0400 Subject: [PATCH] You cannot commit on error because it releases the locks. --- scripts/ZoneMinder/lib/ZoneMinder/Event.pm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm index 48544a911..c786392ad 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Event.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Event.pm @@ -756,9 +756,9 @@ sub CopyTo { } # end sub CopyTo sub MoveTo { - my ( $self, $NewStorage ) = @_; + my ($self, $NewStorage) = @_; - if ( !$self->canEdit() ) { + if (!$self->canEdit()) { Warning('No permission to move event.'); return 'No permission to move event.'; } @@ -772,11 +772,9 @@ sub MoveTo { $$self{StorageId} = $$NewStorage{Id}; $self->Storage($NewStorage); $error .= $self->save(); - if ( $error ) { - $ZoneMinder::Database::dbh->commit(); + if ($error) { return $error; } - $ZoneMinder::Database::dbh->commit(); $self->delete_files($OldStorage); return $error; } # end sub MoveTo