Bug 29597 - Add tomarcplugin option to bulkmarcimport.pl
Summary: Add tomarcplugin option to bulkmarcimport.pl
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Gustafsson
QA Contact: Testopia
URL:
Keywords: no-sandbox
Depends on: 29440
Blocks:
  Show dependency treegraph
 
Reported: 2021-11-30 12:22 UTC by David Gustafsson
Modified: 2024-01-23 14:46 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 29597: Add tomarcplugin option to bulkmarcimport.pl (5.14 KB, patch)
2021-12-02 18:26 UTC, David Gustafsson
Details | Diff | Splinter Review
ToMarcExample.pm (1.80 KB, text/plain)
2021-12-02 18:29 UTC, David Gustafsson
Details
biblios.marc.tar.gz (4.24 KB, application/gzip)
2021-12-08 12:53 UTC, David Gustafsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gustafsson 2021-11-30 12:22:17 UTC
This patch provides a tomarcplugin option for bulkmarcimport.pl. There already is a "localcust" option that provides kind of the same functionality, but an option for providing a plugin is for example useful as "to_marc"-plugins can also selected in the "Format" dropdown when staging imports in the staff interface. So if there for example are some marc transformations/processing that should be enforced both routes of import a plugin can be created and used in both cases.
Comment 1 David Gustafsson 2021-12-02 18:26:12 UTC
Created attachment 128181 [details] [review]
Bug 29597: Add tomarcplugin option to bulkmarcimport.pl

Add tomarcplugin option to bulkmarcimport script.

To test:

1) Place ToMarcExample.pm in a Koha plugin directory at Koha/Plugin/ToMarcExample.pm
   and make sure its enabled and installed in Koha
2) Import some biblio with
   ./bulkmarcimport.pl -v -b -file biblios.mrc -insert -update -c=MARC21 -n=1 -tomarcplugin="Koha::Plugin::ToMarcExample"
3) For the imported biblio, check that field 590a has been populated with
   the value 'ToMarcExample added field'

Sponsored-by: Gothenburg University Library
Comment 2 David Gustafsson 2021-12-02 18:29:57 UTC
Created attachment 128182 [details]
ToMarcExample.pm
Comment 3 David Gustafsson 2021-12-08 12:53:48 UTC
Created attachment 128361 [details]
biblios.marc.tar.gz
Comment 4 David Nind 2024-01-21 20:12:50 UTC
I started to test (using koha-testing-docker), but the plugin for step 1 of the test plan does not show in the list of plugins.

This is what I did:

1. Applied the patch (it still applies cleanly).
2. Downloaded and put ToMarcExample.pm in the Koha/Plugins directory.
3. Restarted everything.
4. Went to Koha Administration > Plugins > Manage plugins
5. There are no new plugins listed.
6. Even though I didn't see the plugin, I ran the script (from the /kohadevbox/koha directory, with the sample MARC file in that directory as well). This is the output I got:

misc/migration_tools/bulkmarcimport.pl -v -b -file biblios.marc -insert -update -c=MARC21 -n=1 -tomarcplugin="Koha::Plugin::ToMarcExample"
Using -update without -match or -isbn seems to be useless.
Characteristic MARC flavour: MARC21
Plugin does not have method to_marc at /kohadevbox/koha/Koha/Plugins/Handler.pm line 72.
Use of uninitialized value $fh in eof at /usr/share/perl5/MARC/File/USMARC.pm line 51.
Use of uninitialized value $fh in eof at /usr/share/perl5/MARC/File/USMARC.pm line 51.
Use of uninitialized value $fh in eof at /usr/share/perl5/MARC/File/USMARC.pm line 51.

0 MARC records done in 0.00819301605224609 seconds