From f3e86507ffe3b6c48cdcbc378d79fc5b96764459 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 Feb 2016 16:06:46 +0000 Subject: [PATCH] Bug 15839: Koha::Reviews - Remove deletereview MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that a future enhancement should take into account the possible error returned by ->approve, ->unapprove and ->delete Signed-off-by: Marc VĂ©ron --- C4/Review.pm | 20 +------------------- reviews/reviewswaiting.pl | 3 ++- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/C4/Review.pm b/C4/Review.pm index 13a15c7..fc0b0b7 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -29,8 +29,7 @@ BEGIN { $VERSION = 3.07.00.049; require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber - deletereview); + @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber); } =head1 NAME @@ -140,23 +139,6 @@ sub numberofreviewsbybiblionumber { return $sth->fetchrow; } -=head2 deletereview - - deletereview($reviewid); - -Takes a reviewid and deletes it - -=cut - -sub deletereview { - my ($reviewid) = @_; - my $dbh = C4::Context->dbh(); - my $query = "DELETE FROM reviews - WHERE reviewid=?"; - my $sth = $dbh->prepare($query); - $sth->execute($reviewid); -} - 1; __END__ diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl index b1b8234..74b92f5 100755 --- a/reviews/reviewswaiting.pl +++ b/reviews/reviewswaiting.pl @@ -54,7 +54,8 @@ elsif ( $op eq 'unapprove' ) { $review->unapprove if $review; } elsif ( $op eq 'delete' ) { - deletereview($reviewid); + my $review = Koha::Reviews->find( $reviewid ); + $review->delete if $review; } my $reviews = Koha::Reviews->search( -- 1.7.10.4