View | Details | Raw Unified | Return to bug 23682
Collapse All | Expand All

(-)a/Koha/EDI.pm (-3 / +21 lines)
Lines 211-222 sub process_invoice { Link Here
211
    my $logger = Log::Log4perl->get_logger();
211
    my $logger = Log::Log4perl->get_logger();
212
    my $vendor_acct;
212
    my $vendor_acct;
213
213
214
    my $plugin = $invoice_message->edi_acct()->plugin();
214
    my $plugin_class = $invoice_message->edi_acct()->plugin();
215
216
    # Plugin has its own invoice processor, only run it and not the standard invoice processor below
217
    if ( $plugin_class ) {
218
        my $plugin = $plugin_class->new();
219
        if ( $plugin->can('edifact_process_invoice') ) {
220
            Koha::Plugins::Handler->run(
221
                {
222
                    class  => $plugin_class,
223
                    method => 'edifact_process_invoice',
224
                    params => {
225
                        invoice => $invoice_message,
226
                    }
227
                }
228
            );
229
            return;
230
        }
231
    }
232
215
    my $edi_plugin;
233
    my $edi_plugin;
216
    if ( $plugin ) {
234
    if ( $plugin_class ) {
217
        $edi_plugin = Koha::Plugins::Handler->run(
235
        $edi_plugin = Koha::Plugins::Handler->run(
218
            {
236
            {
219
                class  => $plugin,
237
                class  => $plugin_class,
220
                method => 'edifact',
238
                method => 'edifact',
221
                params => {
239
                params => {
222
                    invoice_message => $invoice_message,
240
                    invoice_message => $invoice_message,
(-)a/acqui/edifactmsgs.pl (-16 / +1 lines)
Lines 51-72 if ( $cmd && $cmd eq 'delete' ) { Link Here
51
if ( $cmd && $cmd eq 'import' ) {
51
if ( $cmd && $cmd eq 'import' ) {
52
    my $id  = $q->param('message_id');
52
    my $id  = $q->param('message_id');
53
    my $invoice = $schema->resultset('EdifactMessage')->find($id);
53
    my $invoice = $schema->resultset('EdifactMessage')->find($id);
54
54
    process_invoice($invoice);
55
    my $plugin_used = 0;
56
    if ( my $plugin_class = $invoice->edi_acct->plugin ) {
57
        $plugin_used = 1;
58
        Koha::Plugins::Handler->run(
59
            {
60
                class  => $plugin_class,
61
                method => 'edifact_process_invoice',
62
                params => {
63
                    invoice => $invoice,
64
                }
65
            }
66
        );
67
    }
68
69
    process_invoice($invoice) unless $plugin_used;
70
}
55
}
71
56
72
my @msgs = $schema->resultset('EdifactMessage')->search(
57
my @msgs = $schema->resultset('EdifactMessage')->search(
(-)a/misc/cronjobs/edi_cron.pl (-20 / +1 lines)
Lines 132-156 if ( C4::Context->preference('EdifactInvoiceImport') eq 'automatic' ) { Link Here
132
    foreach my $invoice (@downloaded_invoices) {
132
    foreach my $invoice (@downloaded_invoices) {
133
        my $filename = $invoice->filename();
133
        my $filename = $invoice->filename();
134
        $logger->trace("Processing invoice $filename");
134
        $logger->trace("Processing invoice $filename");
135
135
        process_invoice($invoice);
136
        my $plugin_used = 0;
137
        if ( my $plugin_class = $invoice->edi_acct->plugin ) {
138
            my $plugin = $plugin_class->new();
139
            if ( $plugin->can('edifact_process_invoice') ) {
140
                $plugin_used = 1;
141
                Koha::Plugins::Handler->run(
142
                    {
143
                        class  => $plugin_class,
144
                        method => 'edifact_process_invoice',
145
                        params => {
146
                            invoice => $invoice,
147
                        }
148
                    }
149
                );
150
            }
151
        }
152
153
        process_invoice($invoice) unless $plugin_used;
154
    }
136
    }
155
}
137
}
156
138
157
- 

Return to bug 23682