5 use C4::Auth qw( get_template_and_user );
7 use C4::Output qw( output_html_with_http_headers );
8 use C4::Utils::DataTables::TablesSettings qw( get_modules );
11 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
13 template_name => "admin/columns_settings.tt",
16 flagsrequired => { parameters => 'manage_column_config' },
20 my $op = $input->param('op') // 'list';
22 if ( $op eq 'cud-save' ) {
23 my $module = $input->param('module');
24 my @columnids = $input->multi_param("columnid");
26 for my $columnid (@columnids) {
27 next unless $columnid =~ m|^([^#]*)#([^#]*)#(.*)$|;
28 my $is_hidden = $input->param( $columnid . '_hidden' ) // 0;
29 my $cannot_be_toggled =
30 $input->param( $columnid . '_cannot_be_toggled' ) // 0;
37 is_hidden => $is_hidden,
38 cannot_be_toggled => $cannot_be_toggled,
42 C4::Utils::DataTables::TablesSettings::update_columns(
48 my @table_ids = $input->multi_param('table_id');
49 for my $table_id (@table_ids) {
50 next unless $table_id =~ m|^([^#]*)#(.*)$|;
51 my $default_display_length = $input->param( $table_id . '_default_display_length' );
52 my $default_sort_order = $input->param( $table_id . '_default_sort_order' );
54 undef $default_display_length if defined $default_display_length && $default_display_length eq "";
55 undef $default_sort_order if defined $default_sort_order && $default_sort_order eq "";
57 if ( defined $default_display_length || defined $default_sort_order )
59 C4::Utils::DataTables::TablesSettings::update_table_settings(
64 default_display_length => $default_display_length,
65 default_sort_order => $default_sort_order,
74 if ( $op eq 'list' ) {
75 my $modules = C4::Utils::DataTables::TablesSettings::get_modules;
77 panel => scalar $input->param('module'),
78 page => scalar $input->param('page'),
79 table => scalar $input->param('table'),
84 output_html_with_http_headers $input, $cookie, $template->output;