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

(-)a/C4/Utils/DataTables/ColumnsSettings.pm (-12 / +1 lines)
Lines 2-7 package C4::Utils::DataTables::ColumnsSettings; Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
use List::Util qw( first );
4
use List::Util qw( first );
5
use YAML;
5
use C4::Context;
6
use C4::Context;
6
7
7
sub get_yaml {
8
sub get_yaml {
Lines 10-27 sub get_yaml { Link Here
10
    warn "ERROR: the yaml file for DT::ColumnsSettings is not correctly formated: $@" if $@;
11
    warn "ERROR: the yaml file for DT::ColumnsSettings is not correctly formated: $@" if $@;
11
    return $yaml;
12
    return $yaml;
12
}
13
}
13
sub get_tables {
14
    my ( $module, $page ) = @_;
15
    my $list = get_yaml;
16
    return $list->{modules}{$module}{$page};
17
}
18
19
sub get_excluded {
20
    my ( $module, $page, $table ) = @_;
21
22
    my $list = get_yaml;
23
    return $list->{modules}{$module}{$page}{$table}{cannot_be_toggled};
24
}
25
14
26
sub get_columns {
15
sub get_columns {
27
    my ( $module, $page, $tablename ) = @_;
16
    my ( $module, $page, $tablename ) = @_;
(-)a/Koha/Template/Plugin/ColumnsSettings.pm (-14 / +2 lines)
Lines 35-57 This plugin allows to get the column configuration for a table. Link Here
35
First, include the line '[% USE Tables %]' at the top
35
First, include the line '[% USE Tables %]' at the top
36
of the template to enable the plugin.
36
of the template to enable the plugin.
37
37
38
To use, call ColumnsSettings.GetTables with the module and the page where the template is called.
38
To use, call ColumnsSettings.GetColumns with the module, the page and the table where the template is called.
39
39
40
For example: [% ColumnsSettings.GetTables( 'circ', 'circulation' ) %]
40
For example: [% ColumnsSettings.GetColumns( 'circ', 'circulation', 'holdst' ) %]
41
41
42
=cut
42
=cut
43
43
44
sub GetTables {
45
    my ( $self, $module, $page, $format ) = @_;
46
    $format //= q{};
47
48
    my $columns = C4::Utils::DataTables::ColumnsSettings::get_tables( $module, $page );
49
50
    return $format eq 'json'
51
        ? to_json( $columns )
52
        : $columns
53
}
54
55
sub GetColumns {
44
sub GetColumns {
56
    my ( $self, $module, $page, $table, $format ) = @_;
45
    my ( $self, $module, $page, $table, $format ) = @_;
57
    $format //= q{};
46
    $format //= q{};
58
- 

Return to bug 10212