Bug 24865: (QA follow-up) Remove hardcoded notice name from protected_letters

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 <m.de.rooy@rijksmuseum.nl>
Tested by deleting notice, running fines again.
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Marcel de Rooy 2022-04-19 11:48:14 +00:00 committed by Tomas Cohen Arazi
parent 10fa2db886
commit e579f5019a
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 4 additions and 6 deletions

View File

@ -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(

View File

@ -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;