koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] koha/C4 AuthoritiesMarc.pm [rel_3_0]


From: Henri-Damien LAURENT
Subject: [Koha-cvs] koha/C4 AuthoritiesMarc.pm [rel_3_0]
Date: Tue, 09 Jan 2007 13:51:32 +0000

CVSROOT:        /cvsroot/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Henri-Damien LAURENT <hdl>      07/01/09 13:51:31

Modified files:
        C4             : AuthoritiesMarc.pm 

Log message:
        Bug Fixing : AUTHcount_usage used *synchronous* connection where biblio 
used ****asynchronous**** one.
        First try to get it work.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/AuthoritiesMarc.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.28.2.11&r2=1.28.2.12

Patches:
Index: AuthoritiesMarc.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/AuthoritiesMarc.pm,v
retrieving revision 1.28.2.11
retrieving revision 1.28.2.12
diff -u -b -r1.28.2.11 -r1.28.2.12
--- AuthoritiesMarc.pm  5 Jan 2007 14:37:26 -0000       1.28.2.11
+++ AuthoritiesMarc.pm  9 Jan 2007 13:51:31 -0000       1.28.2.12
@@ -101,7 +101,8 @@
         }
         if (@$operator[$i] eq 'phrase') {
              $attr.=" address@hidden 4=1  address@hidden 5=100 address@hidden 
6=2 ";##Phrase, No truncation,all of subfield field must match
-    
+        }elsif (@$operator[$i] eq "="){
+             $attr.=" address@hidden 4=107 ";#Phrase, No truncation,all of 
subfield field must     
         } else {
              $attr .=" address@hidden 4=6  address@hidden 5=1  ";## Word list, 
right truncated, anywhere
         }
@@ -121,9 +122,7 @@
 $length=10 unless $length;
 my @oAuth;
 my $i;
- $oAuth[0]=C4::Context->Zconn("authorityserver");
- 
-#$oAuth[0]->connect;
+$oAuth[0]=C4::Context->Zconn("authorityserver" , 1);
 my $Anewq= new ZOOM::Query::PQF($query,$oAuth[0]);
 # $Anewq->sortby("1=Heading i< 1=Heading-Entity i< ");
 # $Anewq->sortby("1=Heading i< 1=Heading-Entity i< ");
@@ -205,37 +204,10 @@
 
 
   ###
-   my @oConnection;
-   my @oResult;
-   $oConnection[0]= C4::Context->Zconn("biblioserver");
    for (my $z=0; $z<@finalresult; $z++){
-       my $nquery;
-           $nquery= "address@hidden 1=Koha-Auth-Number 
".$finalresult[$z]{authid};
-# #           $nquery="address@hidden ".$nquery." address@hidden GILS 1=2057 
".$finalresult[$z]{linkid} if $finalresult[$z]{linkid};
-         $oResult[$z] = $oConnection[0]->search_pqf($nquery);
-#   
-#   FIXME : I Don't what this code is suposed to do
-#   OTHERS:
-#   while (($i = ZOOM::event(address@hidden)) != 0) {
-#       my $ev = $oConnection[0]->last_event();
-#   #    warn("connection ", $i-1, ": event $ev (", ZOOM::event_str($ev), 
")\n");
-#       last if $ev == ZOOM::Event::ZEND;
-#   }
-#   if ($i !=0){
-#    my($error, $errmsg, $addinfo, $diagset) = $oConnection[0]->error_x();
-#       if ($error) {
-#       warn  "oConnection $ error: $errmsg ($error) $addinfo\n";
-#        ##In fact its an error. Should we inform at least the librarian?
-#       next;
-#           }
-#       
-           my  $count=$oResult[$z]->size()  ;
+        my  $count=AUTHcount_usage($finalresult[$z]{authid});
            $finalresult[$z]{used}=$count;
-#   #        $oResult->destroy();
-#   #        $oConnection[$i-1]->destroy();
-#    }
    }# all $z's
-# 
 
 }## if nbresult
 NOLUCK:
@@ -306,15 +278,23 @@
 sub AUTHcount_usage {
     my ($authid) = @_;
 ### try ZOOM search here
-my $oConnection=C4::Context->Zconn("biblioserver");
+my $oConnection=C4::Context->Zconn("biblioserver",1);
 my $query;
 $query= "address@hidden 1=Koha-Auth-Number ".$authid;
 
 my $oResult = $oConnection->search_pqf($query);
-
-my $result=$oResult->size() if  ($oResult);
-    
-    return ($result);
+my $result;
+while ((my $i = ZOOM::event([ $oConnection ])) != 0) {
+    my $ev = $oConnection->last_event();
+    warn("connection ", $i-1, ": ", ZOOM::event_str($ev), "\n");
+    if ($ev == ZOOM::Event::ZEND) {
+        $result = $oResult->size();
+        warn "connection ", $i-1, ": $result hits\n";
+        warn $oResult->record(0)->render()
+            if $result > 0;
+    }
+}
+return ($result);
 }
 
 
@@ -349,7 +329,7 @@
 
     while ( ( $tag, $liblibrarian, $libopac, $mandatory, $repeatable ) = 
$sth->fetchrow ) {
         $res->{$tag}->{lib}        = ($forlibrarian or 
!$libopac)?$liblibrarian:$libopac;
-        $res->{$tab}->{tab}        = "";            # XXX
+        $res->{$tag}->{tab}        = " ";            # XXX
         $res->{$tag}->{mandatory}  = $mandatory;
         $res->{$tag}->{repeatable} = $repeatable;
     }
@@ -642,7 +622,6 @@
 
 
 
-
 sub FindDuplicate {
 
     my ($record,$authtypecode)address@hidden;
@@ -879,8 +858,12 @@
 
 =cut
 
-# $Id: AuthoritiesMarc.pm,v 1.28.2.11 2007/01/05 14:37:26 btoumi Exp $
+# $Id: AuthoritiesMarc.pm,v 1.28.2.12 2007/01/09 13:51:31 hdl Exp $
 # $Log: AuthoritiesMarc.pm,v $
+# Revision 1.28.2.12  2007/01/09 13:51:31  hdl
+# Bug Fixing : AUTHcount_usage used *synchronous* connection where biblio used 
****asynchronous**** one.
+# First try to get it work.
+#
 # Revision 1.28.2.11  2007/01/05 14:37:26  btoumi
 # bug fix : remove wrong field in sql syntaxe from auth_subfield_structure 
table
 #




reply via email to

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