Lines 25-36
use CGI qw ( -utf8 );
Link Here
|
25 |
use C4::Auth qw( get_template_and_user ); |
25 |
use C4::Auth qw( get_template_and_user ); |
26 |
use C4::Koha; |
26 |
use C4::Koha; |
27 |
use C4::Output qw( output_html_with_http_headers ); |
27 |
use C4::Output qw( output_html_with_http_headers ); |
|
|
28 |
use POSIX qw( strftime ); |
28 |
|
29 |
|
29 |
use Koha::Illrequest::Config; |
30 |
use Koha::Illrequest::Config; |
30 |
use Koha::Illrequests; |
31 |
use Koha::Illrequests; |
31 |
use Koha::Libraries; |
32 |
use Koha::Libraries; |
32 |
use Koha::Patrons; |
33 |
use Koha::Patrons; |
33 |
use Koha::Illrequest::Availability; |
34 |
use Koha::Illrequest::Workflow::Availability; |
|
|
35 |
use Koha::Illrequest::Workflow::TypeDisclaimer; |
34 |
|
36 |
|
35 |
my $query = CGI->new; |
37 |
my $query = CGI->new; |
36 |
|
38 |
|
Lines 110-152
if ( $op eq 'list' ) {
Link Here
|
110 |
my $request = Koha::Illrequest->new |
112 |
my $request = Koha::Illrequest->new |
111 |
->load_backend($params->{backend}); |
113 |
->load_backend($params->{backend}); |
112 |
|
114 |
|
113 |
# Does this backend enable us to insert an availability stage and should |
115 |
# Before request creation operations - Preparation |
114 |
# we? If not, proceed as normal. |
116 |
my $availability = |
115 |
if ( |
117 |
Koha::Illrequest::Workflow::Availability->new( $params, 'opac' ); |
116 |
C4::Context->preference("ILLCheckAvailability") && |
118 |
my $type_disclaimer = |
117 |
$request->_backend_capability( |
119 |
Koha::Illrequest::Workflow::TypeDisclaimer->new( $params, 'opac' ); |
118 |
'should_display_availability', |
120 |
|
119 |
$params |
121 |
# ILLCheckAvailability operation |
120 |
) && |
122 |
if ($availability->show_availability($request)) { |
121 |
# If the user has elected to continue with the request despite |
123 |
$op = 'availability'; |
122 |
# having viewed availability info, this flag will be set |
124 |
$template->param( |
123 |
!$params->{checked_availability} |
125 |
$availability->availability_template_params($params) |
124 |
) { |
126 |
); |
125 |
# Establish which of the installed availability providers |
127 |
output_html_with_http_headers $query, $cookie, |
126 |
# can service our metadata, if so, jump in |
128 |
$template->output, undef, |
127 |
my $availability = Koha::Illrequest::Availability->new($params); |
129 |
{ force_no_caching => 1 }; |
128 |
my $services = $availability->get_services({ |
130 |
exit; |
129 |
ui_context => 'opac' |
131 |
# ILLModuleDisclaimerByType operation |
130 |
}); |
132 |
} elsif ( $type_disclaimer->show_type_disclaimer($request)) { |
131 |
if (scalar @{$services} > 0) { |
133 |
$op = 'typedisclaimer'; |
132 |
# Modify our method so we use the correct part of the |
134 |
$template->param( |
133 |
# template |
135 |
$type_disclaimer->type_disclaimer_template_params($params) |
134 |
$op = 'availability'; |
136 |
); |
135 |
# Prepare the metadata we're sending them |
137 |
output_html_with_http_headers $query, $cookie, |
136 |
my $metadata = $availability->prep_metadata($params); |
138 |
$template->output, undef, |
137 |
$template->param( |
139 |
{ force_no_caching => 1 }; |
138 |
metadata => $metadata, |
140 |
exit; |
139 |
services_json => encode_json($services), |
|
|
140 |
services => $services, |
141 |
illrequestsview => 1, |
142 |
message => $params->{message}, |
143 |
method => $op, |
144 |
whole => $params |
145 |
); |
146 |
output_html_with_http_headers $query, $cookie, |
147 |
$template->output, undef, { force_no_caching => 1 }; |
148 |
exit; |
149 |
} |
150 |
} |
141 |
} |
151 |
|
142 |
|
152 |
$params->{cardnumber} = Koha::Patrons->find({ |
143 |
$params->{cardnumber} = Koha::Patrons->find({ |
Lines 154-159
if ( $op eq 'list' ) {
Link Here
|
154 |
})->cardnumber; |
145 |
})->cardnumber; |
155 |
$params->{opac} = 1; |
146 |
$params->{opac} = 1; |
156 |
my $backend_result = $request->backend_create($params); |
147 |
my $backend_result = $request->backend_create($params); |
|
|
148 |
|
149 |
# After creation actions |
150 |
if ( $params->{type_disclaimer_submitted} ) { |
151 |
$type_disclaimer->after_request_created( $params, $request ); |
152 |
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2'); |
153 |
exit; |
154 |
} |
155 |
|
157 |
if ($backend_result->{stage} eq 'copyrightclearance') { |
156 |
if ($backend_result->{stage} eq 'copyrightclearance') { |
158 |
$template->param( |
157 |
$template->param( |
159 |
stage => $backend_result->{stage}, |
158 |
stage => $backend_result->{stage}, |
160 |
- |
|
|