From 0fde0ad8a9cb3fea8fda80a50b329552c3461401 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 27 Nov 2017 00:27:19 +0000 Subject: [PATCH] Bug 19532: Send notice to user to return a recalled item When the recall is placed in the OPAC, a RETURN_RECALLED_ITEM notice is sent to the user who has the item checked out, with the updated due date. Signed-off-by: Nick Clemens --- opac/opac-recall.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/opac/opac-recall.pl b/opac/opac-recall.pl index 76a324c..8264506 100755 --- a/opac/opac-recall.pl +++ b/opac/opac-recall.pl @@ -75,7 +75,22 @@ if ($op eq 'request'){ # updating due date on checkout my $timestamp = dt_from_string($recall->timestamp); my $due_date = $timestamp->add( $issuing_rule->lengthunit => $issuing_rule->recall_due_date_interval ); - Koha::Checkouts->find({ itemnumber => $itemnumber })->update({ date_due => $due_date }); + my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber })->update({ date_due => $due_date }); + my $checkout_borrower = Koha::Patrons->find($checkout->borrowernumber->borrowernumber); + + # send notice to user with recalled item checked out + my $letter = C4::Letters::GetPreparedLetter ( + module => 'circulation', + letter_code => 'RETURN_RECALLED_ITEM', + branchcode => $recall->branchcode, + tables => { + 'biblio', $biblio->biblionumber, + 'borrowers', $checkout_borrower->borrowernumber, + 'items', $itemnumber, + 'issues', $itemnumber, + }, + ); + C4::Message->enqueue($letter, $checkout_borrower->unblessed, 'email'); $template->param( success => 1, -- 2.1.4