Bug 17617: Confirmation email to patron when hold is placed
This enhancement adds a new notice HOLDPLACED_PATRON that will be sent to a patron when a hold is placed for them. It depends on the new system preference EmailPatronWhenHoldIsPlaced to be enabled. To test: 1) Update database and restart services 2) Go to Koha Administration -> System preferences and search for the new EmailPatronWhenHoldIsPlaced syspref. It should be disabled by default - leave it disabled for now. 3) Search for a record and go to the Holds tab. Place a hold for your patron. 4) Go to your patron's account and go to the Notices tab. Confirm the HOLDPLACED_PATRON notice was NOT queued. 5) Enable the EmailPatronWhenHoldIsPlaced syspref. 6) Repeat steps 3 and 4. Confirm the HOLDPLACED_PATRON notice WAS generated and queued. 7) Confirm tests pass t/db_dependent/Holds.t Sponsored-by: Fire and Emergency New Zealand Signed-off-by: Kelly <kelly@bywatersolutions.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
9e865b9f03
commit
30c375ae8b
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Reference in New Issue