diff --git a/C4/Reserves.pm b/C4/Reserves.pm index d86e9f46f9..872abfa13b 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -166,7 +166,7 @@ BEGIN { } ); -Adds reserve and generates HOLDPLACED message. +Adds reserve and generates HOLDPLACED message and HOLDPLACED_PATRON message. The following tables are available witin the HOLDPLACED message: @@ -177,6 +177,11 @@ The following tables are available witin the HOLDPLACED message: items reserves +The following tables are available within the HOLDPLACED_PATRON message: + + borrowers + reserves + =cut sub AddReserve { @@ -306,6 +311,33 @@ sub AddReserve { } } + # Send email to patron if syspref is active + if ( C4::Context->preference("EmailPatronWhenHoldIsPlaced") ) { + my $patron = $hold->patron; + if ( + my $letter = C4::Letters::GetPreparedLetter( + module => 'reserves', + letter_code => 'HOLDPLACED_PATRON', + branchcode => $branch, + lang => $patron->lang, + tables => { + borrowers => $patron->unblessed, + reserves => $hold->unblessed, + }, + ) + ) + { + C4::Letters::EnqueueLetter( + { + letter => $letter, + borrowernumber => $borrowernumber, + message_transport_type => 'email', + to_address => $patron->notice_email_address, + } + ); + } + } + Koha::Plugins->call('after_hold_create', $hold); Koha::Plugins->call( 'after_hold_action',