From ff0508c4d243ac3a6ddc14a3078f22b097eeab2c Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 14 Feb 2006 11:25:22 +0000 Subject: [PATCH] road to 3.0 : updating a biblio in zebra seems to work. Still working on it, there are probably some bugs ! --- C4/Biblio.pm | 38 ++++++++++++++++++++++++++------------ cataloguing/addbiblio.pl | 7 +++---- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index d2d1f9a0d2..dc4fd77b32 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -139,17 +139,27 @@ all subs requires/use $dbh as 1st parameter and a hash as 2nd parameter. sub zebra_create { my ($biblionumber,$record) = @_; # create the iso2709 file for zebra - my $cgidir = C4::Context->intranetdir ."/cgi-bin"; - unless (opendir(DIR, "$cgidir")) { - $cgidir = C4::Context->intranetdir."/"; - } - closedir DIR; - my $filename = $cgidir."/zebra/biblios/BIBLIO".$biblionumber."iso2709"; - open F,"> $filename"; - print F $record->as_usmarc(); - close F; - my $res = system("cd $cgidir/zebra;/usr/local/bin/zebraidx update biblios"); - unlink($filename); +# my $cgidir = C4::Context->intranetdir ."/cgi-bin"; +# unless (opendir(DIR, "$cgidir")) { +# $cgidir = C4::Context->intranetdir."/"; +# } +# closedir DIR; +# my $filename = $cgidir."/zebra/biblios/BIBLIO".$biblionumber."iso2709"; +# open F,"> $filename"; +# print F $record->as_usmarc(); +# close F; +# my $res = system("cd $cgidir/zebra;/usr/local/bin/zebraidx update biblios"); +# unlink($filename); + warn "zebra_create : $biblionumber =".$record->as_formatted; + eval { + $Zconn = new ZOOM::Connection(C4::Context->config("zebradb")); + }; + $Zconn->option(cqlfile => C4::Context->config("intranetdir")."/zebra/pqf.properties"); +# my $record = XMLgetbiblio($dbh,$biblionumber); + my $Zpackage = $Zconn->package(); + $Zpackage->option(action => "specialUpdate"); + $Zpackage->option(record => $record->as_xml()); + $Zpackage->send("update"); } =head2 @tagslib = &MARCgettagslib($dbh,1|0,$frameworkcode); @@ -765,9 +775,10 @@ sub NEWmodbiblio { $oldbiblio->{frameworkcode} = $frameworkcode; #create the marc entry, that stores the rax marc record in Koha 3.0 + $oldbiblio->{biblionumber} = $biblionumber unless $oldbiblio->{biblionumber}; $oldbiblio->{marc} = $record->as_usmarc(); $oldbiblio->{marcxml} = $record->as_xml(); - + warn "dans NEWmodbiblio $biblionumber = ".$oldbiblio->{biblionumber}." = ".$oldbiblio->{marcxml}; REALmodbiblio($dbh,$oldbiblio); REALmodbiblioitem($dbh,$oldbiblio); # now, modify addi authors, subject, addititles. @@ -2908,6 +2919,9 @@ Paul POULAIN paul.poulain@free.fr # $Id$ # $Log$ +# Revision 1.138 2006/02/14 11:25:22 tipaul +# road to 3.0 : updating a biblio in zebra seems to work. Still working on it, there are probably some bugs ! +# # Revision 1.137 2006/02/13 16:34:26 tipaul # fixing some warnings (perl -w should be quiet) # diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl index 55b5c5bdf3..4519732a33 100755 --- a/cataloguing/addbiblio.pl +++ b/cataloguing/addbiblio.pl @@ -354,8 +354,6 @@ my $z3950 = $input->param('z3950'); my $op = $input->param('op'); my $frameworkcode = $input->param('frameworkcode'); my $dbh = C4::Context->dbh; -my $bibid; - $frameworkcode = &MARCfind_frameworkcode($dbh,$biblionumber) if ($biblionumber and not ($frameworkcode)); $frameworkcode='' if ($frameworkcode eq 'Default'); @@ -432,8 +430,9 @@ if ($op eq "addbiblio") { if (!$duplicatebiblionumber or $confirm_not_duplicate) { # MARC::Record built => now, record in DB if ($is_a_modif) { - NEWmodbiblioframework($dbh,$bibid,$frameworkcode); - NEWmodbiblio($dbh,$record,$bibid,$frameworkcode); + warn "ITS A MODIF : .$biblionumber"; + NEWmodbiblioframework($dbh,$biblionumber,$frameworkcode); + NEWmodbiblio($dbh,$record,$biblionumber,$frameworkcode); } else { my $biblioitemnumber; ($biblionumber,$biblioitemnumber) = NEWnewbiblio($dbh,$record,$frameworkcode); -- 2.39.5