[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/C4 AuthoritiesMarc.pm [hdl_auth]
From: |
Henri-Damien LAURENT |
Subject: |
[Koha-cvs] koha/C4 AuthoritiesMarc.pm [hdl_auth] |
Date: |
Mon, 22 May 2006 15:45:12 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch: hdl_auth
Changes by: Henri-Damien LAURENT <address@hidden> 06/05/22 15:45:11
Modified files:
C4 : AuthoritiesMarc.pm
Log message:
Unstable code.
Should be worked upon.
But am close to the solution.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/AuthoritiesMarc.pm.diff?only_with_tag=hdl_auth&tr1=1.9.2.17.4.2&tr2=1.9.2.17.4.3&r1=text&r2=text
Patches:
Index: koha/C4/AuthoritiesMarc.pm
diff -u koha/C4/AuthoritiesMarc.pm:1.9.2.17.4.2
koha/C4/AuthoritiesMarc.pm:1.9.2.17.4.3
--- koha/C4/AuthoritiesMarc.pm:1.9.2.17.4.2 Fri May 19 21:46:56 2006
+++ koha/C4/AuthoritiesMarc.pm Mon May 22 15:45:11 2006
@@ -1049,42 +1049,58 @@
$summary.= '<p><div class="label">TP :
'.$seeheading.'</div></p>' if ($seeheading);
}
}
- warn "buildsummary : $summary";
+# warn "buildsummary : $summary";
return $summary;
}
sub BuildUnimarcHierarchies{
my $authid = shift @_;
my $hierarchies =shift @_;
+ my @globalresult;
my $dbh=C4::Context->dbh;
my $record = AUTHgetauthority($dbh,$authid);
my $authtypecode = AUTHfind_authtypecode($dbh,$authid);
if (@$hierarchies){
- foreach my $element (@$hierarchies){
- $element = BuildUnimarcHierarchy($record).$element;
- warn "element :".$element;
+ foreach (@$hierarchies){
+ $_ = BuildUnimarcHierarchy($record)."\n$_";
}
} else {
push @$hierarchies,BuildUnimarcHierarchy($record);
}
- while (my
($result,$total)=authoritysearch($dbh,['5503','5505'],['and','and'],'',['=','='],[$authid,'h'],0,100,$authtypecode))
{
- warn "total : $total";
-# foreach my $parentauthid (map { $_->{'authid'} } @$result){warn
$parentauthid;}
- if ($total){
+ my
($result,$total)=authoritysearch($dbh,['5503','5505'],['and','and'],'',['=','='],[$authid,'h'],0,100,$authtypecode);
+ if ($total){
+ my $found;
foreach my $parentauthid (map { $_->{'authid'} } @$result){
+ print "parentauthid :",$parentauthid,"\n";
my $parentrecord = AUTHgetauthority($dbh,$parentauthid);
- print $parentauthid;
- print $parentrecord->as_formatted;
+# print $parentrecord->as_formatted;
# foreach my $element (@$hierarchies){
-# warn "element :".$element;
-# }
-# $hierarchies = BuildUnimarcHierarchies($authid,$hierarchies);
- }
- last;
- } else {
- last;
- }
+# warn "element :".$element;
+# }
+ #checking results
+ foreach my $field ($parentrecord->fields('550')){
+ if (($field->subfield('3')) && ($field->subfield('3') eq
$authid) && ($field->subfield('5')) && ($field->subfield('5') eq 'h')) {
+# print $parentauthid;
+# print $parentrecord->as_formatted;
+ my $localresult=$hierarchies;
+ foreach (@$localresult){
+ print "element initial:".$_."\n";
+ }
+ BuildUnimarcHierarchies($parentauthid,$localresult);
+ foreach (@$localresult){
+ print "element final:".$_."\n";
+ }
+ @globalresult = (@globalresult,@$localresult);
+ $found=1;
+ }
+ }
+ }
}
- return $hierarchies;
+ address@hidden;
+# @$hierarchies=[];
+# foreach (@globalresult) {
+# push @$hierarchies, $_;
+# }
+# return $hierarchies;
}
sub BuildUnimarcHierarchy{
my $record = shift @_;
@@ -1106,10 +1122,10 @@
}
my $hierarchy=
($parents?
- $parents."<sup><a
onclick=\"showParents('$authid')\">+</a></sup><a
href=\"detail.pl?auhtid=".$authid.'\">':
+ $parents."<sup><a
onclick=\"showParents('$authid')\">+</a></sup>":
"").
- $record->field('250')->subfield('a').
- ($children?"</a><sub><a
onclick=\"showChildren('$authid')\">+</a></sub><br/>
+ '<a
href="detail.pl?auhtid='.$authid.'">'.$record->field('250')->subfield('a').'</a>'.
+ ($children?"<sub><a onclick=\"showChildren('$authid')\">+</a></sub><br/>
".$children:"");
$hierarchy='<div id="'.$authid.'" class="element">'.$hierarchy.'</div>';
return $hierarchy;
@@ -1127,14 +1143,16 @@
=cut
-# $Id: AuthoritiesMarc.pm,v 1.9.2.17.4.2 2006/05/19 21:46:56 hdl Exp $
+# $Id: AuthoritiesMarc.pm,v 1.9.2.17.4.3 2006/05/22 15:45:11 hdl Exp $
# $Log: AuthoritiesMarc.pm,v $
-# Revision 1.9.2.17.4.2 2006/05/19 21:46:56 hdl
-# First try on BuildHierarchies
-# Strange bug : authoritysearch returns some results where none should be.
reason : I search for a record with ONE tag with two subfields matching two
different requirements.
-# It returns me all the records containing tags matching either One
requirement or the other.
-#
-# My termination condition is thus never reached.
+# Revision 1.9.2.17.4.3 2006/05/22 15:45:11 hdl
+# Unstable code.
+# Should be worked upon.
+# But am close to the solution.
+#
+# Revision 1.1.2.1 2006/05/19 22:05:58 hdl
+# Includes a verification of the results returned.
+# Is this the way I should do ?
#
# Revision 1.9.2.17.4.1 2006/05/19 14:58:15 hdl
# Adding a new summary taht builds on the fly a summary with BT, NT and
related terms and Unused forms.