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

(-)a/svc/cataloguing/framework (-16 / +4 lines)
Lines 6-11 use CGI; Link Here
6
use C4::ClassSource;
6
use C4::ClassSource;
7
use C4::Context;
7
use C4::Context;
8
use C4::Biblio;
8
use C4::Biblio;
9
use C4::Koha;
9
use C4::Service;
10
use C4::Service;
10
use Koha::Database;
11
use Koha::Database;
11
use Koha::Libraries;
12
use Koha::Libraries;
Lines 51-71 foreach my $class_source (sort keys %$class_sources) { Link Here
51
    push @{ $authorised_values->{cn_source} }, { value => $class_source, lib => $class_sources->{$class_source}->{'description'} };
52
    push @{ $authorised_values->{cn_source} }, { value => $class_source, lib => $class_sources->{$class_source}->{'description'} };
52
}
53
}
53
54
54
my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
55
my $avs = C4::Koha::GetAuthorisedValues();
55
my $results;
56
for my $av ( @$avs ) {
56
if( $branch_limit ) {
57
    push @{ $authorised_values->{$av->{category}} }, { value => $av->{authorised_value}, lib => $av->{lib} };
57
    $results = $schema->resultset( "AuthorisedValue" )->search(
58
    { "authorised_values_branches.branchcode" => { "=", [ $branch_limit, undef ] } },
59
    { join => "authorised_values_branches", order_by => "lib" } );
60
} else {
61
    $results = $schema->resultset( "AuthorisedValue" )->search(
62
    undef,
63
    { order_by => "lib" } );
64
}
65
66
foreach my $result ( $results->all ) {
67
    $authorised_values->{$result->category} ||= [];
68
    push @{ $authorised_values->{$result->category} }, { value => $result->authorised_value, lib => $result->lib };
69
}
58
}
70
59
71
$response->param( framework => \@tags, authorised_values => $authorised_values );
60
$response->param( framework => \@tags, authorised_values => $authorised_values );
72
- 

Return to bug 20760