Bug 11322: rscrub bad data before storing suggestions in the DB

1/ In the public interface, add a suggestion containing html
2/ Save, notice the html is rendered (or if you have the other patches
is displayed)
3/ Apply this paget
4/ Add another suggestion
5/ Notice the html is stripped

Signed-off-by: David Cook <dcook@prosentient.com.au>

Works as described.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit 48b339980e)
Signed-off-by: Fridolin SOMERS <fridolin.somers@biblibre.com>
(cherry picked from commit a907c28a1e)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Chris Cormack 2013-12-03 12:01:23 +13:00 committed by Tomas Cohen Arazi
parent 57757250d6
commit c1f8e2757d
1 changed files with 6 additions and 0 deletions

View File

@ -27,6 +27,7 @@ use C4::Output;
use C4::Suggestions;
use C4::Koha;
use C4::Dates;
use C4::Scrubber;
my $input = new CGI;
my $allsuggestions = $input->param('showall');
@ -77,8 +78,13 @@ if ( $op eq "add_confirm" ) {
#some suggestion are answering the request Donot Add
}
else {
my $scrubber = C4::Scrubber->new();
foreach my $suggest (keys %$suggestion){
$suggestion->{$suggest} = $scrubber->scrub($suggestion->{$suggest});
}
$$suggestion{'suggesteddate'}=C4::Dates->today;
$$suggestion{'branchcode'}= $input->param('branch') || C4::Context->userenv->{"branch"};
&NewSuggestion($suggestion);
# empty fields, to avoid filter in "SearchSuggestion"
$$suggestion{$_}='' foreach qw<title author publishercode copyrightdate place collectiontitle isbn STATUS>;