@@ -, +, @@ alternative to automatic importing on download --- acqui/edifactmsgs.pl | 24 ++++++++ .../data/mysql/atomicupdate/bug_23682.perl | 10 ++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/acqui/edifactmsgs.tt | 3 + .../admin/preferences/acquisitions.pref | 8 +++ misc/cronjobs/edi_cron.pl | 55 ++++++++++--------- 6 files changed, 74 insertions(+), 27 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_23682.perl --- a/acqui/edifactmsgs.pl +++ a/acqui/edifactmsgs.pl @@ -45,6 +45,30 @@ if ( $cmd && $cmd eq 'delete' ) { $msg->update; } +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 ) { + 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; +} + my @msgs = $schema->resultset('EdifactMessage')->search( { deleted => 0, --- a/installer/data/mysql/atomicupdate/bug_23682.perl +++ a/installer/data/mysql/atomicupdate/bug_23682.perl @@ -0,0 +1,10 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if ( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice') + }); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug XXXXX - description)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -160,6 +160,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DumpTemplateVarsIntranet', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the staff intranet.', 'YesNo'), ('DumpTemplateVarsOpac', '0', NULL , 'If enabled, dump all Template Toolkit variable to a comment in the html source for the opac.', 'YesNo'), ('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'), +('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'), ('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL), ('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL), ('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/edifactmsgs.tt @@ -71,6 +71,9 @@