Bugzilla – Attachment 48173 Details for
Bug 15839
Move the reviews related code to Koha::Reviews
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15839: Koha::Reviews - Remove getnumberofreviews
Bug-15839-KohaReviews---Remove-getnumberofreviews.patch (text/plain), 4.53 KB, created by
Jonathan Druart
on 2016-02-17 13:45:43 UTC
(
hide
)
Description:
Bug 15839: Koha::Reviews - Remove getnumberofreviews
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-02-17 13:45:43 UTC
Size:
4.53 KB
patch
obsolete
>From 0c838fdd1ceaec1e2a5595d3e48d95730171635f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 Feb 2016 16:28:09 +0000 >Subject: [PATCH] Bug 15839: Koha::Reviews - Remove getnumberofreviews > >--- > C4/Review.pm | 22 +--------------------- > mainpage.pl | 4 ++-- > opac/opac-showreviews.pl | 2 +- > reviews/reviewswaiting.pl | 2 +- > tools/tools-home.pl | 7 +++---- > 5 files changed, 8 insertions(+), 29 deletions(-) > >diff --git a/C4/Review.pm b/C4/Review.pm >index 1ffff14..f5121f1 100644 >--- a/C4/Review.pm >+++ b/C4/Review.pm >@@ -29,7 +29,7 @@ BEGIN { > $VERSION = 3.07.00.049; > require Exporter; > @ISA = qw(Exporter); >- @EXPORT = qw(savereview updatereview numberofreviews numberofreviewsbybiblionumber); >+ @EXPORT = qw(savereview updatereview numberofreviewsbybiblionumber); > } > > =head1 NAME >@@ -42,7 +42,6 @@ C4::Review - Perl Module containing routines for dealing with reviews of items > > savereview($biblionumber,$borrowernumber,$review); > updatereview($biblionumber,$borrowernumber,$review); >- my $count=numberofreviews($status); > my $count=numberofreviewsbybiblionumber($biblionumber); > > =head1 DESCRIPTION >@@ -85,25 +84,6 @@ sub updatereview { > $sth->execute( $review, $borrowernumber, $biblionumber ); > } > >-=head2 numberofreviews >- >- my $count=numberofreviews( [$status] ); >- >-Return the number of reviews where in the 'reviews' database : 'approved' = $status >-(By default $status = 1) >- >-=cut >- >-sub numberofreviews { >- my ($param) = @_; >- my $status = ( defined($param) ? $param : 1 ); >- my $dbh = C4::Context->dbh; >- my $query = "SELECT count(*) FROM reviews WHERE approved=?"; >- my $sth = $dbh->prepare($query); >- $sth->execute($status); >- return $sth->fetchrow; >-} >- > =head2 numberofreviewsbybiblionumber > > my $count=numberofreviewsbybiblionumber($biblionumber); >diff --git a/mainpage.pl b/mainpage.pl >index e2651d8..f41eef6 100755 >--- a/mainpage.pl >+++ b/mainpage.pl >@@ -25,11 +25,11 @@ use C4::Output; > use C4::Auth; > use C4::Koha; > use C4::NewsChannels; # GetNewsToDisplay >-use C4::Review qw/numberofreviews/; > use C4::Suggestions qw/CountSuggestion/; > use C4::Tags qw/get_count_by_tag_status/; > use Koha::Borrower::Modifications; > use Koha::Borrower::Discharge; >+use Koha::Reviews; > > my $query = new CGI; > >@@ -62,7 +62,7 @@ my $branch = > ? C4::Context->userenv()->{'branch'} > : undef; > >-my $pendingcomments = numberofreviews(0); >+my $pendingcomments = Koha::Reviews->search({ approved => 0 })->count; > my $pendingtags = get_count_by_tag_status(0); > my $pendingsuggestions = CountSuggestion("ASKED"); > my $pending_borrower_modifications = >diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl >index 69c0869..a88a74e 100755 >--- a/opac/opac-showreviews.pl >+++ b/opac/opac-showreviews.pl >@@ -85,7 +85,7 @@ my $reviews = Koha::Reviews->search( > } > )->unblessed; > my $marcflavour = C4::Context->preference("marcflavour"); >-my $hits = numberofreviews(1); >+my $hits = Koha::Reviews->search({ approved => 1 })->count; > my $i = 0; > my $latest_comment_date; > for my $result (@$reviews){ >diff --git a/reviews/reviewswaiting.pl b/reviews/reviewswaiting.pl >index 74b92f5..017e162 100755 >--- a/reviews/reviewswaiting.pl >+++ b/reviews/reviewswaiting.pl >@@ -43,7 +43,7 @@ my $status = $query->param('status') || 0; > my $reviewid = $query->param('reviewid'); > my $page = $query->param('page') || 1; > my $count = C4::Context->preference('numSearchResults') || 20; >-my $total = numberofreviews($status); >+my $total = Koha::Reviews->search({ approved => $status })->count; > > if ( $op eq 'approve' ) { > my $review = Koha::Reviews->find( $reviewid ); >diff --git a/tools/tools-home.pl b/tools/tools-home.pl >index 1a1ce30..86cfb03 100755 >--- a/tools/tools-home.pl >+++ b/tools/tools-home.pl >@@ -15,14 +15,13 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Auth; > use C4::Output; >-use C4::Review qw/numberofreviews/; > use C4::Tags qw/get_count_by_tag_status/; >+use Koha::Reviews; > > my $query = new CGI; > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >@@ -36,7 +35,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > } > ); > >-my $pendingcomments = numberofreviews(0); >+my $pendingcomments = Koha::Reviews->search({ approved => 0 })->count; > my $pendingtags = get_count_by_tag_status(0); > > $template->param( >-- >2.7.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15839
:
48166
|
48167
|
48168
|
48169
|
48170
|
48171
|
48172
|
48173
|
48174
|
48175
|
48176
|
48280
|
48281
|
48282
|
48283
|
48284
|
48285
|
48286
|
48287
|
48288
|
48289
|
48290
|
51197
|
51198
|
51199
|
51200
|
51201
|
51202
|
51203
|
51204
|
51205
|
51206
|
51207
|
53794
|
53795
|
53796
|
53797
|
53798
|
53799
|
53800
|
53801
|
53802
|
53803
|
53804
|
53805
|
53806
|
53807