koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/C4 AuthoritiesMarc.pm,1.12,1.13


From: Henri-Damien LAURENT
Subject: [Koha-cvs] CVS: koha/C4 AuthoritiesMarc.pm,1.12,1.13
Date: Tue, 05 Apr 2005 08:24:00 -0700

Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32069/C4

Modified Files:
        AuthoritiesMarc.pm 
Log Message:
Searching for double entries when adding a new authority.

Index: AuthoritiesMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** AuthoritiesMarc.pm  5 Apr 2005 09:58:48 -0000       1.12
--- AuthoritiesMarc.pm  5 Apr 2005 15:23:41 -0000       1.13
***************
*** 76,82 ****
        # "Normal" statements
        # quote marc fields/subfields
!       for (my $i=0;$i<$#{$tags};$i++) {
                if (@$tags[$i]) {
                        @$tags[$i] = $dbh->quote(@$tags[$i]);
                }
        }
--- 76,84 ----
        # "Normal" statements
        # quote marc fields/subfields
!       for (my $i=0;$i<=$#{$tags};$i++) {
! #             warn " $i: "address@hidden;
                if (@$tags[$i]) {
                        @$tags[$i] = $dbh->quote(@$tags[$i]);
+ #                     warn " $i After process: "address@hidden;
                }
        }
***************
*** 197,200 ****
--- 199,203 ----
                if (@$value[$i]) {
                        $nb_active++;
+ #                     warn " @$tags[$i]";
                        if ($nb_active==1) {
                                if (@$operator[$i] eq "start") {
***************
*** 850,877 ****
        my $dbh = C4::Context->dbh;
        
!       warn "".$record->as_formatted;
        # search duplicate on ISBN, easy and fast...
!       my $sth = $dbh->prepare("select auth_tag_to_report from auth_types 
where authtypecode=?");
        $sth->execute($authtypecode);
!       my ($auth_tag_to_report) = $sth->fetchrow;
        $sth->finish;
        # a more complex search : build a request for authoritysearch
        my (@tags, @and_or, @excluding, @operator, @value, $offset, $length);
        # search on biblio.title
!       warn " tag a reporter : $auth_tag_to_report";
        if ($record->fields($auth_tag_to_report)) {
!               my $sth = $dbh->prepare("select tagfield,tagsubfield from 
auth_subfield_structure where tagfield=? and authtypecode=? and tab >= 0");
!               $sth->execute($auth_tag_to_report,$authtypecode);
!               warn " Champ $auth_tag_to_report present";
!               while (my ($tag,$subfield) = $sth->fetchrow){
!                       if ($record->field($tag)->subfields($subfield)) {
!                               warn "tag :".$tag." subfield: $subfield value : 
$record->field($tag)->subfield($subfield)->as_formatted";
!                               push @tags, "'".$tag.$subfield."'";
                                push @and_or, "and";
                                push @excluding, "";
                                push @operator, "contains";
!                               push @value, 
$record->field($tag)->subfield($subfield);
                        }
                }
        }
   
--- 853,902 ----
        my $dbh = C4::Context->dbh;
        
! #     warn "".$record->as_formatted;
        # search duplicate on ISBN, easy and fast...
!       my $sth = $dbh->prepare("select auth_tag_to_report,summary from 
auth_types where authtypecode=?");
        $sth->execute($authtypecode);
!       my ($auth_tag_to_report,$taglist) = $sth->fetchrow;
        $sth->finish;
        # a more complex search : build a request for authoritysearch
        my (@tags, @and_or, @excluding, @operator, @value, $offset, $length);
        # search on biblio.title
! #     warn " tag a reporter : $auth_tag_to_report";
!       warn "taglist ".$taglist;
!       my @subfield = split /\[/,  $taglist;
!       my $max = @subfield;
!       for (my $i=1; $i<$max;$i++){
!               warn " ".$subfield[$i];
!               $subfield[$i]=substr($subfield[$i],3,1);
!               warn " ".$subfield[$i];
!       }
!       
        if ($record->fields($auth_tag_to_report)) {
!               foreach my $subfieldcount (1..$#subfield){
!                       if 
($record->field($auth_tag_to_report)->subfields($subfield[$subfieldcount])) {
! #                             warn "tag :".$tag." subfield: $subfield value : 
".$record->field($tag)->subfield($subfield);
!                               push @tags, 
$auth_tag_to_report.$subfield[$subfieldcount];
! #                             warn "'".$tag.$subfield."' value :". 
$record->field($tag)->subfield($subfield);
                                push @and_or, "and";
                                push @excluding, "";
                                push @operator, "contains";
!                               push @value, 
$record->field($auth_tag_to_report)->subfield($subfield[$subfieldcount]);
                        }
                }
+               
+ #             my $sth = $dbh->prepare("select tagfield,tagsubfield from 
auth_subfield_structure where tagfield=? and authtypecode=? and tab >= 0");
+ #             $sth->execute($auth_tag_to_report,$authtypecode);
+ #             warn " field $auth_tag_to_report exists";
+ #             while (my ($tag,$subfield) = $sth->fetchrow){
+ #                     if ($record->field($tag)->subfields($subfield)) {
+ # #                           warn "tag :".$tag." subfield: $subfield value : 
".$record->field($tag)->subfield($subfield);
+ #                             push @tags, $tag.$subfield;
+ # #                           warn "'".$tag.$subfield."' value :". 
$record->field($tag)->subfield($subfield);
+ #                             push @and_or, "and";
+ #                             push @excluding, "";
+ #                             push @operator, "contains";
+ #                             push @value, 
$record->field($tag)->subfield($subfield);
+ #                     }
+ #             }
        }
   
***************
*** 879,884 ****
        # there is at least 1 result => return the 1st one
        if ($nbresult) {
!               warn "$nbresult => 
"address@hidden>{authid},@$finalresult[0]->{summary};
!               return 
@$finalresult[0]->{authid},@$finalresult[0]->{authid},@$finalresult[0]->{summary};
        }
        # no result, returns nothing
--- 904,909 ----
        # there is at least 1 result => return the 1st one
        if ($nbresult) {
!               warn "$nbresult => 
"address@hidden>{authid},$record->field($auth_tag_to_report)->subfield('a');
!               return 
@$finalresult[0]->{authid},@$finalresult[0]->{authid},$record->field($auth_tag_to_report)->subfield('a');
        }
        # no result, returns nothing
***************
*** 900,903 ****
--- 925,931 ----
  # $Id$
  # $Log$
+ # Revision 1.13  2005/04/05 15:23:41  hdl
+ # Searching for double entries when adding a new authority.
+ #
  # Revision 1.12  2005/04/05 09:58:48  hdl
  # Adding double authority search before creating a new authority




reply via email to

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