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.
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
Created attachment 128182 [details] ToMarcExample.pm
Created attachment 128361 [details] biblios.marc.tar.gz
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
It seems the current patch does not apply anymore: git bz apply 29597 Bug 29597 - Add tomarcplugin option to bulkmarcimport.pl 128181 - Bug 29597: Add tomarcplugin option to bulkmarcimport.pl Apply? [(y)es, (n)o, (i)nteractive] y Applying: Bug 29597: Add tomarcplugin option to bulkmarcimport.pl error: sha1 information is lacking or useless (misc/migration_tools/bulkmarcimport.pl). error: could not build fake ancestor Patch failed at 0001 Bug 29597: Add tomarcplugin option to bulkmarcimport.pl