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

(-)a/misc/admin/koha-preferences (-8 / +14 lines)
Lines 60-66 sub _set_preference { Link Here
60
60
61
    _debug( "Setting $preference to $value" );
61
    _debug( "Setting $preference to $value" );
62
62
63
    C4::Context->set_preference( $preference, $value );
63
    if (   $preference->{type} eq 'YesNo'
64
        && $value ne '0'
65
        && $value ne '1' )
66
    {
67
        print STDERR sprintf "System preference %s is YesNo and expects 1 or 0. '%s' was given, using '0'\n",
68
          $preference->{variable}, $value;
69
    }
70
71
    C4::Context->set_preference( $preference->{variable}, $value );
64
}
72
}
65
73
66
sub GetPreferences {
74
sub GetPreferences {
Lines 91-102 sub SetPreferences { Link Here
91
99
92
    exit 2 if ( scalar( @$current_state ) != scalar( keys %preferences ) );
100
    exit 2 if ( scalar( @$current_state ) != scalar( keys %preferences ) );
93
101
94
    # Iterate through again, now that we've checked all of the YesNo sysprefs
95
96
    foreach my $row ( @$current_state ) {
102
    foreach my $row ( @$current_state ) {
97
        next if ( $preferences{$row->{'variable'}} eq $row->{'value'} );
103
        my $new_value = $preferences{ $row->{variable} }->{value};
104
        next if $new_value && $row->{value} && $new_value eq $row->{value};
98
105
99
        _set_preference( $row->{'variable'}, $preferences{$row->{'variable'}} );
106
        _set_preference( $row, $new_value );
100
    }
107
    }
101
108
102
    # FIXME This may be not needed
109
    # FIXME This may be not needed
Lines 134-140 sub SetPreference { Link Here
134
141
135
    exit 3 if ( $value eq $row->{'value'} ); #FIXME exit??
142
    exit 3 if ( $value eq $row->{'value'} ); #FIXME exit??
136
143
137
    _set_preference( $preference, $value );
144
    _set_preference( $row, $value );
138
}
145
}
139
146
140
sub ClearPreference {
147
sub ClearPreference {
Lines 148-154 sub ClearPreference { Link Here
148
155
149
    exit 3 if ( $value eq $row->{'value'} );
156
    exit 3 if ( $value eq $row->{'value'} );
150
157
151
    _set_preference( $preference, $value );
158
    _set_preference( $row, $value );
152
}
159
}
153
160
154
=head1 OPTIONS
161
=head1 OPTIONS
155
- 

Return to bug 22824