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

(-)a/admin/preferences.pl (-1 / +5 lines)
Lines 28-33 use C4::ClassSource qw( GetClassSources GetClassSource ); Link Here
28
use C4::Output qw( output_html_with_http_headers );
28
use C4::Output qw( output_html_with_http_headers );
29
use C4::Templates;
29
use C4::Templates;
30
use Koha::Acquisition::Currencies;
30
use Koha::Acquisition::Currencies;
31
use Koha::Database::Columns;
31
use IO::File;
32
use IO::File;
32
use YAML::XS;
33
use YAML::XS;
33
use Encode;
34
use Encode;
Lines 401-406 if ( $tab ) { Link Here
401
    );
402
    );
402
}
403
}
403
404
404
$template->param( TABS => \@TABS );
405
$template->param(
406
    TABS => \@TABS,
407
    db_columns => Koha::Database::Columns->columns,
408
);
405
409
406
output_html_with_http_headers $input, $cookie, $template->output;
410
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt (+1 lines)
Lines 282-287 Link Here
282
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
282
        // This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
283
        var to_highlight = "[% To.json( searchfield ) | $raw %]";
283
        var to_highlight = "[% To.json( searchfield ) | $raw %]";
284
        var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
284
        var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
285
        var db_columns = [% To.json( db_columns ) | $raw %];
285
    </script>
286
    </script>
286
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
287
    [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
287
    [% Asset.js("js/ajax.js") | $raw %]
288
    [% Asset.js("js/ajax.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/preferences.js (-32 / +29 lines)
Lines 231-268 $( document ).ready( function () { Link Here
231
        var pref_value = this.value;
231
        var pref_value = this.value;
232
        var prefs = pref_value.split("|");
232
        var prefs = pref_value.split("|");
233
233
234
234
        let data = db_columns[datasource];
235
235
        var items = [];
236
        $.getJSON( themelang + "/modules/admin/preferences/" + datasource + ".json", function( data ){
236
        var checked = "";
237
            var items = [];
237
        var readonly = "";
238
            var checked = "";
238
        var disabled = "";
239
            var readonly = "";
239
        var style = "";
240
            var disabled = "";
240
        $.each( Object.keys(data).sort(), function( i, key ){
241
            var style = "";
241
            if( prefs.indexOf( key ) >= 0 ){
242
            $.each( data, function( key, val ){
242
                checked = ' checked="checked" ';
243
                if( prefs.indexOf( val ) >= 0 ){
243
            } else {
244
                    checked = ' checked="checked" ';
244
                checked = "";
245
                } else {
245
            }
246
                    checked = "";
246
            if( required.indexOf( key ) >= 0 ){
247
                }
247
                style = "required";
248
                if( required.indexOf( val ) >= 0 ){
248
                checked  = ' checked="checked" ';
249
                    style = "required";
249
            } else if( exclusions.indexOf( key ) >= 0 ){
250
                    checked  = ' checked="checked" ';
250
                style = "disabled";
251
                } else if( exclusions.indexOf( val ) >= 0 ){
251
                disabled = ' disabled="disabled" ';
252
                    style = "disabled";
252
                checked  = "";
253
                    disabled = ' disabled="disabled" ';
253
            } else {
254
                    checked  = "";
254
                style = "";
255
                } else {
255
                disabled = "";
256
                    style = "";
256
            }
257
                    disabled = "";
257
            items.push('<label class="' + style +'"><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + disabled + ' name="pref" value="' + key + '" /> ' + data[key]+ ' (' + key + ')</label>');
258
                }
259
                items.push('<label class="' + style +'"><input class="dbcolumn_selection" type="checkbox" id="' + key + '"' + checked + disabled + ' name="pref" value="' + key + '" /> ' + val + ' (' + key + ')</label>');
260
            });
261
            $("<div/>", {
262
                "class": "columns-2",
263
                html: items.join("")
264
            }).appendTo("#prefModalForm");
265
        });
258
        });
259
        $("<div/>", {
260
            "class": "columns-2",
261
            html: items.join("")
262
        }).appendTo("#prefModalForm");
263
266
        $("#saveModalPrefs").data("target", this.id );
264
        $("#saveModalPrefs").data("target", this.id );
267
        $("#prefModalLabel").text( pref_name );
265
        $("#prefModalLabel").text( pref_name );
268
        $("#prefModal").modal("show");
266
        $("#prefModal").modal("show");
269
- 

Return to bug 29695