Bug 33716: ILL Type Disclaimer - OPAC
Update the way Availability is handled Add the new type disclaimer workflow operation after Availability Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
0d45394827
commit
753e5a86d9
|
|
@ -1,6 +1,7 @@
|
|||
[% USE raw %]
|
||||
[% USE Koha %]
|
||||
[% USE KohaDates %]
|
||||
[% USE AuthorisedValues %]
|
||||
[% USE Branches %]
|
||||
[% USE AdditionalContents %]
|
||||
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
|
||||
|
|
@ -275,6 +276,44 @@
|
|||
[% INCLUDE 'ill-availability-table.inc' service=service %]
|
||||
[% END %]
|
||||
</div> <!-- /#illrequestupdate-form -->
|
||||
[% ELSIF method == 'typedisclaimer' %]
|
||||
<h1>Request type disclaimer</h1>
|
||||
<div id="results" class="page-section">
|
||||
<h3>Displaying typedisclaimer results</h3>
|
||||
[% INCLUDE messages %]
|
||||
<form method="post" id="typedisclaimer-form">
|
||||
<fieldset class="rows">
|
||||
[% disclaimer.text | $raw %]
|
||||
[% SET disc_av_category_code = AuthorisedValues.GetAuthValueDropbox(disclaimer.av_cat) %]
|
||||
[% IF disc_av_category_code.count %]
|
||||
<br>
|
||||
<select name="type_disclaimer_value">
|
||||
[% FOR av_option IN disc_av_category_code %]
|
||||
<option value="[% av_option.lib_opac | html %]">[% av_option.lib_opac | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
[% END %]
|
||||
</fieldset>
|
||||
<fieldset class="action">
|
||||
[% FOREACH key IN whole.keys %]
|
||||
[% value = whole.$key %]
|
||||
[% IF key != 'custom_key' && key != 'custom_value' %]
|
||||
<input type="hidden" name="[% key | html %]" value="[% value | html %]">
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% custom_keys = whole.custom_key.split('\0') %]
|
||||
[% custom_values = whole.custom_value.split('\0') %]
|
||||
[% i = 0 %]
|
||||
[% FOREACH custom_key IN custom_keys %]
|
||||
<input type="hidden" name="custom_key" value="[% custom_key | html %]">
|
||||
<input type="hidden" name="custom_value" value="[% custom_values.$i | html %]">
|
||||
[% i = i + 1 %]
|
||||
[% END %]
|
||||
<input type="hidden" name="type_disclaimer_submitted" value="1">
|
||||
<input type="submit" value="Next" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
[% END # / IF method == 'create' %]
|
||||
</div> <!-- / #illrequests -->
|
||||
[% END # /IF !backends_available %]
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@ use CGI qw ( -utf8 );
|
|||
use C4::Auth qw( get_template_and_user );
|
||||
use C4::Koha;
|
||||
use C4::Output qw( output_html_with_http_headers );
|
||||
use POSIX qw( strftime );
|
||||
|
||||
use Koha::Illrequest::Config;
|
||||
use Koha::Illrequests;
|
||||
use Koha::Libraries;
|
||||
use Koha::Patrons;
|
||||
use Koha::Illrequest::Availability;
|
||||
use Koha::Illrequest::Workflow::Availability;
|
||||
use Koha::Illrequest::Workflow::TypeDisclaimer;
|
||||
|
||||
my $query = CGI->new;
|
||||
|
||||
|
|
@ -110,43 +112,32 @@ if ( $op eq 'list' ) {
|
|||
my $request = Koha::Illrequest->new
|
||||
->load_backend($params->{backend});
|
||||
|
||||
# Does this backend enable us to insert an availability stage and should
|
||||
# we? If not, proceed as normal.
|
||||
if (
|
||||
C4::Context->preference("ILLCheckAvailability") &&
|
||||
$request->_backend_capability(
|
||||
'should_display_availability',
|
||||
$params
|
||||
) &&
|
||||
# If the user has elected to continue with the request despite
|
||||
# having viewed availability info, this flag will be set
|
||||
!$params->{checked_availability}
|
||||
) {
|
||||
# Establish which of the installed availability providers
|
||||
# can service our metadata, if so, jump in
|
||||
my $availability = Koha::Illrequest::Availability->new($params);
|
||||
my $services = $availability->get_services({
|
||||
ui_context => 'opac'
|
||||
});
|
||||
if (scalar @{$services} > 0) {
|
||||
# Modify our method so we use the correct part of the
|
||||
# template
|
||||
$op = 'availability';
|
||||
# Prepare the metadata we're sending them
|
||||
my $metadata = $availability->prep_metadata($params);
|
||||
$template->param(
|
||||
metadata => $metadata,
|
||||
services_json => encode_json($services),
|
||||
services => $services,
|
||||
illrequestsview => 1,
|
||||
message => $params->{message},
|
||||
method => $op,
|
||||
whole => $params
|
||||
);
|
||||
output_html_with_http_headers $query, $cookie,
|
||||
$template->output, undef, { force_no_caching => 1 };
|
||||
exit;
|
||||
}
|
||||
# Before request creation operations - Preparation
|
||||
my $availability =
|
||||
Koha::Illrequest::Workflow::Availability->new( $params, 'opac' );
|
||||
my $type_disclaimer =
|
||||
Koha::Illrequest::Workflow::TypeDisclaimer->new( $params, 'opac' );
|
||||
|
||||
# ILLCheckAvailability operation
|
||||
if ($availability->show_availability($request)) {
|
||||
$op = 'availability';
|
||||
$template->param(
|
||||
$availability->availability_template_params($params)
|
||||
);
|
||||
output_html_with_http_headers $query, $cookie,
|
||||
$template->output, undef,
|
||||
{ force_no_caching => 1 };
|
||||
exit;
|
||||
# ILLModuleDisclaimerByType operation
|
||||
} elsif ( $type_disclaimer->show_type_disclaimer($request)) {
|
||||
$op = 'typedisclaimer';
|
||||
$template->param(
|
||||
$type_disclaimer->type_disclaimer_template_params($params)
|
||||
);
|
||||
output_html_with_http_headers $query, $cookie,
|
||||
$template->output, undef,
|
||||
{ force_no_caching => 1 };
|
||||
exit;
|
||||
}
|
||||
|
||||
$params->{cardnumber} = Koha::Patrons->find({
|
||||
|
|
@ -154,6 +145,14 @@ if ( $op eq 'list' ) {
|
|||
})->cardnumber;
|
||||
$params->{opac} = 1;
|
||||
my $backend_result = $request->backend_create($params);
|
||||
|
||||
# After creation actions
|
||||
if ( $params->{type_disclaimer_submitted} ) {
|
||||
$type_disclaimer->after_request_created( $params, $request );
|
||||
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2');
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($backend_result->{stage} eq 'copyrightclearance') {
|
||||
$template->param(
|
||||
stage => $backend_result->{stage},
|
||||
|
|
|
|||
Loading…
Reference in New Issue