1 package Koha::Illrequest::SupplierUpdate;
3 # Copyright 2022 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>.
24 Koha::Illrequest::SupplierUpdate - Represents a single request update from a supplier
28 Object-oriented class that provides an object allowing us to interact with
29 an update from a supplier
33 Object-oriented class that provides an object allowing us to interact with
34 an update from a supplier
42 my $update = Koha::Illrequest::SupplierUpdate->new(
48 Create a new Koha::Illrequest::SupplierUpdate object.
53 my ( $class, $source_type, $source_name, $update, $request ) = @_;
56 $self->{source_type} = $source_type;
57 $self->{source_name} = $source_name;
58 $self->{update} = $update;
59 $self->{request} = $request;
60 $self->{processors} = [];
67 =head3 attach_processor
69 Koha::Illrequest::SupplierUpdate->attach_processor($processor);
71 Pushes a processor function onto the 'processors' arrayref
75 sub attach_processor {
76 my ( $self, $processor ) = @_;
77 push(@{$self->{processors}}, $processor);
82 Koha::Illrequest::SupplierUpdate->run_processors();
84 Iterates all processors on this object and runs each
89 my ( $self, $options ) = @_;
91 foreach my $processor(@{$self->{processors}}) {
92 my $processor_result = {
93 name => $processor->{name},
99 $processor->run($self, $options, $processor_result->{result});
100 push @{$results}, $processor_result;
107 Andrew Isherwood <andrew.isherwood@ptfs-europe.com>