https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25246 --- Comment #12 from David Cook <dcook@prosentient.com.au> --- Comment on attachment 103711 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=103711 Bug 25246: Add script to export bib data to EBSCO EDS Review of attachment 103711: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=25246&attachment=103711) ----------------------------------------------------------------- Looking at this overall, maybe it should be changed from "export2ebsco.pl" to "export2ftp.pl" or "export_to_ftp.pl" and just made a bit more generalized. Not everyone uses EBSCO, but I'm sure many people use FTP for metadata consumers like national libraries and such. ::: misc/export2ebsco.pl @@ +1,1 @@
+#!/usr/bin/env perl
This should be #!/usr/bin/perl @@ +24,5 @@
+use C4::Context; +use C4::Auth; +use C4::Output; +use C4::Biblio; # GetMarcBiblio GetXmlBiblio +use C4::Koha; # GetItemTypes
Many of these modules appear to be unused? @@ +49,5 @@
+if ( not $result or $want_help ) { + usage(); +} + +unless ( chdir '/tmp' ) {
It would be good to use a configurable directory, since /tmp might be very small on some systems and the export very large @@ +64,5 @@
+ my $export_filename = shift; + my $dbh = C4::Context->dbh; + + my $query = +# 'SELECT distinct biblioitems.biblionumber FROM biblioitems WHERE biblionumber >0 ';
This comment should be removed @@ +65,5 @@
+ my $dbh = C4::Context->dbh; + + my $query = +# 'SELECT distinct biblioitems.biblionumber FROM biblioitems WHERE biblionumber >0 '; + 'SELECT distinct biblioitems.biblionumber FROM biblioitems LEFT JOIN items USING (biblioitemnumber) WHERE biblioitems.biblionumber >0 ';
The WHERE clause seems odd to include but I don't see any problem with it. I'm guessing the author sometimes has biblios with negative biblionumbers? @@ +74,5 @@
+ open my $fh, '>:encoding(utf8)', $export_filename + or croak "Cannot open $export_filename : $!"; + + while ( my ($biblionumber) = $sth->fetchrow_array ) { +# my $marc_record = GetMarcBiblio($biblionumber, 1);
This comment should be removed @@ +91,5 @@
+ my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); + my @tm = localtime(); + my $month = $tm[4]; + my $year = $tm[5] - 100; + my $name = 'INSERT FILE NAME HERE' . $abbr[$month] . $year;
The filename needs to be provided by a CLI option or configuration file @@ +101,5 @@
+} + +sub transfer_file { + my $marc_file = shift; + my $remote = 'ftp.epnet.com';
Probably best not to hard-code this either, since hostnames are prone to change @@ +103,5 @@
+sub transfer_file { + my $marc_file = shift; + my $remote = 'ftp.epnet.com'; + my $username = q(INSERT USERNAME HERE); + my $password = q(INSERT PASSWORD HERE);
The username and password need to be provided by a CLI option or configuration file (the latter being better for security). -- You are receiving this mail because: You are watching all bug changes.