From dd1fd8784610f40a906537af232f5f63e2c077f3 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 7 Oct 2002 14:04:26 +0000 Subject: [PATCH] road to 1.3.1 : viewing MARC biblio --- C4/Biblio.pm | 18 ++++++++++++------ C4/test.pl | 25 +++++++++++++++++++------ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index f471d75696..dd21d6eb91 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1,6 +1,9 @@ package C4::Biblio; # $Id$ # $Log$ +# Revision 1.16 2002/10/07 14:04:26 tipaul +# road to 1.3.1 : viewing MARC biblio +# # Revision 1.15 2002/10/05 09:49:25 arensb # Merged with arensb-context branch: use C4::Context->dbh instead of # &C4Connect, and generally prefer C4::Context over C4::Database. @@ -280,21 +283,24 @@ sub MARCgettagslib { $sth=$dbh->prepare("select tagfield,libopac as lib from marc_tag_structure"); } $sth->execute; - my ($lib,$tag,$res); - while ( ($tag,$lib) = $sth->fetchrow) { + my ($lib,$tag,$res,$tab); + while ( ($tag,$lib,$tab) = $sth->fetchrow) { $res->{$tag}->{lib}=$lib; + $res->{$tab}->{tab}=""; } if ($forlibrarian eq 1) { - $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian as lib from marc_subfield_structure"); + $sth=$dbh->prepare("select tagfield,tagsubfield,liblibrarian,tab as lib from marc_subfield_structure"); } else { - $sth=$dbh->prepare("select tagfield,tagsubfield,libopac as lib from marc_subfield_structure"); + $sth=$dbh->prepare("select tagfield,tagsubfield,libopac,tab as lib from marc_subfield_structure"); } $sth->execute; my $subfield; - while ( ($tag,$subfield,$lib) = $sth->fetchrow) { - $res->{$tag}->{$subfield}=$lib; + while ( ($tag,$subfield,$lib,$tab) = $sth->fetchrow) { + $res->{$tag}->{$subfield}->{lib}=$lib; + $res->{$tag}->{$subfield}->{tab}=$tab; + } return $res; } diff --git a/C4/test.pl b/C4/test.pl index da928e6aea..6916aed281 100755 --- a/C4/test.pl +++ b/C4/test.pl @@ -1,3 +1,4 @@ +#!/usr/bin/perl package C4::test; # Copyright 2000-2002 Katipo Communications @@ -21,6 +22,9 @@ use strict; require Exporter; use C4::Context; use C4::Catalogue; +use C4::Biblio; +use MARC::Record; +use MARC::File::USMARC; our $dbh = C4::Context->dbh; $dbh->do("delete from marc_subfield_table"); @@ -52,11 +56,20 @@ my $record2=MARCkoha2marc("123456","author","title","unititle","notes","abstract "size","place","lccn"); &MARCaddMarcBiblio($record2); # parse all subfields -my @fields = $record->fields(); -foreach my $field (@fields) { - my @subf=$field->subfields; - for my $i (0..$#subf) { +#my @fields = $record->fields(); +#foreach my $field (@fields) { +# my @subf=$field->subfields; +# for my $i (0..$#subf) { # print $field->tag(), " ", $field->indicator(1),$field->indicator(2), "subf: ", $subf[$i][0]," =",$subf[$i][1]," <-- \n"; -} -} +#} +#} #print $record->as_formatted(); +#my $file = MARC::File::USMARC->in("/home/paul/courriers/koha/exemples_unimarc/env179.1.txt"); +## get a marc record from the MARC::File object +## $record will be a MARC::Record object +#while (my $record = $file->next()) { +## print the title contained in the record +# print $record->as_formatted(),"\n"; +#} +## we're done so close the file +# $file->close(); -- 2.39.5