Many libraries would like to be able to import various types of files as MARC records ( citations, csv files, etc ). We can add a new function to the plugins system to allow that kind of behavior at a very custom level.
Created attachment 28825 [details] [review] Bug 12412 - Add ability for plugins to convert arbitrary files to MARC from record staging tool Many libraries would like to be able to import various types of files as MARC records ( citations, csv files, etc ). We can add a new function to the plugins system to allow that kind of behavior at a very custom level. Test Plan: 1) Ensure you have plugins enabled and configured correctly 2) Installed the attached version 2.00 of the Kitchen Sink plugin 3) Download the attached text file 4) Browse to "Stage MARC records for import" 5) Select the downloaded text file for staging 6) After uploading, you should see a new area "Transform file to MARC:", select "Example Kitchen-Sink Plugin" from the pulldown menu 7) Click 'Stage for import" 8) Click 'Manage staged records" 9) You should now see two new MARC records!
Created attachment 28826 [details] Test text file that will be transformed into MARC
Created attachment 28827 [details] Kitchen-Sink Plugin v2.00
Created attachment 31676 [details] [review] Bug 12412 - Add ability for plugins to convert arbitrary files to MARC from record staging tool Many libraries would like to be able to import various types of files as MARC records ( citations, csv files, etc ). We can add a new function to the plugins system to allow that kind of behavior at a very custom level. Test Plan: 1) Ensure you have plugins enabled and configured correctly 2) Installed the attached version 2.00 of the Kitchen Sink plugin 3) Download the attached text file 4) Browse to "Stage MARC records for import" 5) Select the downloaded text file for staging 6) After uploading, you should see a new area "Transform file to MARC:", select "Example Kitchen-Sink Plugin" from the pulldown menu 7) Click 'Stage for import" 8) Click 'Manage staged records" 9) You should now see two new MARC records!
I have tried to test this, but in point 6) of the test plan 6) After uploading, you should see a new area "Transform file to MARC:", select "Example Kitchen-Sink Plugin" from the pulldown menu there is no new area "Transform file to MARC:". tested with Koha 3.16.03.000. (Test-Koha is bilingual english-spanish, and test was made with both, english and spanish, interfaces).
(In reply to verolencinas from comment #5) > I have tried to test this, but in point 6) of the test plan > > 6) After uploading, you should see a new area "Transform file to MARC:", > select "Example Kitchen-Sink Plugin" from the pulldown menu > > there is no new area "Transform file to MARC:". > > tested with Koha 3.16.03.000. (Test-Koha is bilingual english-spanish, and > test was made with both, english and spanish, interfaces). You should be testing this patch on master. Here is a demo video as well: http://screencast.com/t/Q4xtMiQpggN
Created attachment 35483 [details] [review] Bug 12412 - Add ability for plugins to convert arbitrary files to MARC from record staging tool Many libraries would like to be able to import various types of files as MARC records ( citations, csv files, etc ). We can add a new function to the plugins system to allow that kind of behavior at a very custom level. Test Plan: 1) Ensure you have plugins enabled and configured correctly 2) Installed the attached version 2.00 of the Kitchen Sink plugin 3) Download the attached text file 4) Browse to "Stage MARC records for import" 5) Select the downloaded text file for staging 6) After uploading, you should see a new area "Transform file to MARC:", select "Example Kitchen-Sink Plugin" from the pulldown menu 7) Click 'Stage for import" 8) Click 'Manage staged records" 9) You should now see two new MARC records! Signed-off-by: Aleisha <aleishaamohia@hotmail.com>
Created attachment 36478 [details] [review] [PASSED QA] Bug 12412 - Add ability for plugins to convert arbitrary files to MARC from record staging tool Many libraries would like to be able to import various types of files as MARC records ( citations, csv files, etc ). We can add a new function to the plugins system to allow that kind of behavior at a very custom level. Test Plan: 1) Ensure you have plugins enabled and configured correctly 2) Installed the attached version 2.00 of the Kitchen Sink plugin 3) Download the attached text file 4) Browse to "Stage MARC records for import" 5) Select the downloaded text file for staging 6) After uploading, you should see a new area "Transform file to MARC:", select "Example Kitchen-Sink Plugin" from the pulldown menu 7) Click 'Stage for import" 8) Click 'Manage staged records" 9) You should now see two new MARC records! Signed-off-by: Aleisha <aleishaamohia@hotmail.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Works as described - interesting new feature.
Wondering if we should update this to be a 'new feature'?
(In reply to Katrin Fischer from comment #9) > Wondering if we should update this to be a 'new feature'? I would certainly consider this to be a new feature!
Feature pushed to master. Thanks Kyle!
This bug will break Koha installation if there is no enable_plugins in koha-conf.xml with following error: Can't call method "GetPlugins" on an undefined value at /srv/koha_ffzg/tools/stage-marc-import.pl line 206, <DATA> line 603. This is not ideal, since it will break old installations. Problem is line: Koha::Plugins->new()->GetPlugins('to_marc'); where Koha::Plugins->new() will return undef is plugins are not enabled. It seems we also have same syntax in plugins/plugins-home.pl so it should probably be fixed also.
It's a little bit worse: plugins had to be enabled. Even adding <enable_plugins>0</enable_plugins> to koha-conf.xml won't help.
This is a really useful facility and I am using it import directly from Excel spreadsheets (XLS binary format). There is a problem if I try and re-import the same file. I get the impression that the import tries to reload the staged file but in this case it doesn't include the transformation step so I get an error: stage-marc-import.pl: binmode() on closed filehandle STDOUT at /usr/share/koha/lib/C4/Templates.pm line 120., referer: http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl stage-marc-import.pl: Filehandle STDOUT reopened as FH only for input at /usr/lib/perl5/Template/Provider.pm line 964., referer: http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl Have I understood the issue correctly and does the staging facility need to remember the transformation too?
(In reply to Pete Edwards from comment #14) > This is a really useful facility and I am using it import directly from > Excel spreadsheets (XLS binary format). There is a problem if I try and > re-import the same file. I get the impression that the import tries to > reload the staged file but in this case it doesn't include the > transformation step so I get an error: > > stage-marc-import.pl: binmode() on closed filehandle STDOUT at > /usr/share/koha/lib/C4/Templates.pm line 120., referer: > http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl > stage-marc-import.pl: Filehandle STDOUT reopened as FH only for input at > /usr/lib/perl5/Template/Provider.pm line 964., referer: > http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl > > Have I understood the issue correctly and does the staging facility need to > remember the transformation too? Sorry - this was a red herring. I had another error in my plugin meaning I couldn't load the file. However, I still get the following error from somewhere when I import a file: stage-marc-import.pl: binmode() on closed filehandle STDOUT at /usr/share/koha/lib/C4/Templates.pm line 120 I don't know what causes this. Has anyone seen similar?
(In reply to Pete Edwards from comment #15) > (In reply to Pete Edwards from comment #14) > > This is a really useful facility and I am using it import directly from > > Excel spreadsheets (XLS binary format). There is a problem if I try and > > re-import the same file. I get the impression that the import tries to > > reload the staged file but in this case it doesn't include the > > transformation step so I get an error: > > > > stage-marc-import.pl: binmode() on closed filehandle STDOUT at > > /usr/share/koha/lib/C4/Templates.pm line 120., referer: > > http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl > > stage-marc-import.pl: Filehandle STDOUT reopened as FH only for input at > > /usr/lib/perl5/Template/Provider.pm line 964., referer: > > http://library-intra.edwards4.co.uk/cgi-bin/koha/tools/stage-marc-import.pl > > > > Have I understood the issue correctly and does the staging facility need to > > remember the transformation too? > > Sorry - this was a red herring. I had another error in my plugin meaning I > couldn't load the file. However, I still get the following error from > somewhere when I import a file: > stage-marc-import.pl: binmode() on closed filehandle STDOUT at > /usr/share/koha/lib/C4/Templates.pm line 120 > I don't know what causes this. Has anyone seen similar? I think you should either: 1) send an email to the devel list 2) fill a bug for what you are seeing, and check with the devs taking care of it. You should probably do (1) and then (depending on the results) do (2).
Bug 10407 made this rather invisible feature disappear again. Bug 19049 should recover that. It would have been better (looking back) to put some more pointers in the code about this arbitrary format. You should not pass excel files in a variable called $marcrecords..
*** Bug 9964 has been marked as a duplicate of this bug. ***