@@ -, +, @@ You will have access to the objects checkout, item, and borrower --- C4/Overdues.pm | 23 ++++++++++++------- .../data/mysql/atomicupdate/bug_24865.pl | 15 ++++++++++++ .../mysql/en/mandatory/sample_notices.yml | 11 +++++++++ tools/letter.pl | 5 +++- 4 files changed, 45 insertions(+), 9 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_24865.pl --- a/C4/Overdues.pm +++ a/C4/Overdues.pm @@ -27,12 +27,13 @@ use POSIX qw( ceil floor ); use Locale::Currency::Format 1.28 qw( currency_format FMT_SYMBOL ); use Carp qw( carp ); -use C4::Context; use C4::Accounts; -use Koha::Logger; +use C4::Context; use Koha::Account::Lines; use Koha::Account::Offsets; use Koha::Libraries; +use Koha::Logger; +use Koha::Patrons; our (@ISA, @EXPORT_OK); BEGIN { @@ -575,12 +576,18 @@ sub UpdateFine { } } else { if ( $amount ) { # Don't add new fines with an amount of 0 - my $sth4 = $dbh->prepare( - "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?" - ); - $sth4->execute($itemnum); - my $title = $sth4->fetchrow; - my $desc = "$title $due"; + my $patron = Koha::Patrons->find( $borrowernumber ); + my $desc = C4::Letters::GetPreparedLetter( + module => 'circulation', + letter_code => 'OVERDUE_FINE_DESC', + message_transport_type => 'print', + lang => $patron->lang, + tables => { + issues => $itemnum, + borrowers => $borrowernumber, + items => $itemnum, + }, + )->{content}; my $account = Koha::Account->new({ patron_id => $borrowernumber }); $accountline = $account->add_debit( --- a/installer/data/mysql/atomicupdate/bug_24865.pl +++ a/installer/data/mysql/atomicupdate/bug_24865.pl @@ -0,0 +1,15 @@ +use Modern::Perl; + +return { + bug_number => "24865", + description => "Customize the Accountlines Description", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + INSERT IGNORE INTO letter + (module,code,branchcode,name,is_html,title,content,message_transport_type,lang) + VALUES ('circulation','OVERDUE_FINE_DESC','','Overdue Item Fine Description',0,'Overdue Item Fine Description','[% item.biblio.title %] [% checkout.date_due | $KohaDates %]','print','default') + }); + }, +}; --- a/installer/data/mysql/en/mandatory/sample_notices.yml +++ a/installer/data/mysql/en/mandatory/sample_notices.yml @@ -1540,6 +1540,17 @@ tables: - "

" - "[% END %]" + - module: circulation + code: OVERDUE_FINE_DESC + branchcode: "" + name: "Overdue Item Fine Description" + is_html: 0 + title: "Overdue Item Fine Description" + message_transport_type: print + lang: default + content: + - "[% item.biblio.title %] [% checkout.date_due | $KohaDates %]" + - module: circulation code: AUTO_RENEWALS_DGST branchcode: "" --- a/tools/letter.pl +++ a/tools/letter.pl @@ -56,7 +56,10 @@ 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 { map { $_->[0] => 1 } @{$codes} }; + return { + OVERDUE_FINE_DESC => 1, + map { $_->[0] => 1 } @{$codes} + }; } our $input = CGI->new; --