koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha C4/AuthoritiesMarc.pm misc/zebra/ccl.prope... [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha C4/AuthoritiesMarc.pm misc/zebra/ccl.prope... [rel_3_0]
Date: Wed, 24 Jan 2007 10:17:47 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      07/01/24 10:17:47

Modified files:
        C4             : AuthoritiesMarc.pm 
        misc/zebra     : ccl.properties 

Log message:
        FindDuplicate Now works.
        Be AWARE that it needs a change ccl.properties.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.28.2.14&r2=1.28.2.15
http://cvs.savannah.gnu.org/viewcvs/koha/misc/zebra/ccl.properties?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.4.3&r2=1.1.4.4

Patches:
Index: C4/AuthoritiesMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.28.2.14
retrieving revision 1.28.2.15
diff -u -b -r1.28.2.14 -r1.28.2.15
--- C4/AuthoritiesMarc.pm       10 Jan 2007 14:40:11 -0000      1.28.2.14
+++ C4/AuthoritiesMarc.pm       24 Jan 2007 10:17:47 -0000      1.28.2.15
@@ -22,6 +22,7 @@
 use C4::Koha;
 use MARC::Record;
 use C4::Biblio;
+use C4::Search;
 #use ZOOM;
 use vars qw($VERSION @ISA @EXPORT);
 
@@ -182,7 +183,7 @@
     # #      }
     #     }#
     
-        my $summary=getsummary($dbh,$authrecord,$authid,$authtypecode);
+        my $summary=getsummary($authrecord,$authid,$authtypecode);
         $summary="<a href='detail.pl?authid=$authid'>".$summary.".</a>";
     #     if ($linkid && $linksummary ne " ".$separator){
     #         $summary="<b>".$summary."</b>".$linksummary;
@@ -387,8 +388,8 @@
         $authid=$authid+1;
   ##Insert the recordID in MARC record 
   ##Both authid and authtypecode is expected to be in the same field. Modify 
if other requirements arise
-          $record->add_fields('001',$authid);
-          $record->add_fields('152','','','b'=>$authtypecode);
+          $record->add_fields('001',$authid) unless $record->field('001');
+          $record->add_fields('152','','','b'=>$authtypecode) unless 
$record->field('152');
 #           $record->add_fields('100','','','b'=>$authtypecode);
           warn $record->as_formatted;
           $dbh->do("lock tables auth_header WRITE");
@@ -629,20 +630,15 @@
     $sth->execute($authtypecode);
     my ($auth_tag_to_report) = $sth->fetchrow;
     $sth->finish;
+#     warn "record :".$record->as_formatted." authtattoreport 
:$auth_tag_to_report";
     # build a request for authoritysearch
-    my (@tags, @and_or, @excluding, @operator, @value, $offset, $length);
-    if ($record->field($auth_tag_to_report)) {
-                push @tags, $auth_tag_to_report;
-                push @and_or, "";
-                push @excluding, "";
-                push @operator, "all";
-                push @value, $record->field($auth_tag_to_report)->as_string();
-             }
- 
-    my ($finalresult,$nbresult) = 
authoritysearch($dbh,address@hidden,address@hidden,address@hidden,address@hidden,address@hidden,0,10,$authtypecode);
+    my $query='at='.$authtypecode.' ';
+    map {$query.= " and he=\"".$_->[1]."\"" if ($_->[0]=~/[A-z]/)}  
$record->field($auth_tag_to_report)->subfields();
+    my ($error,$results)=SimpleSearch($query,"authorityserver");
     # there is at least 1 result => return the 1st one
-    if ($nbresult>0) {
-        return @$finalresult[0]->{authid},@$finalresult[0]->{summary};
+    if (@$results>0) {
+      my $marcrecord = MARC::File::USMARC::decode($results->[0]);
+      return 
$marcrecord->field('001')->data,getsummary($marcrecord,$marcrecord->field('001')->data,$authtypecode);
     }
     # no result, returns nothing
     return;
@@ -650,8 +646,9 @@
 
 sub getsummary{
 ## give this a Marc record to return summary
-my ($dbh,$record,$authid,$authtypecode)address@hidden;
+my ($record,$authid,$authtypecode)address@hidden;
 
+my $dbh=C4::Context->dbh;
 # my $authtypecode = AUTHfind_authtypecode($dbh,$authid);
  my $authref = getauthtype($authtypecode);
         my $summary = $authref->{summary};
@@ -930,7 +927,7 @@
         my $oldbiblio = MARCmarc2koha($dbh,$marcrecord,"") ;
         if ($update==1){
         # FIXME : this NEWmodbiblio does not exist anymore...
-        
&NEWmodbiblio($dbh,$marcrecord,$oldbiblio->{'biblionumber'},undef,"0000") ;
+        
&ModBiblio($marcrecord,$oldbiblio->{'biblionumber'},MARCfind_frameworkcode($oldbiblio->{'biblionumber'}))
 ;
         }
     
 }#foreach $marc
@@ -947,8 +944,12 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.28.2.14 2007/01/10 14:40:11 hdl Exp $
+# $Id: AuthoritiesMarc.pm,v 1.28.2.15 2007/01/24 10:17:47 hdl Exp $
 # $Log: AuthoritiesMarc.pm,v $
+# Revision 1.28.2.15  2007/01/24 10:17:47  hdl
+# FindDuplicate Now works.
+# Be AWARE that it needs a change ccl.properties.
+#
 # Revision 1.28.2.14  2007/01/10 14:40:11  hdl
 # Adding Authorities tree.
 #

Index: misc/zebra/ccl.properties
===================================================================
RCS file: /cvsroot/koha/koha/misc/zebra/Attic/ccl.properties,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -u -b -r1.1.4.3 -r1.1.4.4
--- misc/zebra/ccl.properties   9 Jan 2007 15:18:10 -0000       1.1.4.3
+++ misc/zebra/ccl.properties   24 Jan 2007 10:17:47 -0000      1.1.4.4
@@ -1,5 +1,5 @@
 # CCL field mappings
-# $Id: ccl.properties,v 1.1.4.3 2007/01/09 15:18:10 hdl Exp $
+# $Id: ccl.properties,v 1.1.4.4 2007/01/24 10:17:47 hdl Exp $
 # There are four types of lines in a CCL profile: 
 #  1. qualifier specification
 #      qualifier-name   [  attributeset   ,]  type   =   val   [  attributeset 
  ,]  type   =   val   ...
@@ -796,6 +796,18 @@
 Authority-number           1=Koha-Auth-Number
 an Authority-number
 
+#Authority/format-id        authtypecode  The Code 
+#                           associated to an authority type
+#                                                            152$b in 
authority records
+Authority/format-id           1=Authority/format-id
+at Authority/format-id
+
+#Heading-Entity             Information for Heading in an 
+#                           authority record 
+#                                                             usually 2.. 
fields
+Heading-Entity           1=Heading-Entity
+he Heading-Entity
+
 
 ### 2. BIB1 RELATION ATTRIBUTES
 lt 2=1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]