1 package Koha::ILL::Request::Workflow;
3 # Copyright 2023 PTFS Europe Ltd
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use MIME::Base64 qw( encode_base64 );
24 use URI::Escape qw( uri_escape );
25 use Encode qw( encode );
31 Koha::ILL::Request::Workflow - Koha ILL Workflow parent class
35 Object-oriented parent class for ILL workflow stages
39 This class contains methods do be used by ILL workflow stages
47 my $availability = Koha::ILL::Request::Workflow::Availability->new( $params, 'opac' )
49 Create a new Koha::ILL::Request::Workflow child class object.
50 We store the metadata and ui_context
55 my ( $class, $metadata, $ui_context ) = @_;
58 $self->{metadata} = $metadata;
59 $self->{ui_context} = $ui_context;
68 my $prepared = Koha::ILL::Request::Workflow->prep_metadata($metadata);
70 Given our metadata, return a string representing that metadata that can be
71 passed in a URL (encoded in JSON then Base64 encoded)
76 my ( $self, $metadata ) = @_;
78 # We sort the metadata hashref by key before encoding it, primarily
79 # so this function returns something predictable that we can test!
81 $json->canonical( [1] );
83 encode_base64( encode( 'utf-8', $json->encode($metadata) ) ) );
88 Pedro Amorim <pedro.amorim@ptfs-europe.com>