View | Details | Raw Unified | Return to bug 7919
Collapse All | Expand All

(-)a/cataloguing/addbiblio.pl (-2 / +3 lines)
Lines 221-228 sub build_authorized_values_list { Link Here
221
    else {
221
    else {
222
        my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
222
        my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
223
        $authorised_values_sth->execute(
223
        $authorised_values_sth->execute(
224
            $tagslib->{$tag}->{$subfield}->{authorised_value},
224
            $branch_limit ? $branch_limit : (),
225
            $branch_limit ? $branch_limit : (),
225
            $tagslib->{$tag}->{$subfield}->{authorised_value}
226
        );
226
        );
227
227
228
        push @authorised_values, ""
228
        push @authorised_values, ""
Lines 528-535 sub build_tabs { Link Here
528
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
528
    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
529
    my $query = "SELECT authorised_value, lib
529
    my $query = "SELECT authorised_value, lib
530
                FROM authorised_values";
530
                FROM authorised_values";
531
    $query .= qq{ JOIN authorised_values_branches ON ( id = av_id AND ( branchcode = ? OR branchcode IS NULL ) )} if $branch_limit;
531
    $query .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id )} if $branch_limit;
532
    $query .= " WHERE category = ?";
532
    $query .= " WHERE category = ?";
533
    $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
533
    $query .= " GROUP BY lib ORDER BY lib, lib_opac";
534
    $query .= " GROUP BY lib ORDER BY lib, lib_opac";
534
    my $authorised_values_sth = $dbh->prepare( $query );
535
    my $authorised_values_sth = $dbh->prepare( $query );
535
536
(-)a/tools/batchMod.pl (-8 / +7 lines)
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
- 

Return to bug 7919