From 5a68c161941f335ef7b256e9d932ccfae4dfcc01 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 21 Apr 2008 16:22:44 -0500 Subject: [PATCH] Bugfix #1624 - remove problem w/ EXPR in template, minor cleanup of module. Signed-off-by: Joshua Ferraro --- C4/Review.pm | 19 ++-------- .../prog/en/modules/opac-detail.tmpl | 35 ++++++++----------- opac/opac-detail.pl | 12 ++++--- 3 files changed, 25 insertions(+), 41 deletions(-) diff --git a/C4/Review.pm b/C4/Review.pm index 3d0da03e57..163efc621d 100644 --- a/C4/Review.pm +++ b/C4/Review.pm @@ -99,10 +99,7 @@ sub numberofreviews { "SELECT count(*) FROM reviews WHERE biblionumber=? and approved=?"; my $sth = $dbh->prepare($query); $sth->execute( $biblionumber, 1 ); - my $count = $sth->fetchrow_hashref; - - $sth->finish(); - return ( $count->{'count(*)'} ); + return $sth->fetchrow; } sub getreviews { @@ -112,12 +109,7 @@ sub getreviews { "SELECT * FROM reviews WHERE biblionumber=? and approved=? order by datereviewed desc"; my $sth = $dbh->prepare($query) || warn $dbh->err_str; $sth->execute( $biblionumber, $approved ); - my @results; - while ( my $data = $sth->fetchrow_hashref() ) { - push @results, $data; - } - $sth->finish(); - return ( \@results ); + return $sth->fetchall_arrayref({}); } sub getallreviews { @@ -127,12 +119,7 @@ sub getallreviews { "SELECT * FROM reviews WHERE approved=? order by datereviewed desc"; my $sth = $dbh->prepare($query); $sth->execute($status); - my @results; - while ( my $data = $sth->fetchrow_hashref() ) { - push @results, $data; - } - $sth->finish(); - return ( \@results ); + return $sth->fetchall_arrayref({}); } =head2 approvereview diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index e1ea077025..e76f905100 100755 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -334,41 +334,36 @@
-
- - - - +
+ + +
">
Your Comment
- - - +

- &reviewid=');">Edit + + &reviewid=');">Edit

Comment by - - - + + +
- - - +

- +

- - +

There are no comments for this item.

- + +
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 91aa87d9d8..792d204dfe 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -181,15 +181,17 @@ $template->param( my $reviews = getreviews( $biblionumber, 1 ); my $loggedincommenter; foreach ( @$reviews ) { - my $borrower_number_review = $_->{borrowernumber}; - my $borrowerData = GetMember($borrower_number_review,'borrowernumber'); + my $borrowerData = GetMember($_->{borrowernumber},'borrowernumber'); # setting some borrower info into this hash $_->{title} = $borrowerData->{'title'}; $_->{surname} = $borrowerData->{'surname'}; $_->{firstname} = $borrowerData->{'firstname'}; - $_->{userid} = $borrowerData->{'userid'}; + $_->{userid} = $borrowerData->{'userid'}; $_->{datereviewed} = format_date($_->{datereviewed}); - if($borrowerData->{'borrowernumber'} eq $borrowernumber){ $loggedincommenter = 1; } + if ($borrowerData->{'borrowernumber'} eq $borrowernumber) { + $_->{your_comment} = 1; + $loggedincommenter = 1; + } } @@ -204,7 +206,7 @@ $template->param( subscriptions => \@subs, subscriptionsnumber => $subscriptionsnumber, reviews => $reviews, - loggedincommenter => $loggedincommenter + loggedincommenter => $loggedincommenter ); # XISBN Stuff -- 2.39.5