From f3b57dfb023f81c57719ed31f91ada40a40fb165 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 Note that a future enhancement should take into account the possible error returned by ->approve, ->unapprove and ->delete Signed-off-by: Marc Veron Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- 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 a5aa07da1f..f5b97e6c02 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -27,8 +27,7 @@ use vars qw(@ISA @EXPORT); BEGIN { require Exporter; @ISA = qw(Exporter); - @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber - deletereview); + @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber); } =head1 NAME @@ -138,23 +137,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 b1b8234fa7..74b92f5baa 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( -- 2.39.5