From eb549930fd7fce771f1cbfa89c8de113725ecccb Mon Sep 17 00:00:00 2001 From: Olli-Antti Kivilahti Date: Sun, 14 Sep 2014 12:12:28 +0300 Subject: [PATCH 3/6] Bug 12353 - Last pickup date in the letter templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TEST PLAN: PREPARE THE LETTER: 1. Go to Home › Tools › Notices & Slips. 2. Edit letter template with code HOLD. 3. Add the <> placeholder to different template types. SEND AND RECEIVE THE LETTER: 1. Create a reservation for a Borrower with pickup branch. 2. Make sure the borrower receives "Hold waiting for pickup"-notices using the message _transport_Type on which you added the <> -placeholder. 3. Check-in the corresponding Item in the pickup branch and confirm the hold for the Borrower 4. Wait for the message to be delivered and observe your <> being replaced with a date. --- C4/Reserves.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 08f452a..b7af359 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1874,6 +1874,8 @@ sub _koha_notify_reserve { my $admin_email_address = $branch_details->{'branchemail'} || C4::Context->preference('KohaAdminEmailAddress'); + my $expiration = _reserve_last_pickup_date($reserve); + my %letter_params = ( module => 'reserves', branchcode => $reserve->{branchcode}, @@ -1884,7 +1886,10 @@ sub _koha_notify_reserve { 'reserves' => $reserve, 'items', $reserve->{'itemnumber'}, }, - substitute => { today => C4::Dates->new()->output() }, + substitute => { + today => C4::Dates->new()->output(), + lastpickupdate => C4::Dates->new($expiration->ymd(), 'iso')->output() + }, ); my $notification_sent = 0; #Keeping track if a Hold_filled message is sent. If no message can be sent, then default to a print message. @@ -2218,6 +2223,8 @@ sub ReserveSlip { }) or return; my $reserve = GetReserveInfo($reserve_id) or return; + my $expiration = _reserve_last_pickup_date($reserve); + return C4::Letters::GetPreparedLetter ( module => 'circulation', letter_code => $transfer ? 'TRANSFERSLIP' : 'RESERVESLIP', @@ -2229,6 +2236,9 @@ sub ReserveSlip { 'biblio' => $reserve->{biblionumber}, 'items' => $reserve->{itemnumber}, }, + substitute => { + lastpickupdate => C4::Dates->new($expiration->ymd(), 'iso')->output() + }, ); } -- 1.7.9.5