From 092ae340cef375cc66c8511fd34c1a4eec9c7ba6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 Feb 2016 16:30:07 +0000 Subject: [PATCH] Bug 15839: Koha::Reviews - Remove savereview Signed-off-by: Marc Veron Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- C4/Review.pm | 18 ------------------ opac/opac-review.pl | 13 +++++++++---- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/C4/Review.pm b/C4/Review.pm index 90bdfeb3f6..dd5fdaa0be 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -47,24 +47,6 @@ Review.pm provides many routines for manipulating reviews. =head1 FUNCTIONS -=head2 savereview - - savereview($biblionumber,$borrowernumber, $review); - -Save a review in the 'reviews' database - -=cut - -sub savereview { - my ( $biblionumber, $borrowernumber, $review ) = @_; - my $dbh = C4::Context->dbh; - my $query = "INSERT INTO reviews (borrowernumber,biblionumber, - review,approved,datereviewed) VALUES - (?,?,?,0,now())"; - my $sth = $dbh->prepare($query); - $sth->execute( $borrowernumber, $biblionumber, $review ); -} - =head2 numberofreviewsbybiblionumber my $count=numberofreviewsbybiblionumber($biblionumber); diff --git a/opac/opac-review.pl b/opac/opac-review.pl index a9658963cd..917036b7cc 100755 --- a/opac/opac-review.pl +++ b/opac/opac-review.pl @@ -22,11 +22,11 @@ use CGI qw ( -utf8 ); use C4::Auth; use C4::Koha; use C4::Output; -use C4::Review; use C4::Biblio; use C4::Scrubber; use C4::Debug; use Koha::DateUtils; +use Koha::Review; use Koha::Reviews; my $query = new CGI; @@ -69,9 +69,14 @@ if (defined $review) { datereviewed => dt_from_string } )->store; - } else { - savereview($biblionumber, $borrowernumber, $clean); - } + } else { + Koha::Review->new( + { biblionumber => $biblionumber, + borrowernumber => $borrowernumber, + review => $clean, + } + )->store; + } unless (@errors){ $template->param(WINDOW_CLOSE=>1); } } } -- 2.39.5