From a712d1cc30520cfaf7dbdbade65050dcc1ab13a6 Mon Sep 17 00:00:00 2001 From: tipaul Date: Mon, 13 Sep 2004 15:21:00 +0000 Subject: [PATCH] fixes for authorities --- authorities/authorities.pl | 3 +- authorities/blinddetail-biblio-search.pl | 48 ++++++++++++++++-------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/authorities/authorities.pl b/authorities/authorities.pl index ad73cad811..84dd055ac3 100755 --- a/authorities/authorities.pl +++ b/authorities/authorities.pl @@ -160,7 +160,7 @@ sub create_input () { sub build_tabs ($$$$) { my($template, $record, $dbh,$encoding) = @_; -warn "=>".$record->as_formatted; +# warn "=>".$record->as_formatted; # fill arrays my @loop_data =(); my $tag; @@ -334,7 +334,6 @@ if ($op eq "add") { } my $record = AUTHhtml2marc($dbh,\@tags,\@subfields,\@values,%indicators); # MARC::Record built => now, record in DB - warn "IN ADD : ".$record->as_formatted(); if ($is_a_modif) { AUTHmodauthority($dbh,$authid,$record,$authtypecode); } else { diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl index 7c352341d9..1a4c56be77 100755 --- a/authorities/blinddetail-biblio-search.pl +++ b/authorities/blinddetail-biblio-search.pl @@ -61,7 +61,7 @@ my $authtypecode = &AUTHfind_authtypecode($dbh,$authid); my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode); my $auth_type = AUTHgetauth_type($authtypecode); -warn "XX = ".$auth_type->{auth_tag_to_report}; +# warn "XX = ".$auth_type->{auth_tag_to_report}; my $record =AUTHgetauthority($dbh,$authid); # open template @@ -78,25 +78,43 @@ my ($template, $loggedinuser, $cookie) my @loop_data =(); my $tag; my @loop_data =(); -foreach my $field ($record->fields($auth_type->{auth_tag_to_report})) { - my @subfields_data; - my @subf=$field->subfields; - # loop through each subfield - for my $i (0..$#subf) { - $subf[$i][0] = "@" unless $subf[$i][0]; - my %subfield_data; +if ($authid) { + foreach my $field ($record->fields($auth_type->{auth_tag_to_report})) { + my @subfields_data; + my @subf=$field->subfields; + # loop through each subfield + for my $i (0..$#subf) { + $subf[$i][0] = "@" unless $subf[$i][0]; + my %subfield_data; $subfield_data{marc_value}=$subf[$i][1]; - $subfield_data{marc_subfield}=$subf[$i][0]; - $subfield_data{marc_tag}=$field->tag(); - push(@subfields_data, \%subfield_data); + $subfield_data{marc_subfield}=$subf[$i][0]; + $subfield_data{marc_tag}=$field->tag(); + push(@subfields_data, \%subfield_data); + } + if ($#subfields_data>=0) { + my %tag_data; + $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib}; + $tag_data{subfield} = \@subfields_data; + push (@loop_data, \%tag_data); + } } - if ($#subfields_data>=0) { +} else { +# authid is empty => the user want to empty the entry. + my @subfields_data; + foreach my $subfield ('a'..'z') { + my %subfield_data; + $subfield_data{marc_value}=''; + $subfield_data{marc_subfield}=$subfield; + push(@subfields_data, \%subfield_data); + } +# if ($#subfields_data>=0) { my %tag_data; - $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib}; +# $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib}; $tag_data{subfield} = \@subfields_data; push (@loop_data, \%tag_data); - } +# } } + $template->param("0XX" =>\@loop_data); # my $authtypes = getauthtypes; @@ -110,7 +128,7 @@ $template->param("0XX" =>\@loop_data); # push @authtypesloop, \%row; # } -$template->param(authid => $authid, +$template->param(authid => $authid?$authid:"", # authtypesloop => \@authtypesloop, index => $index); output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5