From b29609507cf831208cf622f646043597f34813c7 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 11 Feb 2021 15:23:41 +0000 Subject: [PATCH] Bug 14233: (follow-up) Fix for delete entire notice This fixes the overall notice delete option. --- tools/letter.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/letter.pl b/tools/letter.pl index 4321f9ee81..1641f55252 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -363,20 +363,22 @@ sub delete_confirm { } sub delete_confirmed { - my ($branchcode, $module, $code, $mtt, $lang) = @_; - my $letter = Koha::Notice::Templates->find( + my ( $branchcode, $module, $code, $mtt, $lang ) = @_; + my $letters = Koha::Notice::Templates->search( { - branchcode => $branchcode || '', - module => $module, - code => $code, - message_transport_type => $mtt, - lang => $lang, + branchcode => $branchcode || '', + module => $module, + code => $code, + ( $mtt ? ( message_transport_type => $mtt ) : () ), + ( $lang ? ( lang => $lang ) : () ), } ); - if ( $letter ) { - logaction('NOTICES', 'DELETE', $letter->id, $letter->content, 'Intranet'); + while ( my $letter = $letters->next ) { + logaction( 'NOTICES', 'DELETE', $letter->id, $letter->content, + 'Intranet' ); $letter->delete; } + # setup default display for screen default_display($branchcode); return; -- 2.20.1