|
Lines 51-64
if ( ! C4::Context->preference('ILLModule') ) {
Link Here
|
| 51 |
exit; |
51 |
exit; |
| 52 |
} |
52 |
} |
| 53 |
|
53 |
|
| 54 |
my $op = Koha::ILL::Request->get_op_param_deprecation( 'opac', $params ); |
54 |
my $op = $params->{'op'} || 'list'; |
| 55 |
|
55 |
|
| 56 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
56 |
my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ |
| 57 |
template_name => "opac-illrequests.tt", |
57 |
template_name => "opac-illrequests.tt", |
| 58 |
query => $query, |
58 |
query => $query, |
| 59 |
type => "opac", |
59 |
type => "opac", |
| 60 |
authnotrequired => ( |
60 |
authnotrequired => ( |
| 61 |
( C4::Context->preference("ILLOpacUnauthenticatedRequest") && ( $op eq 'cud-create' || $op eq 'unauth_view' ) ) |
61 |
( C4::Context->preference("ILLOpacUnauthenticatedRequest") |
|
|
62 |
&& ( $op eq 'create' || $op eq 'cud-create' || $op eq 'unauth_view' ) ) |
| 62 |
? 1 |
63 |
? 1 |
| 63 |
: 0 |
64 |
: 0 |
| 64 |
) |
65 |
) |
|
Lines 117-124
if ( $op eq 'list' ) {
Link Here
|
| 117 |
. $illrequest_id |
118 |
. $illrequest_id |
| 118 |
. '&message=1' ); |
119 |
. '&message=1' ); |
| 119 |
exit; |
120 |
exit; |
| 120 |
} elsif ( $op eq 'cud-create' ) { |
121 |
} elsif ( $op eq 'create' ) { |
| 121 |
if (!$params->{backend}) { |
122 |
if (!$params->{backend}) { |
| 122 |
my $req = Koha::ILL::Request->new; |
123 |
my $req = Koha::ILL::Request->new; |
| 123 |
$template->param( |
124 |
$template->param( |
| 124 |
backends => $backends |
125 |
backends => $backends |
|
Lines 127-174
if ( $op eq 'list' ) {
Link Here
|
| 127 |
$params->{backend} = 'Standard' if $params->{backend} eq 'FreeForm'; |
128 |
$params->{backend} = 'Standard' if $params->{backend} eq 'FreeForm'; |
| 128 |
my $request = Koha::ILL::Request->new |
129 |
my $request = Koha::ILL::Request->new |
| 129 |
->load_backend($params->{backend}); |
130 |
->load_backend($params->{backend}); |
|
|
131 |
$params->{cardnumber} = $patron->cardnumber if $patron; |
| 132 |
$params->{branchcode} = $patron->branchcode if $patron; |
| 133 |
$params->{opac} = 1; |
| 134 |
$params->{lang} = C4::Languages::getlanguage($query); |
| 135 |
my $backend_result = $request->backend_create($params); |
| 136 |
|
| 137 |
if ($backend_result->{stage} eq 'copyrightclearance') { |
| 138 |
$template->param( |
| 139 |
stage => $backend_result->{stage}, |
| 140 |
whole => $backend_result |
| 141 |
); |
| 142 |
} else { |
| 143 |
$template->param( |
| 144 |
types => [ "Book", "Article", "Journal" ], |
| 145 |
branches => Koha::Libraries->search->unblessed, |
| 146 |
whole => $backend_result, |
| 147 |
request => $request |
| 148 |
); |
| 149 |
} |
| 150 |
} |
| 151 |
} elsif ( $op eq 'cud-create' ) { |
| 152 |
$params->{backend} = 'Standard' if $params->{backend} eq 'FreeForm'; |
| 153 |
my $request = Koha::ILL::Request->new->load_backend( $params->{backend} ); |
| 130 |
|
154 |
|
| 131 |
# Before request creation operations - Preparation |
155 |
# Before request creation operations - Preparation |
| 132 |
my $history_check = |
156 |
my $history_check = Koha::ILL::Request::Workflow::HistoryCheck->new( $params, 'opac' ); |
| 133 |
Koha::ILL::Request::Workflow::HistoryCheck->new( $params, 'opac' ); |
157 |
my $availability = Koha::ILL::Request::Workflow::Availability->new( $params, 'opac' ); |
| 134 |
my $availability = |
158 |
my $type_disclaimer = Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'opac' ); |
| 135 |
Koha::ILL::Request::Workflow::Availability->new( $params, 'opac' ); |
159 |
my $confirm_auto = Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'opac' ); |
| 136 |
my $type_disclaimer = |
|
|
| 137 |
Koha::ILL::Request::Workflow::TypeDisclaimer->new( $params, 'opac' ); |
| 138 |
my $confirm_auto = |
| 139 |
Koha::ILL::Request::Workflow::ConfirmAuto->new( $params, 'opac' ); |
| 140 |
|
160 |
|
| 141 |
# ILLHistoryCheck operation |
161 |
# ILLHistoryCheck operation |
| 142 |
if ($history_check->show_history_check($request)) { |
162 |
if ( $history_check->show_history_check($request) ) { |
| 143 |
$op = 'historycheck'; |
163 |
$op = 'historycheck'; |
| 144 |
$template->param( |
164 |
$template->param( $history_check->history_check_template_params($params) ); |
| 145 |
$history_check->history_check_template_params($params) |
|
|
| 146 |
); |
| 147 |
output_html_with_http_headers $query, $cookie, |
165 |
output_html_with_http_headers $query, $cookie, |
| 148 |
$template->output, undef, |
166 |
$template->output, undef, |
| 149 |
{ force_no_caching => 1 }; |
167 |
{ force_no_caching => 1 }; |
| 150 |
exit; |
168 |
exit; |
| 151 |
# ILLCheckAvailability operation |
169 |
|
| 152 |
} elsif ($availability->show_availability($request)) { |
170 |
# ILLCheckAvailability operation |
|
|
171 |
} elsif ( $availability->show_availability($request) ) { |
| 153 |
$op = 'availability'; |
172 |
$op = 'availability'; |
| 154 |
$template->param( |
173 |
$template->param( $availability->availability_template_params($params) ); |
| 155 |
$availability->availability_template_params($params) |
|
|
| 156 |
); |
| 157 |
output_html_with_http_headers $query, $cookie, |
174 |
output_html_with_http_headers $query, $cookie, |
| 158 |
$template->output, undef, |
175 |
$template->output, undef, |
| 159 |
{ force_no_caching => 1 }; |
176 |
{ force_no_caching => 1 }; |
| 160 |
exit; |
177 |
exit; |
| 161 |
# ILLModuleDisclaimerByType operation |
178 |
|
| 162 |
} elsif ( $type_disclaimer->show_type_disclaimer($request)) { |
179 |
# ILLModuleDisclaimerByType operation |
|
|
180 |
} elsif ( $type_disclaimer->show_type_disclaimer($request) ) { |
| 163 |
$op = 'typedisclaimer'; |
181 |
$op = 'typedisclaimer'; |
| 164 |
$template->param( |
182 |
$template->param( $type_disclaimer->type_disclaimer_template_params($params) ); |
| 165 |
$type_disclaimer->type_disclaimer_template_params($params) |
|
|
| 166 |
); |
| 167 |
output_html_with_http_headers $query, $cookie, |
183 |
output_html_with_http_headers $query, $cookie, |
| 168 |
$template->output, undef, |
184 |
$template->output, undef, |
| 169 |
{ force_no_caching => 1 }; |
185 |
{ force_no_caching => 1 }; |
| 170 |
exit; |
186 |
exit; |
| 171 |
# ConfirmAuto operation |
187 |
|
|
|
188 |
# ConfirmAuto operation |
| 172 |
} elsif ( $confirm_auto->show_confirm_auto($request) ) { |
189 |
} elsif ( $confirm_auto->show_confirm_auto($request) ) { |
| 173 |
$op = 'confirmautoill'; |
190 |
$op = 'confirmautoill'; |
| 174 |
$template->param( $confirm_auto->confirm_auto_template_params($params) ); |
191 |
$template->param( $confirm_auto->confirm_auto_template_params($params) ); |
|
Lines 177-219
if ( $op eq 'list' ) {
Link Here
|
| 177 |
{ force_no_caching => 1 }; |
194 |
{ force_no_caching => 1 }; |
| 178 |
exit; |
195 |
exit; |
| 179 |
} |
196 |
} |
| 180 |
|
|
|
| 181 |
$params->{cardnumber} = $patron->cardnumber if $patron; |
197 |
$params->{cardnumber} = $patron->cardnumber if $patron; |
| 182 |
$params->{branchcode} = $patron->branchcode if $patron; |
198 |
$params->{branchcode} = $patron->branchcode if $patron; |
| 183 |
$params->{opac} = 1; |
199 |
$params->{opac} = 1; |
| 184 |
$params->{lang} = C4::Languages::getlanguage($query); |
200 |
$params->{lang} = C4::Languages::getlanguage($query); |
| 185 |
my $backend_result = $request->backend_create($params); |
201 |
my $backend_result = $request->backend_create($params); |
| 186 |
|
202 |
if ($backend_result->{stage} eq 'commit') { |
| 187 |
if ($backend_result->{stage} eq 'copyrightclearance') { |
203 |
# After creation actions |
| 188 |
$template->param( |
204 |
if ( $params->{type_disclaimer_submitted} ) { |
| 189 |
stage => $backend_result->{stage}, |
205 |
$type_disclaimer->after_request_created( $params, $request ); |
| 190 |
whole => $backend_result |
206 |
} |
| 191 |
); |
207 |
if ( C4::Context->preference('ILLHistoryCheck') ) { |
| 192 |
} else { |
208 |
$history_check->after_request_created( $params, $request ); |
|
|
209 |
} |
| 210 |
if ( C4::Context->preference('ILLOpacUnauthenticatedRequest') && !$patron ) { |
| 211 |
$op = 'unauth_view'; |
| 212 |
} else { |
| 213 |
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2'); |
| 214 |
exit; |
| 215 |
} |
| 216 |
}else{ |
| 217 |
$op = 'create'; |
| 193 |
$template->param( |
218 |
$template->param( |
| 194 |
types => [ "Book", "Article", "Journal" ], |
219 |
types => [ "Book", "Article", "Journal" ], |
| 195 |
branches => Koha::Libraries->search->unblessed, |
220 |
branches => Koha::Libraries->search->unblessed, |
| 196 |
whole => $backend_result, |
221 |
whole => $backend_result, |
| 197 |
request => $request |
222 |
request => $request |
| 198 |
); |
223 |
); |
| 199 |
if ($backend_result->{stage} eq 'commit') { |
|
|
| 200 |
# After creation actions |
| 201 |
if ( $params->{type_disclaimer_submitted} ) { |
| 202 |
$type_disclaimer->after_request_created( $params, $request ); |
| 203 |
} |
| 204 |
if ( C4::Context->preference('ILLHistoryCheck') ) { |
| 205 |
$history_check->after_request_created( $params, $request ); |
| 206 |
} |
| 207 |
if ( C4::Context->preference('ILLOpacUnauthenticatedRequest') && !$patron ) { |
| 208 |
$op = 'unauth_view'; |
| 209 |
} else { |
| 210 |
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2'); |
| 211 |
exit; |
| 212 |
} |
| 213 |
} |
| 214 |
} |
224 |
} |
| 215 |
|
|
|
| 216 |
} |
| 217 |
} |
225 |
} |
| 218 |
|
226 |
|
| 219 |
$template->param( |
227 |
$template->param( |
| 220 |
- |
|
|