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

(-)a/C4/Context.pm (-10 / +17 lines)
Lines 540-546 my $use_syspref_cache = 1; Link Here
540
540
541
sub preference {
541
sub preference {
542
    my $self = shift;
542
    my $self = shift;
543
    my $var  = lc(shift);                          # The system preference to return
543
    my $var  = shift;    # The system preference to return
544
544
545
    if ($use_syspref_cache && exists $sysprefs{$var}) {
545
    if ($use_syspref_cache && exists $sysprefs{$var}) {
546
        return $sysprefs{$var};
546
        return $sysprefs{$var};
Lines 548-562 sub preference { Link Here
548
548
549
    my $dbh  = C4::Context->dbh or return 0;
549
    my $dbh  = C4::Context->dbh or return 0;
550
550
551
    # Look up systempreferences.variable==$var
551
    my $value;
552
    my $sql = <<'END_SQL';
552
    if ( defined $ENV{"OVERRIDE_SYSPREF_$var"} ) {
553
        SELECT    value
553
        $value = $ENV{"OVERRIDE_SYSPREF_$var"};
554
        FROM    systempreferences
554
    } else {
555
        WHERE    variable=?
555
        # Look up systempreferences.variable==$var
556
        LIMIT    1
556
        my $sql = q{
557
END_SQL
557
            SELECT  value
558
    $sysprefs{$var} = $dbh->selectrow_array( $sql, {}, $var );
558
            FROM    systempreferences
559
    return $sysprefs{$var};
559
            WHERE   variable = ?
560
            LIMIT   1
561
        };
562
        $value = $dbh->selectrow_array( $sql, {}, $var );
563
    }
564
565
    $sysprefs{$var} = $value;
566
    return $value;
560
}
567
}
561
568
562
sub boolean_preference {
569
sub boolean_preference {
(-)a/admin/preferences.pl (-1 / +4 lines)
Lines 33-38 use C4::Budgets qw(GetCurrency); Link Here
33
use File::Spec;
33
use File::Spec;
34
use IO::File;
34
use IO::File;
35
use YAML::Syck qw();
35
use YAML::Syck qw();
36
use List::MoreUtils qw(any);
36
$YAML::Syck::ImplicitTyping = 1;
37
$YAML::Syck::ImplicitTyping = 1;
37
our $lang;
38
our $lang;
38
39
Lines 120-125 sub TransformPrefsToHTML { Link Here
120
    my $tab = $data->{ $title };
121
    my $tab = $data->{ $title };
121
    $tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );
122
    $tab = { '' => $tab } if ( ref( $tab ) eq 'ARRAY' );
122
123
124
    my @override_syspref_names = split( /,/, $ENV{"OVERRIDE_SYSPREF_NAMES"} );
125
123
    foreach my $group ( sort keys %$tab ) {
126
    foreach my $group ( sort keys %$tab ) {
124
        if ( $group ) {
127
        if ( $group ) {
125
            push @lines, { is_group_title => 1, title => $group };
128
            push @lines, { is_group_title => 1, title => $group };
Lines 156-161 sub TransformPrefsToHTML { Link Here
156
                                $name_entry->{'highlighted'} = 1;
159
                                $name_entry->{'highlighted'} = 1;
157
                            }
160
                            }
158
                        }
161
                        }
162
                        $name_entry->{'overridden'} = 1 if ( any { $name eq $_ } @override_syspref_names );
159
                        push @names, $name_entry;
163
                        push @names, $name_entry;
160
                    } else {
164
                    } else {
161
                        push @chunks, $piece;
165
                        push @chunks, $piece;
Lines 164-170 sub TransformPrefsToHTML { Link Here
164
                    push @chunks, { type_text => 1, contents => $piece };
168
                    push @chunks, { type_text => 1, contents => $piece };
165
                }
169
                }
166
            }
170
            }
167
168
            push @lines, { CHUNKS => \@chunks, NAMES => \@names, is_group_title => 0 };
171
            push @lines, { CHUNKS => \@chunks, NAMES => \@names, is_group_title => 0 };
169
        }
172
        }
170
    }
173
    }
(-)a/etc/koha-httpd.conf (+12 lines)
Lines 20-25 Link Here
20
   SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
20
   SetEnv MEMCACHED_SERVERS "__MEMCACHED_SERVERS__"
21
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
21
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
22
22
23
  # This syntax allows you to override a system preference
24
  # for a given virtual host. Use with caution!
25
  # You should add all the system preferences you override
26
  # in one or more vhosts to the environment variable
27
  # OVERRIDE_SYSPREF_NAMES for your staff intranet vhost
28
# SevEnv OVERRIDE_SYSPREF_PrefName
29
23
   <Directory "__OPAC_WWW_DIR__">
30
   <Directory "__OPAC_WWW_DIR__">
24
      Options -Indexes
31
      Options -Indexes
25
   </Directory>
32
   </Directory>
Lines 126-131 Link Here
126
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
133
   SetEnv MEMCACHED_NAMESPACE "__MEMCACHED_NAMESPACE__"
127
   Options +FollowSymLinks
134
   Options +FollowSymLinks
128
135
136
   # If you are overriding any system preferences,
137
   # list them in this variable so the preference editor
138
   # knows that they have been overridden.
139
#  SevEnv OVERRIDE_SYSPREF_NAMES "Pref1,Pref2,Pref3"
140
129
   ErrorDocument 400 /cgi-bin/koha/errors/400.pl
141
   ErrorDocument 400 /cgi-bin/koha/errors/400.pl
130
   ErrorDocument 401 /cgi-bin/koha/errors/401.pl
142
   ErrorDocument 401 /cgi-bin/koha/errors/401.pl
131
   ErrorDocument 403 /cgi-bin/koha/errors/403.pl
143
   ErrorDocument 403 /cgi-bin/koha/errors/403.pl
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/preferences.css (-1 / +7 lines)
Lines 82-85 h3.collapsed { Link Here
82
    background: transparent url("../../img/spinner-small.gif") top left no-repeat;
82
    background: transparent url("../../img/spinner-small.gif") top left no-repeat;
83
    padding : 0 4px;
83
    padding : 0 4px;
84
    vertical-align: middle;
84
    vertical-align: middle;
85
}
85
}
86
87
span.overridden {
88
    font-style: italic;
89
    font-weight: bold;
90
    color: red;
91
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (-1 / +6 lines)
Lines 89-94 Link Here
89
							[% ELSE %]
89
							[% ELSE %]
90
							[% NAME.name %]
90
							[% NAME.name %]
91
							[% END %]
91
							[% END %]
92
93
                            [% IF NAME.overridden %]
94
                                <span class="overridden" title="The system preference [% NAME.name %] been overridden from this value by one or more virtual hosts.">
95
                                    [Overridden]
96
                                </span>
97
                            [% END %]
92
						</label>
98
						</label>
93
                        [% UNLESS ( loop.last ) %]<br />[% END %]
99
                        [% UNLESS ( loop.last ) %]<br />[% END %]
94
                        [% END %]
100
                        [% END %]
95
- 

Return to bug 10325