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 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
- 

Return to bug 33716