View | Details | Raw Unified | Return to bug 36273
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (-4 / +4 lines)
Lines 33-39 Link Here
33
            [% WRAPPER breadcrumb_item %]
33
            [% WRAPPER breadcrumb_item %]
34
                <a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a>
34
                <a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a>
35
            [% END %]
35
            [% END %]
36
            [% IF op == 'cud-create' %]
36
            [% IF op == 'create' %]
37
                [% WRAPPER breadcrumb_item bc_active= 1 %]
37
                [% WRAPPER breadcrumb_item bc_active= 1 %]
38
                    <span>New interlibrary loan request</span>
38
                    <span>New interlibrary loan request</span>
39
                [% END %]
39
                [% END %]
Lines 82-88 Link Here
82
                    <div class="alert alert-warning">ILL module configuration problem. Contact your administrator.</div>
82
                    <div class="alert alert-warning">ILL module configuration problem. Contact your administrator.</div>
83
                [% ELSE %]
83
                [% ELSE %]
84
                    <div id="illrequests" class="maincontent">
84
                    <div id="illrequests" class="maincontent">
85
                        [% IF op == 'cud-create' %]
85
                        [% IF op == 'create' %]
86
                            <h1>New interlibrary loan request</h1>
86
                            <h1>New interlibrary loan request</h1>
87
                            [% IF stage == 'copyrightclearance' %]
87
                            [% IF stage == 'copyrightclearance' %]
88
                                [% INCLUDE messages %]
88
                                [% INCLUDE messages %]
Lines 129-135 Link Here
129
                            [% IF can_patron_place_ill_in_opac %]
129
                            [% IF can_patron_place_ill_in_opac %]
130
                                <div id="illrequests-create-button" class="dropdown btn-group">
130
                                <div id="illrequests-create-button" class="dropdown btn-group">
131
                                    [% IF Koha.Preference('AutoILLBackendPriority') %]
131
                                    [% IF Koha.Preference('AutoILLBackendPriority') %]
132
                                        <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=Standard">
132
                                        <a id="ill-new" class="btn btn-primary" href="/cgi-bin/koha/opac-illrequests.pl?op=create&amp;backend=Standard">
133
                                            <i class="fa fa-plus" aria-hidden="true"></i> Create a new auto request
133
                                            <i class="fa fa-plus" aria-hidden="true"></i> Create a new auto request
134
                                        </a>
134
                                        </a>
135
                                    [% ELSIF backends.size > 1 %]
135
                                    [% ELSIF backends.size > 1 %]
Lines 465-471 Link Here
465
                                    </fieldset>
465
                                    </fieldset>
466
                                </form>
466
                                </form>
467
                            </div>
467
                            </div>
468
                        [% END # / IF op == 'cud-create' %]
468
                        [% END # / IF op == 'create' %]
469
                    </div> <!-- / #illrequests -->
469
                    </div> <!-- / #illrequests -->
470
                [% END # /IF !backends_available %]
470
                [% END # /IF !backends_available %]
471
            </div> <!-- / .col-lg-10/12 -->
471
            </div> <!-- / .col-lg-10/12 -->
(-)a/opac/opac-illrequests.pl (-57 / +64 lines)
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
- 

Return to bug 36273