@@ -, +, @@
notice will be sent when cancelling a hold
---
C4/Reserves.pm | 3 ++-
Koha/Hold.pm | 2 +-
circ/pendingreserves.pl | 3 ++-
.../prog/en/modules/circ/pendingreserves.tt | 3 +++
.../intranet-tmpl/prog/en/modules/reserve/request.tt | 10 ++++++++++
reserve/modrequest.pl | 3 +++
reserve/request.pl | 3 ++-
7 files changed, 23 insertions(+), 4 deletions(-)
--- a/C4/Reserves.pm
+++ a/C4/Reserves.pm
@@ -1098,6 +1098,7 @@ sub ModReserve {
my $biblionumber = $params->{'biblionumber'};
my $cancellation_reason = $params->{'cancellation_reason'};
my $date = $params->{expirationdate};
+ my $notify_patron = $params->{'notify_patron'};
return if defined $rank && $rank eq "n";
@@ -1117,7 +1118,7 @@ sub ModReserve {
Koha::Exceptions::ObjectNotFound->throw( 'No hold with id ' . $reserve_id ) unless $hold;
if ( $rank eq "del" ) {
- $hold->cancel({ cancellation_reason => $cancellation_reason });
+ $hold->cancel({ cancellation_reason => $cancellation_reason, notify_patron => $notify_patron });
}
elsif ($hold->found && $hold->priority eq '0' && $date) {
logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold )
--- a/Koha/Hold.pm
+++ a/Koha/Hold.pm
@@ -649,7 +649,7 @@ sub cancel {
$self->cancellation_reason( $params->{cancellation_reason} );
$self->store();
- if ( $params->{cancellation_reason} ) {
+ if ( $params->{cancellation_reason} && $params->{notify_patron} ) {
my $letter = C4::Letters::GetPreparedLetter(
module => 'reserves',
letter_code => 'HOLD_CANCELLATION',
--- a/circ/pendingreserves.pl
+++ a/circ/pendingreserves.pl
@@ -57,7 +57,8 @@ if ( $op eq 'cancel_reserve' and $reserve_id ) {
my $hold = Koha::Holds->find( $reserve_id );
if ( $hold ) {
my $cancellation_reason = $input->param('cancellation-reason');
- $hold->cancel({ cancellation_reason => $cancellation_reason });
+ my $cancellation_notify_patron = $input->param('cancellation-notify-patron');
+ $hold->cancel({ cancellation_reason => $cancellation_reason, notify_patron => $cancellation_notify_patron });
push @messages, { type => 'message', code => 'hold_cancelled' };
}
} elsif ( $op =~ m|^mark_as_lost| ) {
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt
@@ -198,6 +198,9 @@
[% END %]
+
+
+
[% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
@@ -1023,6 +1023,9 @@
[% END %]
+
+
+
[% END %]
@@ -1209,6 +1212,9 @@
[% END %]
+
+
+
[% END %]
@@ -1585,9 +1591,13 @@
link = `request.pl?action=cancel&borrowernumber=${ borrowernumber }&biblionumber=${ biblionumber }&reserve_id=${ reserve_id }`;
}
let reason = $("#modal-cancellation-reason").val();
+ let notify = $("#modal-cancellation-notify-patron").prop('checked');
if ( reason ) {
link += "&cancellation-reason=" + reason
}
+ if ( notify ) {
+ link += "&cancellation-notify-patron=1";
+ }
window.location.href = link;
return false;
});
--- a/reserve/modrequest.pl
+++ a/reserve/modrequest.pl
@@ -74,6 +74,8 @@ else {
undef $itemnumber[$i] if !$itemnumber[$i];
my $suspend_until = $query->param( "suspend_until_" . $reserve_id[$i] );
my $cancellation_reason = $query->param("cancellation-reason");
+ my $cancellation_notify_patron = $query->param("cancellation-notify-patron");
+
my $params = {
rank => $rank[$i],
reserve_id => $reserve_id[$i],
@@ -82,6 +84,7 @@ else {
itemnumber => $itemnumber[$i],
defined $suspend_until ? ( suspend_until => $suspend_until ) : (),
cancellation_reason => $cancellation_reason,
+ notify_patron => $cancellation_notify_patron,
};
if (C4::Context->preference('AllowHoldDateInFuture')) {
$params->{reservedate} = $reservedates[$i] ? dt_from_string($reservedates[$i]) : undef;
--- a/reserve/request.pl
+++ a/reserve/request.pl
@@ -115,8 +115,9 @@ if ( $action eq 'move' ) {
elsif ( $action eq 'cancel' ) {
my $reserve_id = $input->param('reserve_id');
my $cancellation_reason = $input->param("cancellation-reason");
+ my $cancellation_notify_patron = $input->param("cancellation-notify-patron");
my $hold = Koha::Holds->find($reserve_id);
- $hold->cancel( { cancellation_reason => $cancellation_reason } ) if $hold;
+ $hold->cancel( { cancellation_reason => $cancellation_reason, notify_patron => $cancellation_notify_patron } ) if $hold;
}
elsif ( $action eq 'setLowestPriority' ) {
my $reserve_id = $input->param('reserve_id');
--