X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=authorities%2Fdetail.pl;h=66f931cca069ab0313a022c690e92285b3f4bd97;hb=bcde53b5ba071ed33caa0b5a3734a62a481da795;hp=4c3b2f542f25808c9fb68dcfb8808ccdb5297d94;hpb=34c8fd7a6afc61806fe6bdb7e58779eeb1839604;p=koha_fer diff --git a/authorities/detail.pl b/authorities/detail.pl index 4c3b2f542f..66f931cca0 100755 --- a/authorities/detail.pl +++ b/authorities/detail.pl @@ -39,7 +39,8 @@ parameters tables. use strict; -require Exporter; +use warnings; + use C4::AuthoritiesMarc; use C4::Auth; use C4::Context; @@ -51,41 +52,6 @@ use C4::Koha; # use C4::Catalogue; our ($tagslib); -=item find_value - - ($indicators, $value) = find_value($tag, $subfield, $record,$encoding); - -Find the given $subfield in the given $tag in the given -MARC::Record $record. If the subfield is found, returns -the (indicators, value) pair; otherwise, (undef, undef) is -returned. - -=cut - -sub find_value { - my ($tagfield,$insubfield,$record,$encoding) = @_; - my @result; - my $indicator; - if ($tagfield <10) { - if ($record->field($tagfield)) { - push @result, $record->field($tagfield)->data(); - } else { - push @result,""; - } - } else { - foreach my $field ($record->field($tagfield)) { - my @subfields = $field->subfields(); - foreach my $subfield (@subfields) { - if (@$subfield[0] eq $insubfield) { - push @result,@$subfield[1]; - $indicator = $field->indicator(1).$field->indicator(2); - } - } - } - } - return($indicator,@result); -} - =item build_authorized_values_list @@ -236,7 +202,7 @@ sub create_input { # opening plugin. Just check wether we are on a developper computer on a production one # (the cgidir differs) my $cgidir = C4::Context->intranetdir . "/cgi-bin/cataloguing/value_builder"; - unless ( opendir( DIR, "$cgidir" ) ) { + unless (-r $cgidir and -d $cgidir) { $cgidir = C4::Context->intranetdir . "/cataloguing/value_builder"; } my $plugin = $cgidir . "/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; @@ -359,18 +325,17 @@ sub build_tabs ($$$$$) { foreach my $tag (sort @tab_data) { $i++; next if ! $tag; - my $indicator; my $index_tag = CreateKey; # if MARC::Record is not empty =>use it as master loop, then add missing subfields that should be in the tab. # if MARC::Record is empty => use tab as master loop. - if ( $record ne -1 && ( $record->field($tag) || $tag eq '000' ) ) { + if ( $record != -1 && ( $record->field($tag) || $tag eq '000' ) ) { my @fields; if ( $tag ne '000' ) { @fields = $record->field($tag); } else { - push @fields, $record->leader(); # if tag == 000 + push @fields, MARC::Field->new('000', $record->leader()); # if tag == 000 } # loop through each field foreach my $field (@fields) { @@ -419,7 +384,10 @@ sub build_tabs ($$$$$) { } if ($#subfields_data>=0) { my %tag_data; - $tag_data{tag}=$field->tag().' - '. $tagslib->{$field->tag()}->{lib}; + $tag_data{tag}=$field->tag(). ' ' + . C4::Koha::display_marc_indicators($field) + . ' - ' + . $tagslib->{$field->tag()}->{lib}; $tag_data{subfield} = \@subfields_data; push (@loop_data, \%tag_data); } @@ -427,7 +395,6 @@ sub build_tabs ($$$$$) { } } if ( $#loop_data >= 0 ) { - warn "pushing : $tabloop = ".Data::Dumper::Dumper(@loop_data); push @BIG_LOOP, { number => $tabloop, innerloop => \@loop_data, @@ -472,7 +439,6 @@ if (C4::Context->preference("AuthDisplayHierarchy")){ my $cnt=0; my @loophierarchy; foreach my $element (@tree){ - my $cell; my $elementdata = GetAuthority($element); $record= $elementdata if ($authid==$element); push @loophierarchy, BuildUnimarcHierarchy($elementdata,"child".$cnt, $authid); @@ -509,10 +475,9 @@ my $tag; my $authtypes = getauthtypes; my @authtypesloop; -foreach my $thisauthtype (keys %$authtypes) { - my $selected = 1 if $thisauthtype eq $authtypecode; +foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) { my %row =(value => $thisauthtype, - selected => $selected, + selected => $thisauthtype eq $authtypecode, authtypetext => $authtypes->{$thisauthtype}{'authtypetext'}, ); push @authtypesloop, \%row; @@ -523,9 +488,6 @@ $template->param(authid => $authid, biblio_fields => $biblio_fields, authtypetext => $authtypes->{$authtypecode}{'authtypetext'}, authtypesloop => \@authtypesloop, - intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"), - intranetstylesheet => C4::Context->preference("intranetstylesheet"), - IntranetNav => C4::Context->preference("IntranetNav"), ); output_html_with_http_headers $query, $cookie, $template->output;