Lines 68-81
my $transfer_when_cancel_all = C4::Context->preference('TransferWhenCancelAllWai
Link Here
|
68 |
$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all; |
68 |
$template->param( TransferWhenCancelAllWaitingHolds => 1 ) if $transfer_when_cancel_all; |
69 |
|
69 |
|
70 |
my @cancel_result; |
70 |
my @cancel_result; |
|
|
71 |
my @messages; |
72 |
my $number_of_holds_cancelled; |
71 |
# if we have a return from the form we cancel the holds |
73 |
# if we have a return from the form we cancel the holds |
72 |
if ( $op eq 'cancel_reserve' and $item) { |
74 |
if ( $op eq 'cancel_reserve' and $item) { |
73 |
my $res = cancel( $item, $borrowernumber, $fbr, $tbr ); |
75 |
my $next_res = cancel( $item, $borrowernumber, $fbr, $tbr ); |
74 |
push @cancel_result, $res if $res; |
76 |
push @cancel_result, $next_res if $next_res; |
|
|
77 |
$number_of_holds_cancelled++; |
75 |
} elsif ( $op =~ m|^mark_as_lost| ) { |
78 |
} elsif ( $op =~ m|^mark_as_lost| ) { |
76 |
my $reserve_id = $input->param('reserve_id'); |
79 |
my $reserve_id = $input->param('reserve_id'); |
77 |
my $hold = Koha::Holds->find( $reserve_id ); |
80 |
my $hold = Koha::Holds->find( $reserve_id ); |
78 |
die "wrong reserve_id" unless $hold; |
81 |
die "wrong reserve_id" unless $hold; # This is a bit rude, but we are not supposed to get a wrong reserve_id |
79 |
if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { |
82 |
if ( C4::Context->preference('CanMarkHoldsAwaitingPickupAsLost') =~ m|^yes| ) { |
80 |
my $itemnumber = $hold->item->itemnumber; |
83 |
my $itemnumber = $hold->item->itemnumber; |
81 |
my $patron = $hold->borrower; |
84 |
my $patron = $hold->borrower; |
Lines 106-117
if ( $op eq 'cancel_reserve' and $item) {
Link Here
|
106 |
from_address => $admin_email_address, |
109 |
from_address => $admin_email_address, |
107 |
} |
110 |
} |
108 |
); |
111 |
); |
|
|
112 |
unless ( C4::Members::GetNoticeEmailAddress( $patron->borrowernumber ) ) { |
113 |
push @messages, {type => 'alert', code => 'no_email_address', }; |
114 |
} |
115 |
push @messages, { type => 'message', code => 'letter_enqueued' }; |
116 |
} else { |
117 |
push @messages, { type => 'error', code => 'no_template_notice' }; |
109 |
} |
118 |
} |
110 |
} |
119 |
} |
111 |
my $res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); |
120 |
my $next_res = cancel( $itemnumber, $patron->borrowernumber, $fbr, $tbr ); |
112 |
push @cancel_result, $res if $res; |
121 |
push @cancel_result, $next_res if $next_res; |
113 |
}# else the url parameters have been modified and the user is not allowed to continue |
122 |
}# else the url parameters have been modified and the user is not allowed to continue |
114 |
|
|
|
115 |
} |
123 |
} |
116 |
|
124 |
|
117 |
if ( C4::Context->preference('IndependentBranches') ) { |
125 |
if ( C4::Context->preference('IndependentBranches') ) { |
Lines 182-187
foreach my $num (@getreserves) {
Link Here
|
182 |
if ($op eq 'cancel_all') { |
190 |
if ($op eq 'cancel_all') { |
183 |
my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); |
191 |
my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all ); |
184 |
push @cancel_result, $res if $res; |
192 |
push @cancel_result, $res if $res; |
|
|
193 |
$number_of_holds_cancelled++; |
185 |
next; |
194 |
next; |
186 |
} else { |
195 |
} else { |
187 |
push @overloop, \%getreserv; |
196 |
push @overloop, \%getreserv; |
Lines 194-199
foreach my $num (@getreserves) {
Link Here
|
194 |
|
203 |
|
195 |
} |
204 |
} |
196 |
|
205 |
|
|
|
206 |
if ( $number_of_holds_cancelled ) { |
207 |
if ( $number_of_holds_cancelled == 1 ) { |
208 |
push @messages, { type => 'message', code => 'hold_cancelled' }; |
209 |
} else { |
210 |
push @messages, { type => 'message', code => 'holds_cancelled' }; |
211 |
} |
212 |
} |
197 |
$template->param(cancel_result => \@cancel_result) if @cancel_result; |
213 |
$template->param(cancel_result => \@cancel_result) if @cancel_result; |
198 |
$template->param( |
214 |
$template->param( |
199 |
reserveloop => \@reservloop, |
215 |
reserveloop => \@reservloop, |
Lines 203-208
$template->param(
Link Here
|
203 |
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), |
219 |
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), |
204 |
ReservesMaxPickUpDelay => $max_pickup_delay, |
220 |
ReservesMaxPickUpDelay => $max_pickup_delay, |
205 |
tab => $tab, |
221 |
tab => $tab, |
|
|
222 |
messages => \@messages, |
206 |
); |
223 |
); |
207 |
|
224 |
|
208 |
# Checking if there is a Fast Cataloging Framework |
225 |
# Checking if there is a Fast Cataloging Framework |