From 070b0156981846adc2c08923906d84fecb46c846 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. Signed-off-by: Kelly McElligott Signed-off-by: David Nind Signed-off-by: Kyle M Hall --- tools/letter.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tools/letter.pl b/tools/letter.pl index d651ca77c4..e49e2f1bc2 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.24.1 (Apple Git-126)