Bug 15839: Koha::Reviews - Remove updatereview

Signed-off-by: Marc Veron <veron@veron.ch>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2016-02-16 16:28:33 +00:00 committed by Kyle M Hall
parent 3cf4d92a5f
commit 41fa333ec9
2 changed files with 10 additions and 20 deletions

View file

@ -27,7 +27,7 @@ use vars qw(@ISA @EXPORT);
BEGIN { BEGIN {
require Exporter; require Exporter;
@ISA = qw(Exporter); @ISA = qw(Exporter);
@EXPORT = qw(savereview updatereview numberofreviewsbybiblionumber); @EXPORT = qw(savereview numberofreviewsbybiblionumber);
} }
=head1 NAME =head1 NAME
@ -39,7 +39,6 @@ C4::Review - Perl Module containing routines for dealing with reviews of items
use C4::Review; use C4::Review;
savereview($biblionumber,$borrowernumber,$review); savereview($biblionumber,$borrowernumber,$review);
updatereview($biblionumber,$borrowernumber,$review);
my $count=numberofreviewsbybiblionumber($biblionumber); my $count=numberofreviewsbybiblionumber($biblionumber);
=head1 DESCRIPTION =head1 DESCRIPTION
@ -66,22 +65,6 @@ sub savereview {
$sth->execute( $borrowernumber, $biblionumber, $review ); $sth->execute( $borrowernumber, $biblionumber, $review );
} }
=head2 updatereview
updateview($biblionumber,$borrowernumber, $review);
Update the review description in the 'reviews' database
=cut
sub updatereview {
my ( $biblionumber, $borrowernumber, $review ) = @_;
my $dbh = C4::Context->dbh;
my $query = "UPDATE reviews SET review=?,datereviewed=now(),approved=0 WHERE borrowernumber=? and biblionumber=?";
my $sth = $dbh->prepare($query);
$sth->execute( $review, $borrowernumber, $biblionumber );
}
=head2 numberofreviewsbybiblionumber =head2 numberofreviewsbybiblionumber
my $count=numberofreviewsbybiblionumber($biblionumber); my $count=numberofreviewsbybiblionumber($biblionumber);

View file

@ -26,6 +26,7 @@ use C4::Review;
use C4::Biblio; use C4::Biblio;
use C4::Scrubber; use C4::Scrubber;
use C4::Debug; use C4::Debug;
use Koha::DateUtils;
use Koha::Reviews; use Koha::Reviews;
my $query = new CGI; my $query = new CGI;
@ -61,7 +62,13 @@ if (defined $review) {
$js_ok_review =~ s/"/&quot;/g; # probably redundant w/ TMPL ESCAPE=JS $js_ok_review =~ s/"/&quot;/g; # probably redundant w/ TMPL ESCAPE=JS
$template->param(clean_review=>$js_ok_review); $template->param(clean_review=>$js_ok_review);
if ($savedreview) { if ($savedreview) {
updatereview($biblionumber, $borrowernumber, $clean); $savedreview->set(
{
review => $clean,
approved => 0,
datereviewed => dt_from_string
}
)->store;
} else { } else {
savereview($biblionumber, $borrowernumber, $clean); savereview($biblionumber, $borrowernumber, $clean);
} }