From cc7b795f840e671e9ed14e2833881d18630e3ce6 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Wed, 27 May 2015 11:52:10 +0200 Subject: [PATCH] Bug 14280: Add branches fields to discharges letters MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently, when generating a discharge letter, branches fields are not translated in the letter (<>, <>, etc.) This patch fixes that. How I tested: - Set syspref 'useDischarge' to 'allow' - Go to Home > Tools > Notices & Slips - Edit DISCHARGE, add to 'Email message':

<>
<>
<>
<>
<> <>

- Go to detail page of a patron > discharge - Click 'Generate discharge' - Verify that the PDF contains the information above. Signed-off-by: Marc Véron Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- Koha/Borrower/Discharge.pm | 2 +- members/discharge.pl | 2 +- opac/opac-discharge.pl | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Koha/Borrower/Discharge.pm b/Koha/Borrower/Discharge.pm index f39475b249..ba0216da1e 100644 --- a/Koha/Borrower/Discharge.pm +++ b/Koha/Borrower/Discharge.pm @@ -95,7 +95,7 @@ sub generate_as_pdf { my $letter = C4::Letters::GetPreparedLetter( module => 'members', letter_code => 'DISCHARGE', - tables => { borrowers => $params->{borrowernumber}, }, + tables => { borrowers => $params->{borrowernumber}, branches => $params->{'branchcode'}, }, ); my $today = output_pref( dt_from_string() ); diff --git a/members/discharge.pl b/members/discharge.pl index 2144af9e51..7c73af9985 100755 --- a/members/discharge.pl +++ b/members/discharge.pl @@ -78,7 +78,7 @@ if ( $input->param('borrowernumber') ) { } eval { my $pdf_path = Koha::Borrower::Discharge::generate_as_pdf( - { borrowernumber => $borrowernumber, } ); + { borrowernumber => $borrowernumber, branchcode => $data->{'branchcode'} } ); binmode(STDOUT); print $input->header( diff --git a/opac/opac-discharge.pl b/opac/opac-discharge.pl index 800222cd4b..5955a3e720 100755 --- a/opac/opac-discharge.pl +++ b/opac/opac-discharge.pl @@ -57,8 +57,12 @@ if ( $op eq 'request' ) { } elsif ( $op eq 'get' ) { eval { + + # Getting member data + my $data = GetMember( borrowernumber => $loggedinuser ); my $pdf_path = Koha::Borrower::Discharge::generate_as_pdf({ - borrowernumber => $loggedinuser + borrowernumber => $loggedinuser, + branchcode => $data->{'branchcode'}, }); binmode(STDOUT); -- 2.39.5