@@ -, +, @@ --- circ/waitingreserves.pl | 29 ++++++++++++++++---- .../prog/en/modules/circ/waitingreserves.tt | 32 ++++++++++++++++++---- 2 files changed, 49 insertions(+), 12 deletions(-) --- a/circ/waitingreserves.pl +++ a/circ/waitingreserves.pl @@ -68,14 +68,17 @@ my $transfer_when_cancel_all = C4::Context->preference('TransferWhenCancelAllWai $template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all; my @cancel_result; +my @messages; +my $number_of_holds_cancelled; # if we have a return from the form we cancel the holds if ( $op eq 'cancel_reserve' and $item) { - my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); - push @cancel_result, $res if $res; + my $next_res = cancel( $item, $borrowernumber, $fbr, $tbr ); + push @cancel_result, $next_res if $next_res; + $number_of_holds_cancelled++; } elsif ( $op =~ m|^mark_as_lost| ) { my $reserve_id = $input->param('reserve_id'); my $hold = Koha::Holds->find( $reserve_id ); - die "wrong reserve_id" unless $hold; + die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { my $itemnumber = $hold->item->itemnumber; my $patron = $hold->borrower; @@ -106,12 +109,17 @@ if ( $op eq 'cancel_reserve' and $item) { from_address => $admin_email_address, } ); + unless ( C4::Members::GetNoticeEmailAddress( $patron->borrowernumber ) ) { + push @messages, {type => 'alert', code => 'no_email_address', }; + } + push @messages, { type => 'message', code => 'letter_enqueued' }; + } else { + push @messages, { type => 'error', code => 'no_template_notice' }; } } - my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); - push @cancel_result, $res if $res; + my $next_res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); + push @cancel_result, $next_res if $next_res; }# else the url parameters have been modified and the user is not allowed to continue - } if ( C4::Context->preference('IndependentBranches') ) { @@ -182,6 +190,7 @@ foreach my $num (@getreserves) { if ($op eq 'cancel_all') { my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); push @cancel_result, $res if $res; + $number_of_holds_cancelled++; next; } else { push @overloop, \%getreserv; @@ -194,6 +203,13 @@ foreach my $num (@getreserves) { } +if ( $number_of_holds_cancelled ) { + if ( $number_of_holds_cancelled == 1 ) { + push @messages, { type => 'message', code => 'hold_cancelled' }; + } else { + push @messages, { type => 'message', code => 'holds_cancelled' }; + } +} $template->param(cancel_result => \@cancel_result) if @cancel_result; $template->param( reserveloop => \@reservloop, @@ -203,6 +219,7 @@ $template->param( show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), ReservesMaxPickUpDelay => $max_pickup_delay, tab => $tab, + messages => \@messages, ); # Checking if there is a Fast Cataloging Framework --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -40,12 +40,25 @@ [% IF Koha.Preference('CircSidebar') %]
[% END %]
-

Holds awaiting pickup for your library on: [% show_date | $KohaDates %] - [% IF ( all_branches_link ) %] - - View all libraries - [% END %] -

+ [% FOR m IN messages %] +
+ [% SWITCH m.code %] + [% CASE 'letter_enqueued' %] + The notice has been correctly enqueued. + [% CASE 'no_email_address' %] + The patron does not have an email address defined. + [% CASE 'no_template_notice' %] + There is no notice template with a code 'CANCEL_HOLD_ON_LOST' defined in your system. + [% CASE 'hold_cancelled' %] + The hold has been correctly cancelled. + [% CASE 'holds_cancelled' %] + All the holds has been correctly cancelled.. + [% CASE %] + [% m.code %] + [% END %] +
+ [% END %] + [% IF ( cancel_result ) %] [% FOREACH cancel_result %] [% IF ( messagetransfert ) %] @@ -72,6 +85,13 @@ [% END %] [% END %] [% ELSE %] +

Holds awaiting pickup for your library on: [% show_date | $KohaDates %] + [% IF ( all_branches_link ) %] + + View all libraries + [% END %] +

+