Lines 265-276
if ($op eq "show"){
Link Here
|
265 |
# now, build the item form for entering a new item |
265 |
# now, build the item form for entering a new item |
266 |
my @loop_data =(); |
266 |
my @loop_data =(); |
267 |
my $i=0; |
267 |
my $i=0; |
268 |
my $query = qq{ |
268 |
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : ""; |
269 |
SELECT authorised_value, lib FROM authorised_values |
269 |
my $query = qq{SELECT authorised_value, lib FROM authorised_values}; |
270 |
JOIN authorised_values_branches ON ( id = av_id AND ( branchcode = ? OR branchcode IS NULL ) ) |
270 |
$query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id ) } if $branch_limit; |
271 |
WHERE category = ? |
271 |
$query .= qq{ WHERE category = ?}; |
272 |
GROUP BY lib ORDER BY lib, lib_opac |
272 |
$query .= qq{ AND ( branchcode = ? OR branchcode IS NULL ) } if $branch_limit; |
273 |
}; |
273 |
$query .= qq{ GROUP BY lib ORDER BY lib, lib_opac}; |
274 |
my $authorised_values_sth = $dbh->prepare( $query ); |
274 |
my $authorised_values_sth = $dbh->prepare( $query ); |
275 |
|
275 |
|
276 |
my $branches = GetBranchesLoop(); # build once ahead of time, instead of multiple times later. |
276 |
my $branches = GetBranchesLoop(); # build once ahead of time, instead of multiple times later. |
Lines 364-370
foreach my $tag (sort keys %{$tagslib}) {
Link Here
|
364 |
} |
364 |
} |
365 |
else { |
365 |
else { |
366 |
push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
366 |
push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} ); |
367 |
$authorised_values_sth->execute( C4::Context->userenv ? C4::Context->userenv->{"branch"} : "", $tagslib->{$tag}->{$subfield}->{authorised_value} ); |
367 |
$authorised_values_sth->execute( $tagslib->{$tag}->{$subfield}->{authorised_value}, $branch_limit ? $branch_limit : () ); |
368 |
while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { |
368 |
while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) { |
369 |
push @authorised_values, $value; |
369 |
push @authorised_values, $value; |
370 |
$authorised_lib{$value} = $lib; |
370 |
$authorised_lib{$value} = $lib; |
371 |
- |
|
|