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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.tt (+39 lines)
Lines 1-6 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Koha %]
2
[% USE Koha %]
3
[% USE KohaDates %]
3
[% USE KohaDates %]
4
[% USE AuthorisedValues %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% USE AdditionalContents %]
6
[% USE AdditionalContents %]
6
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
7
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
Lines 275-280 Link Here
275
                                    [% INCLUDE 'ill-availability-table.inc' service=service %]
276
                                    [% INCLUDE 'ill-availability-table.inc' service=service %]
276
                                [% END %]
277
                                [% END %]
277
                            </div> <!-- /#illrequestupdate-form -->
278
                            </div> <!-- /#illrequestupdate-form -->
279
                        [% ELSIF method == 'typedisclaimer' %]
280
                            <h1>Request type disclaimer</h1>
281
                            <div id="results" class="page-section">
282
                                <h3>Displaying typedisclaimer results</h3>
283
                                [% INCLUDE messages %]
284
                                <form method="post" id="typedisclaimer-form">
285
                                    <fieldset class="rows">
286
                                        [% disclaimer.text | $raw %]
287
                                        [% SET disc_av_category_code = AuthorisedValues.GetAuthValueDropbox(disclaimer.av_cat) %]
288
                                        [% IF disc_av_category_code.count %]
289
                                        <br>
290
                                            <select name="type_disclaimer_value">
291
                                                [% FOR av_option IN disc_av_category_code %]
292
                                                    <option value="[% av_option.lib_opac | html %]">[% av_option.lib_opac | html %]</option>
293
                                                [% END %]
294
                                            </select>
295
                                        [% END %]
296
                                    </fieldset>
297
                                    <fieldset class="action">
298
                                        [% FOREACH key IN whole.keys %]
299
                                            [% value = whole.$key %]
300
                                            [% IF key != 'custom_key' && key != 'custom_value' %]
301
                                            <input type="hidden" name="[% key | html %]" value="[% value | html %]">
302
                                            [% END %]
303
                                        [% END %]
304
                                        [% custom_keys = whole.custom_key.split('\0') %]
305
                                        [% custom_values = whole.custom_value.split('\0') %]
306
                                        [% i = 0 %]
307
                                        [% FOREACH custom_key IN custom_keys %]
308
                                            <input type="hidden" name="custom_key" value="[% custom_key | html %]">
309
                                            <input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
310
                                        [% i = i + 1 %]
311
                                        [% END %]
312
                                        <input type="hidden" name="type_disclaimer_submitted" value="1">
313
                                        <input type="submit" value="Next" />
314
                                    </fieldset>
315
                                </form>
316
                            </div>
278
                        [% END # / IF method == 'create' %]
317
                        [% END # / IF method == 'create' %]
279
                    </div> <!-- / #illrequests -->
318
                    </div> <!-- / #illrequests -->
280
                [% END # /IF !backends_available %]
319
                [% END # /IF !backends_available %]
(-)a/opac/opac-illrequests.pl (-39 / +37 lines)
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 115-157 if ( $op eq 'list' ) { Link Here
115
        my $request = Koha::Illrequest->new
117
        my $request = Koha::Illrequest->new
116
            ->load_backend($params->{backend});
118
            ->load_backend($params->{backend});
117
119
118
        # Does this backend enable us to insert an availability stage and should
120
        # Before request creation operations - Preparation
119
        # we? If not, proceed as normal.
121
        my $availability =
120
        if (
122
          Koha::Illrequest::Workflow::Availability->new( $params, 'opac' );
121
            C4::Context->preference("ILLCheckAvailability") &&
123
        my $type_disclaimer =
122
            $request->_backend_capability(
124
          Koha::Illrequest::Workflow::TypeDisclaimer->new( $params, 'opac' );
123
                'should_display_availability',
125
124
                $params
126
        # ILLCheckAvailability operation
125
            ) &&
127
        if ($availability->show_availability($request)) {
126
            # If the user has elected to continue with the request despite
128
            $op = 'availability';
127
            # having viewed availability info, this flag will be set
129
            $template->param(
128
            !$params->{checked_availability}
130
                $availability->availability_template_params($params)
129
        ) {
131
            );
130
            # Establish which of the installed availability providers
132
            output_html_with_http_headers $query, $cookie,
131
            # can service our metadata, if so, jump in
133
                $template->output, undef,
132
            my $availability = Koha::Illrequest::Availability->new($params);
134
                { force_no_caching => 1 };
133
            my $services = $availability->get_services({
135
            exit;
134
                ui_context => 'opac'
136
        # ILLModuleDisclaimerByType operation
135
            });
137
        } elsif ( $type_disclaimer->show_type_disclaimer($request, $params)) {
136
            if (scalar @{$services} > 0) {
138
            $op = 'typedisclaimer';
137
                # Modify our method so we use the correct part of the
139
            $template->param(
138
                # template
140
                $type_disclaimer->type_disclaimer_template_params($params)
139
                $op = 'availability';
141
            );
140
                # Prepare the metadata we're sending them
142
            output_html_with_http_headers $query, $cookie,
141
                my $metadata = $availability->prep_metadata($params);
143
                $template->output, undef,
142
                $template->param(
144
                { force_no_caching => 1 };
143
                    metadata        => $metadata,
145
            exit;
144
                    services_json   => encode_json($services),
145
                    services        => $services,
146
                    illrequestsview => 1,
147
                    message         => $params->{message},
148
                    method          => $op,
149
                    whole           => $params
150
                );
151
                output_html_with_http_headers $query, $cookie,
152
                    $template->output, undef, { force_no_caching => 1 };
153
                exit;
154
            }
155
        }
146
        }
156
147
157
        $params->{cardnumber} = Koha::Patrons->find({
148
        $params->{cardnumber} = Koha::Patrons->find({
Lines 159-164 if ( $op eq 'list' ) { Link Here
159
        })->cardnumber;
150
        })->cardnumber;
160
        $params->{opac} = 1;
151
        $params->{opac} = 1;
161
        my $backend_result = $request->backend_create($params);
152
        my $backend_result = $request->backend_create($params);
153
154
        # After creation actions
155
        if ( $params->{type_disclaimer_submitted} ) {
156
            $type_disclaimer->after_request_created( $params, $request );
157
            print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2');
158
            exit;
159
        }
160
162
        if ($backend_result->{stage} eq 'copyrightclearance') {
161
        if ($backend_result->{stage} eq 'copyrightclearance') {
163
            $template->param(
162
            $template->param(
164
                stage       => $backend_result->{stage},
163
                stage       => $backend_result->{stage},
165
- 

Return to bug 33716