From 73ef62a6ae66079ee7b441b322d9097ebbc3de66 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 19 Apr 2022 11:48:14 +0000 Subject: [PATCH] Bug 24865: (QA follow-up) Remove hardcoded notice name from protected_letters Content-Type: text/plain; charset=utf-8 If the letter has been removed, fall back to itemnumber/due date. (Title is no longer fetched.) We may assume that the notice is present. Note: The option to 'protect' a notice may need some more thought. Perhaps it needs to be an attribute on itself. Signed-off-by: Marcel de Rooy Tested by deleting notice, running fines again. --- C4/Overdues.pm | 5 +++-- tools/letter.pl | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/C4/Overdues.pm b/C4/Overdues.pm index afa270651d..6375ffc271 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -599,7 +599,7 @@ sub UpdateFine { } else { if ( $amount ) { # Don't add new fines with an amount of 0 my $patron = Koha::Patrons->find( $borrowernumber ); - my $desc = C4::Letters::GetPreparedLetter( + my $letter = eval { C4::Letters::GetPreparedLetter( module => 'circulation', letter_code => 'OVERDUE_FINE_DESC', message_transport_type => 'print', @@ -609,7 +609,8 @@ sub UpdateFine { borrowers => $borrowernumber, items => $itemnum, }, - )->{content}; + ) }; + my $desc = $letter ? $letter->{content} : "Item $itemnum - due $due"; my $account = Koha::Account->new({ patron_id => $borrowernumber }); $accountline = $account->add_debit( diff --git a/tools/letter.pl b/tools/letter.pl index d46ddd25d6..1b6f39ae89 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -56,10 +56,7 @@ use Koha::Patron::Attribute::Types; sub protected_letters { my $dbh = C4::Context->dbh; my $codes = $dbh->selectall_arrayref(q{SELECT DISTINCT letter_code FROM message_transports}); - return { - OVERDUE_FINE_DESC => 1, - map { $_->[0] => 1 } @{$codes} - }; + return { map { $_->[0] => 1 } @{$codes} }; } our $input = CGI->new; -- 2.20.1