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

(-)a/C4/Koha.pm (-6 / +6 lines)
Lines 509-516 C<$opac> If set to a true value, displays OPAC descriptions rather than normal o Link Here
509
=cut
509
=cut
510
510
511
sub GetAuthorisedValues {
511
sub GetAuthorisedValues {
512
    my $category = shift // '';             # optional parameter
512
    my $category = shift // '';      # optional parameter
513
    my $opac     = shift ? 1 : 0;           # normalise to be safe
513
    my $opac     = shift ? 1 : 0;    # normalise to be safe
514
    my $options  = shift // '';
514
    my $options  = shift // '';
515
    my $no_limit;
515
    my $no_limit;
516
    if ($options) { $no_limit = $options->{'no_limit'}; }    #optional parameter to ignore library limitation
516
    if ($options) { $no_limit = $options->{'no_limit'}; }    #optional parameter to ignore library limitation
Lines 523-529 sub GetAuthorisedValues { Link Here
523
    return $result if $result;
523
    return $result if $result;
524
524
525
    my @results;
525
    my @results;
526
    my $dbh   = C4::Context->dbh;
526
    my $dbh = C4::Context->dbh;
527
527
528
    my $select_clause = 'SELECT av.*';
528
    my $select_clause = 'SELECT av.*';
529
    my @where_args;
529
    my @where_args;
Lines 540-546 sub GetAuthorisedValues { Link Here
540
          LEFT JOIN authorised_values_branches ON ( id = av_id )
540
          LEFT JOIN authorised_values_branches ON ( id = av_id )
541
    } if $branch_limit;
541
    } if $branch_limit;
542
    my @where_strings;
542
    my @where_strings;
543
    if($category) {
543
    if ($category) {
544
        push @where_strings, "category = ?";
544
        push @where_strings, "category = ?";
545
        push @where_args,    $category;
545
        push @where_args,    $category;
546
    }
546
    }
Lines 550-557 sub GetAuthorisedValues { Link Here
550
        push @where_args,    $branch_limit;
550
        push @where_args,    $branch_limit;
551
    }
551
    }
552
552
553
    if(@where_strings > 0) {
553
    if ( @where_strings > 0 ) {
554
        $query .= " WHERE " . join(" AND ", @where_strings);
554
        $query .= " WHERE " . join( " AND ", @where_strings );
555
    }
555
    }
556
    $query .= ' ORDER BY category, '
556
    $query .= ' ORDER BY category, '
557
        . (
557
        . (
(-)a/Koha/UI/Form/Builder/Item.pm (-4 / +4 lines)
Lines 210-221 sub generate_subfield_form { Link Here
210
            } else {
210
            } else {
211
                $filtered_itemtypes = $all_itemtypes;
211
                $filtered_itemtypes = $all_itemtypes;
212
            }
212
            }
213
            while (my $itemtype = $filtered_itemtypes->next) {
213
            while ( my $itemtype = $filtered_itemtypes->next ) {
214
                push @authorised_values, $itemtype->itemtype;
214
                push @authorised_values, $itemtype->itemtype;
215
                $authorised_lib{ $itemtype->itemtype } = $itemtype->translated_description;
215
                $authorised_lib{ $itemtype->itemtype } = $itemtype->translated_description;
216
            }
216
            }
217
            while (my $itemtype = $all_itemtypes->next) {
217
            while ( my $itemtype = $all_itemtypes->next ) {
218
                if (!grep { $_ eq $itemtype->itemtype } @authorised_values) {
218
                if ( !grep { $_ eq $itemtype->itemtype } @authorised_values ) {
219
                    $restricted_values{ $itemtype->itemtype } = $itemtype->translated_description;
219
                    $restricted_values{ $itemtype->itemtype } = $itemtype->translated_description;
220
                }
220
                }
221
            }
221
            }
Lines 255-261 sub generate_subfield_form { Link Here
255
            my $av = GetAuthorisedValues( $subfield->{authorised_value}, undef, { 'no_limit' => 1 } );
255
            my $av = GetAuthorisedValues( $subfield->{authorised_value}, undef, { 'no_limit' => 1 } );
256
            for my $r (@$av) {
256
            for my $r (@$av) {
257
                push @authorised_values, $r->{authorised_value};
257
                push @authorised_values, $r->{authorised_value};
258
                $authorised_lib{ $r->{authorised_value} } = $r->{lib};
258
                $authorised_lib{ $r->{authorised_value} }    = $r->{lib};
259
                $restricted_values{ $r->{authorised_value} } = $r->{restricted};
259
                $restricted_values{ $r->{authorised_value} } = $r->{restricted};
260
            }
260
            }
261
        }
261
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-3 / +6 lines)
Lines 136-142 Link Here
136
                                [% IF aval == mv.default %]
136
                                [% IF aval == mv.default %]
137
                                    [% SET matched = 1 %]
137
                                    [% SET matched = 1 %]
138
                                    [% IF mv.restricted.$aval %]
138
                                    [% IF mv.restricted.$aval %]
139
                                        <option value="[%- aval | html -%]" selected="selected" style="float:right" title="This value ([%- mv.labels.$aval | html -%]) is limited to other librairies">[%- mv.labels.$aval | html -%] &#9888;</option>
139
                                        <option value="[%- aval | html -%]" selected="selected" style="float:right" title="This value ([%- mv.labels.$aval | html -%]) is limited to other libraries"
140
                                            >[%- mv.labels.$aval | html -%] &#9888;</option
141
                                        >
140
                                    [% ELSE %]
142
                                    [% ELSE %]
141
                                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
143
                                        <option value="[%- aval | html -%]" selected="selected">[%- mv.labels.$aval | html -%]</option>
142
                                    [% END %]
144
                                    [% END %]
Lines 157-163 Link Here
157
                                [% IF mv.restricted %]
159
                                [% IF mv.restricted %]
158
                                    [% FOREACH code IN mv.restricted.keys %]
160
                                    [% FOREACH code IN mv.restricted.keys %]
159
                                        [% IF mv.default == code %]
161
                                        [% IF mv.default == code %]
160
                                            <option value="[%- code | html -%]" selected="selected" style="float:right" title="This value ([%- mv.restricted.$code | html -%]) is limited to other librairies">[%- mv.restricted.$code | html -%] &#9888;</option>
162
                                            <option value="[%- code | html -%]" selected="selected" style="float:right" title="This value ([%- mv.restricted.$code | html -%]) is limited to other libraries"
163
                                                >[%- mv.restricted.$code | html -%] &#9888;</option
164
                                            >
161
                                        [% END %]
165
                                        [% END %]
162
                                    [% END %]
166
                                    [% END %]
163
                                [% END %]
167
                                [% END %]
164
- 

Return to bug 32748