From 4b9af7f1ff356cb42371270644fec0abec9e1029 Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 13 Dec 2002 16:22:04 +0000 Subject: [PATCH] 1st draft of marc export --- C4/Biblio.pm | 4 ++ export/marc.pl | 43 +++++++++++++++++++ .../intranet-tmpl/default/en/export/marc.tmpl | 19 ++++++++ .../default/en/parameters/admin-home.tmpl | 36 ++++++++-------- 4 files changed, 85 insertions(+), 17 deletions(-) create mode 100755 export/marc.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/export/marc.tmpl diff --git a/C4/Biblio.pm b/C4/Biblio.pm index d62b8f1b6c..df269488b5 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1,6 +1,9 @@ package C4::Biblio; # $Id$ # $Log$ +# Revision 1.31 2002/12/13 16:22:04 tipaul +# 1st draft of marc export +# # Revision 1.30 2002/12/12 21:26:35 tipaul # YAB ! (Yet Another Bugfix) => related to biblio modif # (some warning cleaning too) @@ -534,6 +537,7 @@ sub MARCgetbiblio { my ($dbh,$bibid)=@_; my $record = MARC::Record->new(); #---- TODO : the leader is missing + $record->leader(' '); my $sth=$dbh->prepare("select bibid,subfieldid,tag,tagorder,tag_indicator,subfieldcode,subfieldorder,subfieldvalue,valuebloblink from marc_subfield_table where bibid=? order by tag,tagorder,subfieldcode diff --git a/export/marc.pl b/export/marc.pl new file mode 100755 index 0000000000..9b916bc925 --- /dev/null +++ b/export/marc.pl @@ -0,0 +1,43 @@ +#!/usr/bin/perl +use HTML::Template; +use strict; +require Exporter; +use C4::Database; +use C4::Output; # contains gettemplate +use C4::Biblio; +use CGI; +use C4::Auth; + +my $query = new CGI; +my $op=$query->param("op"); +if ($op eq "export") { + print $query->header('Content-Type: text/marc'); + my $start_bib = $query->param("start_bib"); + my $end_bib = $query->param("end_bib"); + my $dbh=C4::Context->dbh; + my $query; + if ($start_bib && $end_bib) { + $query = "select bibid from marc_biblio where bibid >=$start_bib and bibid <=$end_bib order by bibid"; + } else { + $query = "select bibid from marc_biblio order by bibid"; + } + my $sth=$dbh->prepare($query); + $sth->execute; + while (my ($bibid) = $sth->fetchrow) { + warn "getting : $bibid"; + my $record = MARCgetbiblio($dbh,$bibid); + warn $record->as_formatted(); + print $record->as_usmarc(); + } +} else { + my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "export/marc.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); + print $query->header(-cookie => $cookie), $template->output; +} + diff --git a/koha-tmpl/intranet-tmpl/default/en/export/marc.tmpl b/koha-tmpl/intranet-tmpl/default/en/export/marc.tmpl new file mode 100644 index 0000000000..563b9baf57 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/export/marc.tmpl @@ -0,0 +1,19 @@ + + +

Logged in as: [Log Out]

+ +

Log In to Koha

+
+
+Koha admin page


+Export in MARC format the following biblios : +
+

from biblio number : +to biblio number :

+ + +
+ +

(leave blank to export every biblio)

+

Note : the items are NOT exported by this tool

+ diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl index 3ba7055937..99f1ead22e 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl @@ -4,15 +4,15 @@

Log In to Koha

-
-Koha admin page


+Koha admin page
- +
Biblio related parameters Parameters
- +
+ @@ -35,21 +35,11 @@ -
Biblio related
Item types the supports of an item.Thesaurus management. You can define as many thesaurus as needed, through definiitions of thesaurus "category"
- - - -
MARC related parameters
- + -
MARC related
MARC tag structureMARC structure : tag then subfields
Links koha - MARC DBDefine links between the koha standard DB and the MARC one. Note those links can be defined through MARC structure. This tool is just a shortcut to speed up linkage
- - - - -
Various datas :
- + + @@ -80,5 +70,17 @@
Various parameters
libraries branches the differents branches you manage with this koha server
+ + + + +
Tools
+ + + + + + +
Export
MARC biblio exportExporting in MARC format
-- 2.39.5