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

(-)a/C4/Koha.pm (-3 / +6 lines)
Lines 503-512 sub GetAuthorisedValues { Link Here
503
    my $dbh      = C4::Context->dbh;
503
    my $dbh      = C4::Context->dbh;
504
    my $select_clause = 'SELECT av.*';
504
    my $select_clause = 'SELECT av.*';
505
    my @where_args;
505
    my @where_args;
506
    if ($branch_limit && $no_limit) {
506
    if ( $branch_limit && $no_limit ) {
507
        $select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted';
507
        $select_clause .= ', IF (branchcode = ? OR branchcode IS NULL, 0, 1) as restricted';
508
        push @where_args, $branch_limit;
508
        push @where_args, $branch_limit;
509
    }
509
    }
510
510
    my $query = qq{
511
    my $query = qq{
511
        $select_clause
512
        $select_clause
512
        FROM authorised_values av
513
        FROM authorised_values av
Lines 519-528 sub GetAuthorisedValues { Link Here
519
        push @where_strings, "category = ?";
520
        push @where_strings, "category = ?";
520
        push @where_args, $category;
521
        push @where_args, $category;
521
    }
522
    }
522
    if($branch_limit && !defined $no_limit) {
523
524
    if ( $branch_limit && !defined $no_limit ) {
523
        push @where_strings, "( branchcode = ? OR branchcode IS NULL )";
525
        push @where_strings, "( branchcode = ? OR branchcode IS NULL )";
524
        push @where_args, $branch_limit;
526
        push @where_args,    $branch_limit;
525
    }
527
    }
528
526
    if(@where_strings > 0) {
529
    if(@where_strings > 0) {
527
        $query .= " WHERE " . join(" AND ", @where_strings);
530
        $query .= " WHERE " . join(" AND ", @where_strings);
528
    }
531
    }
(-)a/Koha/UI/Form/Builder/Item.pm (-14 / +9 lines)
Lines 277-300 sub generate_subfield_form { Link Here
277
        }
277
        }
278
        else {
278
        else {
279
            $subfield_data{marc_value} = {
279
            $subfield_data{marc_value} = {
280
                type => 'select',
280
                type       => 'select',
281
                id   => "tag_"
281
                id         => "tag_" . $tag . "_subfield_" . $subfieldtag . "_" . $index_subfield,
282
                  . $tag
282
                values     => \@authorised_values,
283
                  . "_subfield_"
283
                labels     => \%authorised_lib,
284
                  . $subfieldtag . "_"
285
                  . $index_subfield,
286
                values  => \@authorised_values,
287
                labels  => \%authorised_lib,
288
                restricted => \%authorised_restricted,
284
                restricted => \%authorised_restricted,
289
                default => $value,
285
                default    => $value,
290
                (
286
                (
291
                    (
287
                      ( grep { $_ eq $subfield->{authorised_value} } (qw(branches itemtypes cn_source)) )
292
                        grep { $_ eq $subfield->{authorised_value} }
288
                    ? ()
293
                          (qw(branches itemtypes cn_source))
289
                    : ( category => $subfield->{authorised_value} )
294
                    ) ? () : ( category => $subfield->{authorised_value} )
295
                ),
290
                ),
296
            };
291
            };
297
        }
292
        }
293
298
    }
294
    }
299
295
300
    # it's a thesaurus / authority field
296
    # it's a thesaurus / authority field
301
- 

Return to bug 32748