Bugzilla – Attachment 109374 Details for
Bug 23682
Add ability to manually import EDI invoices as an alternative to automatic importing on download
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23682: Dedup plugin calls my moving to a single call in process_invoice()
Bug-23682-Dedup-plugin-calls-my-moving-to-a-single.patch (text/plain), 3.68 KB, created by
Kyle M Hall (khall)
on 2020-08-31 17:06:39 UTC
(
hide
)
Description:
Bug 23682: Dedup plugin calls my moving to a single call in process_invoice()
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2020-08-31 17:06:39 UTC
Size:
3.68 KB
patch
obsolete
>From d353da2a83081e8c4d6ecec9ad73a78d98a72e4d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 31 Aug 2020 13:02:05 -0400 >Subject: [PATCH] Bug 23682: Dedup plugin calls my moving to a single call in > process_invoice() > >--- > Koha/EDI.pm | 24 +++++++++++++++++++++--- > acqui/edifactmsgs.pl | 17 +---------------- > misc/cronjobs/edi_cron.pl | 20 +------------------- > 3 files changed, 23 insertions(+), 38 deletions(-) > >diff --git a/Koha/EDI.pm b/Koha/EDI.pm >index 3b89d4e5f4..ad2691e936 100644 >--- a/Koha/EDI.pm >+++ b/Koha/EDI.pm >@@ -211,12 +211,30 @@ sub process_invoice { > my $logger = Log::Log4perl->get_logger(); > my $vendor_acct; > >- my $plugin = $invoice_message->edi_acct()->plugin(); >+ my $plugin_class = $invoice_message->edi_acct()->plugin(); >+ >+ # Plugin has its own invoice processor, only run it and not the standard invoice processor below >+ if ( $plugin_class ) { >+ my $plugin = $plugin_class->new(); >+ if ( $plugin->can('edifact_process_invoice') ) { >+ Koha::Plugins::Handler->run( >+ { >+ class => $plugin_class, >+ method => 'edifact_process_invoice', >+ params => { >+ invoice => $invoice_message, >+ } >+ } >+ ); >+ return; >+ } >+ } >+ > my $edi_plugin; >- if ( $plugin ) { >+ if ( $plugin_class ) { > $edi_plugin = Koha::Plugins::Handler->run( > { >- class => $plugin, >+ class => $plugin_class, > method => 'edifact', > params => { > invoice_message => $invoice_message, >diff --git a/acqui/edifactmsgs.pl b/acqui/edifactmsgs.pl >index a923a88237..9a476e35c5 100755 >--- a/acqui/edifactmsgs.pl >+++ b/acqui/edifactmsgs.pl >@@ -51,22 +51,7 @@ if ( $cmd && $cmd eq 'delete' ) { > if ( $cmd && $cmd eq 'import' ) { > my $id = $q->param('message_id'); > my $invoice = $schema->resultset('EdifactMessage')->find($id); >- >- my $plugin_used = 0; >- if ( my $plugin_class = $invoice->edi_acct->plugin ) { >- $plugin_used = 1; >- Koha::Plugins::Handler->run( >- { >- class => $plugin_class, >- method => 'edifact_process_invoice', >- params => { >- invoice => $invoice, >- } >- } >- ); >- } >- >- process_invoice($invoice) unless $plugin_used; >+ process_invoice($invoice); > } > > my @msgs = $schema->resultset('EdifactMessage')->search( >diff --git a/misc/cronjobs/edi_cron.pl b/misc/cronjobs/edi_cron.pl >index b5123d448c..2a3b08f13b 100755 >--- a/misc/cronjobs/edi_cron.pl >+++ b/misc/cronjobs/edi_cron.pl >@@ -132,25 +132,7 @@ if ( C4::Context->preference('EdifactInvoiceImport') eq 'automatic' ) { > foreach my $invoice (@downloaded_invoices) { > my $filename = $invoice->filename(); > $logger->trace("Processing invoice $filename"); >- >- my $plugin_used = 0; >- if ( my $plugin_class = $invoice->edi_acct->plugin ) { >- my $plugin = $plugin_class->new(); >- if ( $plugin->can('edifact_process_invoice') ) { >- $plugin_used = 1; >- Koha::Plugins::Handler->run( >- { >- class => $plugin_class, >- method => 'edifact_process_invoice', >- params => { >- invoice => $invoice, >- } >- } >- ); >- } >- } >- >- process_invoice($invoice) unless $plugin_used; >+ process_invoice($invoice); > } > } > >-- >2.24.1 (Apple Git-126)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23682
:
93170
|
93171
|
105927
|
108210
|
108943
|
109030
|
109064
|
109065
|
109066
|
109212
|
109213
|
109214
| 109374 |
109619