From 95e476ecb6b8a5f029631193b40d39f79a5d5ee5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 14 Dec 2021 15:35:25 +0100 Subject: [PATCH] Bug 29695: Remove GetColumnDefs C4::Templates::GetColumnDefs can easily be replaced using the new Koha::Database::Columns module. Test plan: Go to the import patron tool and confirm that you see the same list of patron's attribute on the import patron form. Signed-off-by: Owen Leonard --- C4/Templates.pm | 47 ------------------- .../prog/en/modules/tools/import_borrowers.tt | 29 ++++++------ .../prog/js/pages/preferences.js | 2 +- t/db_dependent/Templates.t | 35 ++++++-------- tools/import_borrowers.pl | 6 +-- 5 files changed, 31 insertions(+), 88 deletions(-) diff --git a/C4/Templates.pm b/C4/Templates.pm index d41c9b534e..9658c51117 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -348,51 +348,4 @@ sub getlanguagecookie { return $cookie; } -=head2 GetColumnDefs - - my $columns = GetColumnDefs( $cgi ) - -It is passed a CGI object and returns a hash of hashes containing -the column names and descriptions for each table defined in the -columns.def file corresponding to the CGI object. - -=cut - -sub GetColumnDefs { - - my $query = shift; - - my $columns = {}; - - my $htdocs = C4::Context->config('intrahtdocs'); - my $columns_file = 'columns.def'; - - # Get theme and language to build the path to columns.def - my ($theme, $lang, $availablethemes) = - themelanguage($htdocs, 'about.tt', 'intranet', $query); - # Build columns.def path - my $path = "$htdocs/$theme/$lang/$columns_file"; - my $fh; - if ( ! open ( $fh, q{<:encoding(utf-8)}, $path ) ) { - carp "Error opening $path. Check your templates."; - return; - } - # Loop through the columns.def file - while ( my $input = <$fh> ){ - chomp $input; - if ( $input =~ m|(.*)| ) { - my ( $table, $column ) = split( '\.', $1); - my $description = $2; - # Initialize the table array if needed. - @{$columns->{ $table }} = () if ! defined $columns->{ $table }; - # Push field and description - push @{$columns->{ $table }}, - { field => $column, description => $description }; - } - } - close $fh; - - return $columns; -} - 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt index a0bb8409b7..b11e4617df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt @@ -246,36 +246,35 @@