use strict;
-require Exporter;
+
use C4::AuthoritiesMarc;
use C4::Auth;
use C4::Context;
# 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
# 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'};
@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) {
}
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);
}
my $authtypes = getauthtypes;
my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
+foreach my $thisauthtype (sort { $authtypes->{$b} cmp $authtypes->{$a} } keys %$authtypes) {
my $selected = 1 if $thisauthtype eq $authtypecode;
my %row =(value => $thisauthtype,
selected => $selected,