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

(-)a/Koha/AuthorisedValues.pm (-5 / +9 lines)
Lines 27-33 use Koha::AuthorisedValue; Link Here
27
use Koha::MarcSubfieldStructures;
27
use Koha::MarcSubfieldStructures;
28
use Koha::Cache::Memory::Lite;
28
use Koha::Cache::Memory::Lite;
29
29
30
use base qw(Koha::Objects);
30
use base qw(Koha::Objects Koha::Objects::Limit::Library);
31
31
32
=head1 NAME
32
=head1 NAME
33
33
Lines 62-68 sub search { Link Here
62
      : {};
62
      : {};
63
63
64
    my @join = $attributes->{join} || ();
64
    my @join = $attributes->{join} || ();
65
    push @join, 'authorised_values_branches';
65
    push @join, $branchcode ? 'authorised_values_branches' : ();
66
    my $join = { join => \@join };
66
    my $join = { join => \@join };
67
    $attributes //= {};
67
    $attributes //= {};
68
    $attributes = { %$attributes, %$join };
68
    $attributes = { %$attributes, %$join };
Lines 197-211 sub search_with_localization { Link Here
197
    $attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by};
197
    $attributes->{order_by} = 'translated_description' unless exists $attributes->{order_by};
198
    my @join = $attributes->{join} || ();
198
    my @join = $attributes->{join} || ();
199
    push @join, 'localization';
199
    push @join, 'localization';
200
    my $join = { join => \@join };
200
    $attributes->{join} = \@join;
201
    $attributes->{'+select'} = [
201
    $attributes->{'+select'} = [
202
        {
202
        {
203
            coalesce => [qw( localization.translation me.lib )],
203
            coalesce => [qw( localization.translation me.lib )],
204
            -as      => 'translated_description'
204
            -as      => 'translated_description'
205
        }
205
        }
206
    ];
206
    ];
207
    $attributes = { %$attributes, %$join };
207
    if(defined $params->{branchcode}) {
208
    $self->search( $params, $attributes );
208
        my $branchcode = delete $params->{branchcode};
209
        $self->search_with_library_limits( $params, $attributes, $branchcode );
210
    } else {
211
        $self->SUPER::search( $params, $attributes );
212
    }
209
}
213
}
210
214
211
215
(-)a/installer/data/mysql/atomicupdate/bug_20307.perl (-1 / +1 lines)
Lines 2-8 $DBversion = 'XXX'; # will be replaced by the RM Link Here
2
if ( CheckVersion($DBversion) ) {
2
if ( CheckVersion($DBversion) ) {
3
    if ( !column_exists( 'localization', 'interface' ) ) {
3
    if ( !column_exists( 'localization', 'interface' ) ) {
4
        $dbh->do("ALTER TABLE `localization` ADD COLUMN `interface` VARCHAR(30) DEFAULT NULL AFTER `entity`");
4
        $dbh->do("ALTER TABLE `localization` ADD COLUMN `interface` VARCHAR(30) DEFAULT NULL AFTER `entity`");
5
        $dbh->do("ALTER TABLE `localization` DROP FOREIGN KEY `entity_code_lang`");
5
        $dbh->do("ALTER TABLE `localization` DROP KEY `entity_code_lang`");
6
        $dbh->do("ALTER TABLE `localization` ADD UNIQUE KEY `entity_code_interface_lang` (entity, code, interface, lang)");
6
        $dbh->do("ALTER TABLE `localization` ADD UNIQUE KEY `entity_code_interface_lang` (entity, code, interface, lang)");
7
        $dbh->do("ALTER TABLE `localization` MODIFY entity VARCHAR(30) NOT NULL");
7
        $dbh->do("ALTER TABLE `localization` MODIFY entity VARCHAR(30) NOT NULL");
8
    }
8
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt (-5 / +4 lines)
Lines 255-261 Link Here
255
        <td>[% av.lib_opac | html %]</td>
255
        <td>[% av.lib_opac | html %]</td>
256
        <td>[% IF ( av.imageurl ) %]<img src="[% av.imageurl | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
256
        <td>[% IF ( av.imageurl ) %]<img src="[% av.imageurl | url %]" alt=""/>[% ELSE %]&nbsp;[% END %]</td>
257
        <td>
257
        <td>
258
            [% IF av.branch_limitations.size > 0 %]
258
            [% IF av.library_limits.count > 0 %]
259
                [% branches_str = "" %]
259
                [% branches_str = "" %]
260
                [% FOREACH library IN av.library_limits %]
260
                [% FOREACH library IN av.library_limits %]
261
                    [%- IF loop.first -%]
261
                    [%- IF loop.first -%]
Lines 265-274 Link Here
265
                    [% END %]
265
                    [% END %]
266
                [% END %]
266
                [% END %]
267
                <span class="library_limitation" title="[% branches_str | html %]">
267
                <span class="library_limitation" title="[% branches_str | html %]">
268
                    [% IF av.library_limits.size > 1 %]
268
                    [% IF av.library_limits.count > 1 %]
269
                        [% av.library_limits.size | html %] library limitations
269
                        [% av.library_limits.count | html %] library limitations
270
                    [% ELSE %]
270
                    [% ELSE %]
271
                        [% av.library_limits.size | html %] library limitation
271
                        [% av.library_limits.count | html %] library limitation
272
                    [% END %]
272
                    [% END %]
273
            [% ELSE %]
273
            [% ELSE %]
274
                No limitation
274
                No limitation
275
- 

Return to bug 20307