-
diff --git a/reports/dictionary.pl b/reports/dictionary.pl
index 123dab5340..c187282088 100755
--- a/reports/dictionary.pl
+++ b/reports/dictionary.pl
@@ -67,11 +67,10 @@ elsif ( $op eq 'cud-add_form_2' ) {
elsif ( $op eq 'cud-add_form_3' ) {
# Choosing the columns
- my $columns = get_columns( $area, $input );
$template->param(
'step_3' => 1,
'area' => $area,
- 'columns' => $columns,
+ 'columns' => get_columns($area),
'definition_name' => $definition_name,
'definition_description' => $definition_description,
);
diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl
index 27f82e9b7a..2c9c176c65 100755
--- a/reports/guided_reports.pl
+++ b/reports/guided_reports.pl
@@ -313,7 +313,7 @@ elsif ( $op eq 'cud-choose_type' ) {
'build3' => 1,
'area' => $area,
'type' => $type,
- columns => get_columns($area,$input),
+ columns => get_columns($area),
'cache_expiry' => scalar $input->param('cache_expiry'),
'public' => scalar $input->param('public'),
);
diff --git a/t/db_dependent/Reports/Guided.t b/t/db_dependent/Reports/Guided.t
index e84ccc2e00..d139940588 100755
--- a/t/db_dependent/Reports/Guided.t
+++ b/t/db_dependent/Reports/Guided.t
@@ -20,7 +20,7 @@
use Modern::Perl;
-use Test::More tests => 12;
+use Test::More tests => 13;
use Test::Warn;
use t::lib::TestBuilder;
@@ -535,6 +535,24 @@ subtest 'Returning passwords tests' => sub {
$schema->storage->txn_rollback;
};
+subtest 'get_columns' => sub {
+ plan tests => 7;
+ $schema->storage->txn_begin;
+ my $area = 'foo';
+ my $success = eval { C4::Reports::Guided::get_columns($area) };
+ ok !$success && $@ =~ m{^Unsupported report area "$area"}, 'Call with wrong report area explodes';
+
+ my $columns = C4::Reports::Guided::get_columns('CAT');
+ ok exists $columns->{biblio};
+ ok exists $columns->{biblioitems};
+ ok exists $columns->{items};
+ ok scalar grep { $_->{name} eq 'biblio.biblionumber' } @{ $columns->{biblio} };
+ ok scalar grep { $_->{description} =~ m{Biblio number} } @{ $columns->{biblio} };
+ ok !scalar grep { $_->{name} eq 'not_a_column' } @{ $columns->{biblio} };
+
+ $schema->storage->txn_rollback;
+};
+
sub trim {
my ($s) = @_;
$s =~ s/^\s*(.*?)\s*$/$1/s;