|
Lines 31-36
use Koha::ILL::Request;
Link Here
|
| 31 |
use Koha::ILL::Batches; |
31 |
use Koha::ILL::Batches; |
| 32 |
use Koha::ILL::Request::Workflow::Availability; |
32 |
use Koha::ILL::Request::Workflow::Availability; |
| 33 |
use Koha::ILL::Request::Workflow::TypeDisclaimer; |
33 |
use Koha::ILL::Request::Workflow::TypeDisclaimer; |
|
|
34 |
use Koha::ILL::Request::Workflow::ConfirmAuto; |
| 34 |
use Koha::Libraries; |
35 |
use Koha::Libraries; |
| 35 |
use Koha::Plugins; |
36 |
use Koha::Plugins; |
| 36 |
|
37 |
|
|
Lines 97-103
if ( $backends_available ) {
Link Here
|
| 97 |
|
98 |
|
| 98 |
if ( $op eq 'illview' ) { |
99 |
if ( $op eq 'illview' ) { |
| 99 |
# View the details of an ILL |
100 |
# View the details of an ILL |
| 100 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
101 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 101 |
|
102 |
|
| 102 |
# Get the details for notices that can be sent from here |
103 |
# Get the details for notices that can be sent from here |
| 103 |
my $notices = Koha::Notice::Templates->search( |
104 |
my $notices = Koha::Notice::Templates->search( |
|
Lines 137-142
if ( $backends_available ) {
Link Here
|
| 137 |
Koha::ILL::Request::Workflow::Availability->new( $params, 'staff' ); |
138 |
Koha::ILL::Request::Workflow::Availability->new( $params, 'staff' ); |
| 138 |
my $type_disclaimer = |
139 |
my $type_disclaimer = |
| 139 |
Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'staff' ); |
140 |
Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'staff' ); |
|
|
141 |
my $confirm_auto = |
| 142 |
Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'staff' ); |
| 140 |
|
143 |
|
| 141 |
# ILLCheckAvailability operation |
144 |
# ILLCheckAvailability operation |
| 142 |
if ($availability->show_availability($request)) { |
145 |
if ($availability->show_availability($request)) { |
|
Lines 150-155
if ( $backends_available ) {
Link Here
|
| 150 |
$template->param( |
153 |
$template->param( |
| 151 |
$type_disclaimer->type_disclaimer_template_params($params) |
154 |
$type_disclaimer->type_disclaimer_template_params($params) |
| 152 |
); |
155 |
); |
|
|
156 |
# ConfirmAuto operation |
| 157 |
} elsif ( $confirm_auto->show_confirm_auto($request)) { |
| 158 |
$op = 'confirmautoill'; |
| 159 |
$template->param( |
| 160 |
$confirm_auto->confirm_auto_template_params($params) |
| 161 |
); |
| 153 |
# Ready to create ILL request |
162 |
# Ready to create ILL request |
| 154 |
} else { |
163 |
} else { |
| 155 |
my $backend_result = $request->backend_create($params); |
164 |
my $backend_result = $request->backend_create($params); |
|
Lines 167-173
if ( $backends_available ) {
Link Here
|
| 167 |
} |
176 |
} |
| 168 |
} elsif ( $op eq 'migrate' ) { |
177 |
} elsif ( $op eq 'migrate' ) { |
| 169 |
# We're in the process of migrating a request |
178 |
# We're in the process of migrating a request |
| 170 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
179 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 171 |
my $backend_result; |
180 |
my $backend_result; |
| 172 |
if ( $params->{backend} ) { |
181 |
if ( $params->{backend} ) { |
| 173 |
$backend_result = $request->backend_migrate($params); |
182 |
$backend_result = $request->backend_migrate($params); |
|
Lines 198-204
if ( $backends_available ) {
Link Here
|
| 198 |
} elsif ( $op eq 'confirm' ) { |
207 |
} elsif ( $op eq 'confirm' ) { |
| 199 |
# Backend 'confirm' method |
208 |
# Backend 'confirm' method |
| 200 |
# confirm requires a specific request, so first, find it. |
209 |
# confirm requires a specific request, so first, find it. |
| 201 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
210 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 202 |
my $backend_result = $request->backend_confirm($params); |
211 |
my $backend_result = $request->backend_confirm($params); |
| 203 |
$template->param( |
212 |
$template->param( |
| 204 |
whole => $backend_result, |
213 |
whole => $backend_result, |
|
Lines 211-217
if ( $backends_available ) {
Link Here
|
| 211 |
} elsif ( $op eq 'cud-cancel' ) { |
220 |
} elsif ( $op eq 'cud-cancel' ) { |
| 212 |
# Backend 'cancel' method |
221 |
# Backend 'cancel' method |
| 213 |
# cancel requires a specific request, so first, find it. |
222 |
# cancel requires a specific request, so first, find it. |
| 214 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
223 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 215 |
my $backend_result = $request->backend_cancel($params); |
224 |
my $backend_result = $request->backend_cancel($params); |
| 216 |
$template->param( |
225 |
$template->param( |
| 217 |
whole => $backend_result, |
226 |
whole => $backend_result, |
|
Lines 227-233
if ( $backends_available ) {
Link Here
|
| 227 |
# (not the Illrequestattributes) |
236 |
# (not the Illrequestattributes) |
| 228 |
# We simulate the API for backend requests for uniformity. |
237 |
# We simulate the API for backend requests for uniformity. |
| 229 |
# So, init: |
238 |
# So, init: |
| 230 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
239 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 231 |
my $batches = Koha::ILL::Batches->search(undef, { |
240 |
my $batches = Koha::ILL::Batches->search(undef, { |
| 232 |
order_by => { -asc => 'name' } |
241 |
order_by => { -asc => 'name' } |
| 233 |
}); |
242 |
}); |
|
Lines 295-301
if ( $backends_available ) {
Link Here
|
| 295 |
redirect_to_list(); |
304 |
redirect_to_list(); |
| 296 |
|
305 |
|
| 297 |
} elsif ( $op eq 'delete_confirm') { |
306 |
} elsif ( $op eq 'delete_confirm') { |
| 298 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
307 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 299 |
|
308 |
|
| 300 |
$template->param( |
309 |
$template->param( |
| 301 |
request => $request |
310 |
request => $request |
|
Lines 319-325
if ( $backends_available ) {
Link Here
|
| 319 |
} |
328 |
} |
| 320 |
|
329 |
|
| 321 |
} elsif ( $op eq 'mark_completed' ) { |
330 |
} elsif ( $op eq 'mark_completed' ) { |
| 322 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
331 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 323 |
my $backend_result = $request->mark_completed($params); |
332 |
my $backend_result = $request->mark_completed($params); |
| 324 |
$template->param( |
333 |
$template->param( |
| 325 |
whole => $backend_result, |
334 |
whole => $backend_result, |
|
Lines 334-340
if ( $backends_available ) {
Link Here
|
| 334 |
my $backend_result; |
343 |
my $backend_result; |
| 335 |
my $request; |
344 |
my $request; |
| 336 |
try { |
345 |
try { |
| 337 |
$request = Koha::ILL::Requests->find($params->{illrequest_id}); |
346 |
$request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 338 |
$params->{current_branchcode} = C4::Context->mybranch; |
347 |
$params->{current_branchcode} = C4::Context->mybranch; |
| 339 |
$backend_result = $request->generic_confirm($params); |
348 |
$backend_result = $request->generic_confirm($params); |
| 340 |
|
349 |
|
|
Lines 392-398
if ( $backends_available ) {
Link Here
|
| 392 |
redirect_user($backend_result, $request); |
401 |
redirect_user($backend_result, $request); |
| 393 |
} elsif ( $op eq 'cud-check_out') { |
402 |
} elsif ( $op eq 'cud-check_out') { |
| 394 |
$op =~ s/^cud-//; |
403 |
$op =~ s/^cud-//; |
| 395 |
my $request = Koha::ILL::Requests->find($params->{illrequest_id}); |
404 |
my $request = Koha::ILL::Requests->find( $params->{illrequest_id} ); |
| 396 |
my $backend_result = $request->check_out($params); |
405 |
my $backend_result = $request->check_out($params); |
| 397 |
$template->param( |
406 |
$template->param( |
| 398 |
params => $params, |
407 |
params => $params, |
|
Lines 434-444
if ( $backends_available ) {
Link Here
|
| 434 |
|
443 |
|
| 435 |
$template->param( table_actions => encode_json( Koha::ILL::Request->get_staff_table_actions ) ); |
444 |
$template->param( table_actions => encode_json( Koha::ILL::Request->get_staff_table_actions ) ); |
| 436 |
} elsif ( $op eq "cud-save_comment" ) { |
445 |
} elsif ( $op eq "cud-save_comment" ) { |
| 437 |
my $comment = Koha::ILL::Comment->new({ |
446 |
my $comment = Koha::ILL::Comment->new( |
| 438 |
illrequest_id => scalar $params->{illrequest_id}, |
447 |
{ |
| 439 |
borrowernumber => $patronnumber, |
448 |
illrequest_id => scalar $params->{illrequest_id}, |
| 440 |
comment => scalar $params->{comment}, |
449 |
borrowernumber => $patronnumber, |
| 441 |
}); |
450 |
comment => scalar $params->{comment}, |
|
|
451 |
} |
| 452 |
); |
| 442 |
$comment->store(); |
453 |
$comment->store(); |
| 443 |
# Redirect to view the whole request |
454 |
# Redirect to view the whole request |
| 444 |
print $cgi->redirect("/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=". |
455 |
print $cgi->redirect("/cgi-bin/koha/ill/ill-requests.pl?op=illview&illrequest_id=". |