Lines 19-24
Link Here
|
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
20 |
|
21 |
use Modern::Perl; |
21 |
use Modern::Perl; |
|
|
22 |
|
23 |
use Try::Tiny; |
22 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
23 |
use C4::Context; |
25 |
use C4::Context; |
24 |
use C4::Output qw( output_html_with_http_headers ); |
26 |
use C4::Output qw( output_html_with_http_headers ); |
Lines 28-33
use Date::Calc qw( Date_to_Days Today );
Link Here
|
28 |
use C4::Reserves qw( ModReserve ModReserveCancelAll ); |
30 |
use C4::Reserves qw( ModReserve ModReserveCancelAll ); |
29 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
31 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
30 |
use Koha::BiblioFrameworks; |
32 |
use Koha::BiblioFrameworks; |
|
|
33 |
use Koha::Hold::CancellationRequests; |
31 |
use Koha::Items; |
34 |
use Koha::Items; |
32 |
use Koha::ItemTypes; |
35 |
use Koha::ItemTypes; |
33 |
use Koha::Patrons; |
36 |
use Koha::Patrons; |
Lines 44-49
my $cancelall = $input->param('cancelall');
Link Here
|
44 |
my $tab = $input->param('tab'); |
47 |
my $tab = $input->param('tab'); |
45 |
my $cancelBulk = $input->param('cancelBulk'); |
48 |
my $cancelBulk = $input->param('cancelBulk'); |
46 |
|
49 |
|
|
|
50 |
my $reject_hold_cancellation_id = $input->param('reject_hold_cancellation_id'); |
51 |
|
47 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
52 |
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( |
48 |
{ |
53 |
{ |
49 |
template_name => "circ/waitingreserves.tt", |
54 |
template_name => "circ/waitingreserves.tt", |
Lines 73-78
if ( C4::Context->preference('IndependentBranches') ) {
Link Here
|
73 |
} |
78 |
} |
74 |
$template->param( all_branches => 1 ) if $all_branches; |
79 |
$template->param( all_branches => 1 ) if $all_branches; |
75 |
|
80 |
|
|
|
81 |
# handle cancellation requests rejection |
82 |
if ($reject_hold_cancellation_id) { |
83 |
try { |
84 |
Koha::Holds |
85 |
->find( $reject_hold_cancellation_id ) |
86 |
->cancellation_requests |
87 |
->filter_by_current |
88 |
->reject( $loggedinuser ); |
89 |
} |
90 |
catch { |
91 |
if ( $_->isa('Koha::Exceptions::InvalidStatus') ) { |
92 |
$template->param( reject_result_error => { invalid_status => $_->invalid_status } ); |
93 |
} |
94 |
else { |
95 |
$template->param( reject_result_error => { unkown_error => "$_" } ); |
96 |
warn "Unhandled exception when trying to reject a hold cancellation request: $_"; |
97 |
} |
98 |
}; |
99 |
} |
100 |
|
76 |
if ($cancelBulk) { |
101 |
if ($cancelBulk) { |
77 |
my $reason = $input->param("cancellation-reason"); |
102 |
my $reason = $input->param("cancellation-reason"); |
78 |
my @hold_ids = split( ',', scalar $input->param("ids") ); |
103 |
my @hold_ids = split( ',', scalar $input->param("ids") ); |
Lines 116-121
while ( my $hold = $holds->next ) {
Link Here
|
116 |
|
141 |
|
117 |
} |
142 |
} |
118 |
|
143 |
|
|
|
144 |
my $holds_with_cancellation_requests = Koha::Holds->waiting->filter_by_has_pending_cancellation_requests; |
145 |
|
119 |
$template->param(cancel_result => \@cancel_result) if @cancel_result; |
146 |
$template->param(cancel_result => \@cancel_result) if @cancel_result; |
120 |
|
147 |
|
121 |
$template->param( |
148 |
$template->param( |
Lines 123-128
$template->param(
Link Here
|
123 |
reservecount => scalar @reserve_loop, |
150 |
reservecount => scalar @reserve_loop, |
124 |
overloop => \@over_loop, |
151 |
overloop => \@over_loop, |
125 |
overcount => scalar @over_loop, |
152 |
overcount => scalar @over_loop, |
|
|
153 |
cancel_reqs_count => $holds_with_cancellation_requests->count, |
154 |
cancel_reqs => $holds_with_cancellation_requests, |
126 |
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), |
155 |
show_date => output_pref({ dt => dt_from_string, dateformat => 'iso', dateonly => 1 }), |
127 |
tab => $tab, |
156 |
tab => $tab, |
128 |
); |
157 |
); |