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

(-)a/tools/batchMod.pl (-12 / +6 lines)
Lines 34-39 use C4::Members; Link Here
34
use MARC::File::XML;
34
use MARC::File::XML;
35
use List::MoreUtils qw/uniq/;
35
use List::MoreUtils qw/uniq/;
36
36
37
use Koha::AuthorisedValues;
37
use Koha::Biblios;
38
use Koha::Biblios;
38
use Koha::DateUtils;
39
use Koha::DateUtils;
39
use Koha::Items;
40
use Koha::Items;
Lines 290-301 if ($op eq "show"){ Link Here
290
my @loop_data =();
291
my @loop_data =();
291
my $i=0;
292
my $i=0;
292
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
293
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
293
my $query = qq{SELECT authorised_value, lib FROM authorised_values};
294
$query  .= qq{ LEFT JOIN authorised_values_branches ON ( id = av_id ) } if $branch_limit;
295
$query  .= qq{ WHERE category = ?};
296
$query  .= qq{ AND ( branchcode = ? OR branchcode IS NULL ) } if $branch_limit;
297
$query  .= qq{ GROUP BY lib ORDER BY lib, lib_opac};
298
my $authorised_values_sth = $dbh->prepare( $query );
299
294
300
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
295
my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;# build once ahead of time, instead of multiple times later.
301
296
Lines 393-402 foreach my $tag (sort keys %{$tagslib}) { Link Here
393
      }
388
      }
394
      else {
389
      else {
395
          push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
390
          push @authorised_values, ""; # unless ( $tagslib->{$tag}->{$subfield}->{mandatory} );
396
          $authorised_values_sth->execute( $tagslib->{$tag}->{$subfield}->{authorised_value}, $branch_limit ? $branch_limit : () );
391
397
          while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
392
          my @avs = Koha::AuthorisedValues->search({ category => $tagslib->{$tag}->{$subfield}->{authorised_value}, branchcode => $branch_limit });
398
              push @authorised_values, $value;
393
          for my $av ( @avs ) {
399
              $authorised_lib{$value} = $lib;
394
              push @authorised_values, $av->authorised_value;
395
              $authorised_lib{$av->authorised_value} = $av->lib;
400
          }
396
          }
401
          $value="";
397
          $value="";
402
      }
398
      }
Lines 484-490 foreach my $tag (sort keys %{$tagslib}) { Link Here
484
    $i++
480
    $i++
485
  }
481
  }
486
} # -- End foreach tag
482
} # -- End foreach tag
487
$authorised_values_sth->finish;
488
483
489
484
490
485
491
- 

Return to bug 21635