diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm
index 3293b185ec..29a1f94141 100644
--- a/C4/ImportBatch.pm
+++ b/C4/ImportBatch.pm
@@ -27,6 +27,7 @@ use C4::Items;
use C4::Charset;
use C4::AuthoritiesMarc;
use C4::MarcModificationTemplates;
+use Koha::Plugins::Handler;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
@@ -347,11 +348,15 @@ sub ModAuthInBatch {
=head2 BatchStageMarcRecords
- ($batch_id, $num_records, $num_items, @invalid_records) =
- BatchStageMarcRecords($encoding, $marc_records, $file_name, $marc_modification_template,
- $comments, $branch_code, $parse_items,
- $leave_as_staging,
- $progress_interval, $progress_callback);
+( $batch_id, $num_records, $num_items, @invalid_records ) =
+ BatchStageMarcRecords(
+ $encoding, $marc_records,
+ $file_name, $to_marc_plugin,
+ $marc_modification_template, $comments,
+ $branch_code, $parse_items,
+ $leave_as_staging, $progress_interval,
+ $progress_callback
+ );
=cut
@@ -360,6 +365,7 @@ sub BatchStageMarcRecords {
my $encoding = shift;
my $marc_records = shift;
my $file_name = shift;
+ my $to_marc_plugin = shift;
my $marc_modification_template = shift;
my $comments = shift;
my $branch_code = shift;
@@ -391,6 +397,14 @@ sub BatchStageMarcRecords {
SetImportBatchItemAction($batch_id, 'ignore');
}
+ $marc_records = Koha::Plugins::Handler->run(
+ {
+ class => $to_marc_plugin,
+ method => 'to_marc',
+ params => { data => $marc_records }
+ }
+ ) if $to_marc_plugin;
+
my $marc_type = C4::Context->preference('marcflavour');
$marc_type .= 'AUTH' if ($marc_type eq 'UNIMARC' && $record_type eq 'auth');
my @invalid_records = ();
diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm
index 6574d51626..9e2d4eb609 100644
--- a/Koha/Plugins.pm
+++ b/Koha/Plugins.pm
@@ -51,7 +51,7 @@ This will return a list of all the available plugins of the passed type.
Usage: my @plugins = C4::Plugins::GetPlugins( $method );
-At the moment, the available types are 'report' and 'tool'.
+At the moment, the available types are 'report', 'tool' and 'to_marc'.
=cut
sub GetPlugins {
diff --git a/Koha/Plugins/Handler.pm b/Koha/Plugins/Handler.pm
index 993aa14196..187560d514 100644
--- a/Koha/Plugins/Handler.pm
+++ b/Koha/Plugins/Handler.pm
@@ -56,11 +56,12 @@ sub run {
my $plugin_class = $args->{'class'};
my $plugin_method = $args->{'method'};
my $cgi = $args->{'cgi'};
+ my $params = $args->{'params'};
if ( can_load( modules => { $plugin_class => undef } ) ) {
my $plugin = $plugin_class->new( { cgi => $cgi, enable_plugins => $args->{'enable_plugins'} } );
if ( $plugin->can($plugin_method) ) {
- return $plugin->$plugin_method();
+ return $plugin->$plugin_method( $params );
} else {
warn "Plugin does not have method $plugin_method";
}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
index 02bc60a40e..c85aa8ecf0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
@@ -57,6 +57,13 @@
Cities and towns
Define cities and towns that your patrons live in.
+[% IF CAN_user_plugins %]
+ Plugins
+
+ - Manage plugins
+ - View, manage, configure and run plugins.
+
+[% END %]
Catalog
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
index b9b17f58e4..50d7517cec 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/stage-marc-import.tt
@@ -117,6 +117,24 @@ function CheckForm(f) {
+
+ [% IF plugins %]
+
+ [% END %]
+
[% IF MarcModificationTemplatesLoop %]