From c095003b865a9405014d8567bdccfaf7048fd929 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 7 Apr 2014 18:10:38 +0000 Subject: [PATCH] Bug 7567: (follow-up) construct values clause in SQL statement more idiomatically To test: [1] Verify that prove -v t/db_dependent/NewsChannels.t passes Signed-off-by: Galen Charlton --- C4/NewsChannels.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/NewsChannels.pm b/C4/NewsChannels.pm index acefb70e67..47772efc89 100644 --- a/C4/NewsChannels.pm +++ b/C4/NewsChannels.pm @@ -61,9 +61,9 @@ sub add_opac_new { if ($href_entry) { my @fields = keys %{$href_entry}; my @values = values %{$href_entry}; - my $field_string = join ',',@fields; + my $field_string = join ',', @fields; $field_string = $field_string // q{}; - my $values_string = '?,' x ($#fields) . '?'; + my $values_string = join(',', map { '?' } @fields); my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("INSERT INTO opac_news ( $field_string ) VALUES ( $values_string )"); $sth->execute(@values); -- 2.39.5