From 9bcc69167c1f4fdb43119569f81ca912ce788ec9 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 16 Sep 2015 13:56:23 +1200 Subject: [PATCH] Bug 15035: Anti-spam for opac-suggestions - FOLLOW-UP MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit to test this patch... 1/ enable 'suggestion' and 'AnonSuggestions' sysprefs 2/ edit the koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt file, to reveal the hidden 'negcap' field replace line 87 opac-suggestions.tt, from...
  • to ...
  • 3/ attempt to add another suggestion, and populate the 'negcap' field adding the suggestion is supposed to fail, but actually succeeds!? :/ 4/ apply patch 5/ repeat step 3, suggestion attempt should fail as expected modified: opac-suggestions.pl Signed-off-by: Bernardo Gonzalez Kriegel Confirmed insertion with negcap before patch. With negcap value suggestion fails silently Without negcap suggestion is inserted No errors Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 6b31947c3bb6517ecdc7d21440ba79895c270749) Signed-off-by: Frédéric Demians (cherry picked from commit 49d2b2c84dbd85da2a2495ac3b81e450f4e522b4) Signed-off-by: Liz Rea --- opac/opac-suggestions.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index cbdada24dd..0dd71a889c 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -34,7 +34,6 @@ use Koha::DateUtils qw( dt_from_string ); my $input = new CGI; my $op = $input->param('op'); my $suggestion = $input->Vars; -delete $suggestion->{negcap}; my $negcaptcha = $input->param('negcap'); my $suggested_by_anyone = $input->param('suggested_by_anyone') || 0; @@ -42,6 +41,10 @@ my $suggested_by_anyone = $input->param('suggested_by_anyone') || 0; if ($negcaptcha ) { print $input->redirect("/cgi-bin/koha/opac-suggestions.pl"); exit; +} else { + # don't pass 'negcap' column to DB, else DBI::Class will error + # DBIx::Class::Row::store_column(): No such column 'negcap' on Koha::Schema::Result::Suggestion at Koha/C4/Suggestions.pm + delete $suggestion->{negcap}; } #If suggestions are turned off we redirect to 404 error. This will also redirect guest suggestions -- 2.11.4.GIT