marc_lib => $tagslib->{$tag}->{$subfield}->{lib},
tag_mandatory => $tagslib->{$tag}->{mandatory},
mandatory => $tagslib->{$tag}->{$subfield}->{mandatory},
+ important => $tagslib->{$tag}->{$subfield}->{important},
repeatable => $tagslib->{$tag}->{$subfield}->{repeatable},
kohafield => $tagslib->{$tag}->{$subfield}->{kohafield},
index => $index_tag,
$subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
}
# Subfield is hidden depending of hidden and mandatory flag, and is always
- # shown if it contains anything or if its field is mandatory.
+ # shown if it contains anything or if its field is mandatory or important.
my $tdef = $tagslib->{$tag};
$subfield_data{visibility} = "display:none;"
if $tdef->{$subfield}->{hidden} % 2 == 1 &&
$value eq '' &&
!$tdef->{$subfield}->{mandatory} &&
- !$tdef->{mandatory};
+ !$tdef->{mandatory} &&
+ !$tdef->{$subfield}->{important} &&
+ !$tdef->{important};
# expand all subfields of 773 if there is a host item provided in the input
$subfield_data{visibility} ="" if ($tag eq 773 and $cgi->param('hostitemnumber'));
$query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id )} if $branch_limit;
$query .= " WHERE category = ?";
$query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
- $query .= " GROUP BY lib ORDER BY lib, lib_opac";
+ $query .= " GROUP BY authorised_value,lib ORDER BY lib, lib_opac";
my $authorised_values_sth = $dbh->prepare( $query );
# in this array, we will push all the 10 tabs
for ( my $tabloop = 0 ; $tabloop <= $max_num_tab ; $tabloop++ ) {
my @loop_data = (); #innerloop in the template.
my $i = 0;
- foreach my $tag (@tab_data) {
+ foreach my $tag (sort @tab_data) {
$i++;
next if ! $tag;
my ($indicator1, $indicator2);
my $subfield = $subfields[$subfieldcount][0];
my $value = $subfields[$subfieldcount][1];
next if ( length $subfield != 1 );
- next if ( $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
+ next if ( !defined $tagslib->{$tag}->{$subfield} || $tagslib->{$tag}->{$subfield}->{tab} ne $tabloop );
push(
@subfields_data,
&create_input(
tag_lib => $tagslib->{$tag}->{lib},
repeatable => $tagslib->{$tag}->{repeatable},
mandatory => $tagslib->{$tag}->{mandatory},
+ important => $tagslib->{$tag}->{important},
subfield_loop => \@subfields_data,
fixedfield => $tag < 10?1:0,
random => CreateKey,
tag_lib => $tagslib->{$tag}->{lib},
repeatable => $tagslib->{$tag}->{repeatable},
mandatory => $tagslib->{$tag}->{mandatory},
+ important => $tagslib->{$tag}->{important},
indicator1 => ( $indicator1 || $tagslib->{$tag}->{ind1_defaultvalue} ), #if not set, try to load the default value
indicator2 => ( $indicator2 || $tagslib->{$tag}->{ind2_defaultvalue} ), #use short-circuit operator for efficiency
subfield_loop => \@subfields_data,