Lines 35-40
use Koha::Edifact::Order;
Link Here
|
35 |
use Koha::Edifact; |
35 |
use Koha::Edifact; |
36 |
use Log::Log4perl; |
36 |
use Log::Log4perl; |
37 |
use Text::Unidecode; |
37 |
use Text::Unidecode; |
|
|
38 |
use Koha::Plugins::Handler; |
38 |
|
39 |
|
39 |
our $VERSION = 1.1; |
40 |
our $VERSION = 1.1; |
40 |
our @EXPORT_OK = |
41 |
our @EXPORT_OK = |
Lines 86-103
sub create_edi_order {
Link Here
|
86 |
); |
87 |
); |
87 |
my $response = @{$arr_ref} ? 1 : 0; |
88 |
my $response = @{$arr_ref} ? 1 : 0; |
88 |
|
89 |
|
89 |
my $edifact = Koha::Edifact::Order->new( |
90 |
my $edifact_order_params = { |
90 |
{ |
91 |
orderlines => \@orderlines, |
91 |
orderlines => \@orderlines, |
92 |
vendor => $vendor, |
92 |
vendor => $vendor, |
93 |
ean => $ean_obj, |
93 |
ean => $ean_obj, |
94 |
is_response => $response, |
94 |
is_response => $response, |
95 |
}; |
95 |
} |
96 |
|
96 |
); |
97 |
my $edifact; |
97 |
if ( !$edifact ) { |
98 |
if ( $vendor->plugin ) { |
98 |
return; |
99 |
$edifact = Koha::Plugins::Handler->run( |
|
|
100 |
{ |
101 |
class => $vendor->plugin, |
102 |
method => 'edifact_order', |
103 |
params => { |
104 |
params => $edifact_order_params, |
105 |
} |
106 |
} |
107 |
); |
108 |
} |
109 |
else { |
110 |
$edifact = Koha::Edifact::Order->new($edifact_order_params); |
99 |
} |
111 |
} |
100 |
|
112 |
|
|
|
113 |
return unless $edifact; |
114 |
|
101 |
my $order_file = $edifact->encode(); |
115 |
my $order_file = $edifact->encode(); |
102 |
|
116 |
|
103 |
# ingest result |
117 |
# ingest result |
Lines 185-192
sub process_invoice {
Link Here
|
185 |
my $schema = Koha::Database->new()->schema(); |
199 |
my $schema = Koha::Database->new()->schema(); |
186 |
my $logger = Log::Log4perl->get_logger(); |
200 |
my $logger = Log::Log4perl->get_logger(); |
187 |
my $vendor_acct; |
201 |
my $vendor_acct; |
188 |
my $edi = |
202 |
|
|
|
203 |
my $plugin = $invoice_message->edi_acct()->plugin(); |
204 |
my $edi_plugin; |
205 |
if ( $plugin ) { |
206 |
$edi_plugin = Koha::Plugins::Handler->run( |
207 |
{ |
208 |
class => $plugin, |
209 |
method => 'edifact', |
210 |
params => { |
211 |
invoice_message => $invoice_message, |
212 |
transmission => $invoice_message->raw_msg, |
213 |
} |
214 |
} |
215 |
); |
216 |
} |
217 |
|
218 |
my $edi = $edi_plugin || |
189 |
Koha::Edifact->new( { transmission => $invoice_message->raw_msg, } ); |
219 |
Koha::Edifact->new( { transmission => $invoice_message->raw_msg, } ); |
|
|
220 |
|
190 |
my $messages = $edi->message_array(); |
221 |
my $messages = $edi->message_array(); |
191 |
|
222 |
|
192 |
if ( @{$messages} ) { |
223 |
if ( @{$messages} ) { |