From 7068b5f3165307d58f587356376b829da87c8e50 Mon Sep 17 00:00:00 2001 From: kados Date: Fri, 29 Sep 2006 16:14:25 +0000 Subject: [PATCH] for some reason this didn't get updated properly, but was committed to HEAD instead of dev_week. --- C4/AuthoritiesMarc.pm | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index df6c12a087..8a293cc9e3 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -121,7 +121,7 @@ my $counter = $offset; $length=10 unless $length; my @oAuth; my $i; - $oAuth[0]=C4::Context->Zconnauth("authorityserver"); + $oAuth[0]=C4::Context->Zconn("authorityserver",1,1); my ($mainentry)=MARCfind_attr_from_kohafield("mainentry"); my ($allentry)=MARCfind_attr_from_kohafield("allentry"); @@ -316,23 +316,15 @@ sub AUTHaddauthority { $sth->execute; ($authid)=$sth->fetchrow; $authid=$authid+1; - XML_writeline($record,"authid",$authid,"authorities"); - XML_writeline($record,"authtypecode",$authtypecode,"authorities"); - my $xml=XML_hash2xml($record); - $dbh->do("lock tables auth_header WRITE"); - $sth=$dbh->prepare("insert into auth_header (authid,datecreated,authtypecode,marcxml) values (?,now(),?,?)"); - $sth->execute($authid,$authtypecode,$xml); - $sth->finish; - }else - -##Modified record may also come here use UPDATE -- bulk import comes here - XML_writeline($record,"authid",$authid,"authorities"); - XML_writeline($record,"authtypecode",$authtypecode,"authorities"); - my $xml=XML_hash2xml($record); - my $sth=$dbh->prepare("UPDATE auth_header set marcxml=?,authtypecode=? where authid=?"); - $sth->execute($xml,$authtypecode,$authid); + } + +##Modified record may also come here use REPLACE -- bulk import comes here +XML_writeline($record,"authid",$authid,"authorities"); +XML_writeline($record,"authtypecode",$authtypecode,"authorities"); +my $xml=XML_hash2xml($record); + my $sth=$dbh->prepare("REPLACE auth_header set marcxml=?, authid=?,authtypecode=?,datecreated=now()"); + $sth->execute($xml,$authid,$authtypecode); $sth->finish; - } ZEBRAop($dbh,$authid,'specialUpdate',"authorityserver"); ## If the record is linked to another update the linked authorities with new authid my @linkids=XML_readline_asarray($record,"linkid","authorities"); @@ -746,7 +738,7 @@ $oConnection[0]->destroy(); if ($update==1){ my $biblionumber=XML_readline_onerecord($xmlhash,"biblionumber","biblios"); my $frameworkcode=MARCfind_frameworkcode($dbh,$biblionumber); - NEWmodbiblio($dbh,$biblionumber,$xmlhash,$frameworkcode) ; + ModBiblio($dbh,$biblionumber,$xmlhash,$frameworkcode) ; } }#foreach $xmlhash -- 2.39.5