Bugzilla – Attachment 51203 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 getreview
Bug-15839-KohaReviews---Remove-getreview.patch (text/plain), 3.59 KB, created by
Jonathan Druart
on 2016-05-04 16:19:53 UTC
(
hide
)
Description:
Bug 15839: Koha::Reviews - Remove getreview
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-05-04 16:19:53 UTC
Size:
3.59 KB
patch
obsolete
>From 1d5bdbd44fddd4c667afd8b25bf4e4b9c5e0c0a1 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 Feb 2016 16:15:55 +0000 >Subject: [PATCH] Bug 15839: Koha::Reviews - Remove getreview >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Note that this (biblionumber, borrowernumber) pair should be defined as >a unique key at the DB level (FIXME added) > >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Review.pm | 20 +------------------- > opac/opac-review.pl | 11 +++++++---- > 2 files changed, 8 insertions(+), 23 deletions(-) > >diff --git a/C4/Review.pm b/C4/Review.pm >index f5b97e6..0c27833 100644 >--- a/C4/Review.pm >+++ b/C4/Review.pm >@@ -27,7 +27,7 @@ use vars qw(@ISA @EXPORT); > BEGIN { > require Exporter; > @ISA = qw(Exporter); >- @EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber); >+ @EXPORT = qw(savereview updatereview numberofreviews numberofreviewsbybiblionumber); > } > > =head1 NAME >@@ -38,7 +38,6 @@ C4::Review - Perl Module containing routines for dealing with reviews of items > > use C4::Review; > >- my $review=getreview($biblionumber,$borrowernumber); > savereview($biblionumber,$borrowernumber,$review); > updatereview($biblionumber,$borrowernumber,$review); > my $count=numberofreviews($status); >@@ -50,23 +49,6 @@ Review.pm provides many routines for manipulating reviews. > > =head1 FUNCTIONS > >-=head2 getreview >- >- $review = getreview($biblionumber,$borrowernumber); >- >-Takes a borrowernumber and a biblionumber and returns the review of that biblio >- >-=cut >- >-sub getreview { >- my ( $biblionumber, $borrowernumber ) = @_; >- my $dbh = C4::Context->dbh; >- my $query = "SELECT * FROM reviews WHERE biblionumber=? and borrowernumber=?"; >- my $sth = $dbh->prepare($query); >- $sth->execute( $biblionumber, $borrowernumber ); >- return $sth->fetchrow_hashref(); >-} >- > =head2 savereview > > savereview($biblionumber,$borrowernumber, $review); >diff --git a/opac/opac-review.pl b/opac/opac-review.pl >index 43705e3..fd3491a 100755 >--- a/opac/opac-review.pl >+++ b/opac/opac-review.pl >@@ -17,8 +17,7 @@ > # 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::Koha; >@@ -27,6 +26,7 @@ use C4::Review; > use C4::Biblio; > use C4::Scrubber; > use C4::Debug; >+use Koha::Reviews; > > my $query = new CGI; > my $biblionumber = $query->param('biblionumber'); >@@ -43,7 +43,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > # FIXME: need to allow user to delete their own comment(s) > > my $biblio = GetBiblioData($biblionumber); >-my $savedreview = getreview($biblionumber,$borrowernumber); >+# FIXME biblionumber, borrowernumber should be a unique key of reviews >+my $savedreview = Koha::Reviews->search({ biblionumber => $biblionumber, borrowernumber => $borrowernumber })->next; > my ($clean, @errors); > if (defined $review) { > if ($review !~ /\S/) { >@@ -70,10 +71,12 @@ if (defined $review) { > } > (@errors ) and $template->param( ERRORS=>\@errors); > ($cgi_debug) and $template->param(cgi_debug=>1 ); >+$review = $clean; >+$review ||= $savedreview->review if $savedreview; > $template->param( > 'biblionumber' => $biblionumber, > 'borrowernumber' => $borrowernumber, >- 'review' => $clean || $savedreview->{'review'}, >+ 'review' => $review, > 'reviewid' => scalar $query->param('reviewid') || 0, > 'title' => $biblio->{'title'}, > ); >-- >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