Lines 30-36
BEGIN {
Link Here
|
30 |
require Exporter; |
30 |
require Exporter; |
31 |
@ISA = qw(Exporter); |
31 |
@ISA = qw(Exporter); |
32 |
@EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber |
32 |
@EXPORT = qw(getreview savereview updatereview numberofreviews numberofreviewsbybiblionumber |
33 |
getallreviews approvereview unapprovereview deletereview); |
33 |
approvereview unapprovereview deletereview); |
34 |
} |
34 |
} |
35 |
|
35 |
|
36 |
=head1 NAME |
36 |
=head1 NAME |
Lines 46-52
C4::Review - Perl Module containing routines for dealing with reviews of items
Link Here
|
46 |
updatereview($biblionumber,$borrowernumber,$review); |
46 |
updatereview($biblionumber,$borrowernumber,$review); |
47 |
my $count=numberofreviews($status); |
47 |
my $count=numberofreviews($status); |
48 |
my $count=numberofreviewsbybiblionumber($biblionumber); |
48 |
my $count=numberofreviewsbybiblionumber($biblionumber); |
49 |
my $reviews=getallreviews($status, [$offset], [$row_count]); |
|
|
50 |
|
49 |
|
51 |
=head1 DESCRIPTION |
50 |
=head1 DESCRIPTION |
52 |
|
51 |
|
Lines 141-168
sub numberofreviewsbybiblionumber {
Link Here
|
141 |
return $sth->fetchrow; |
140 |
return $sth->fetchrow; |
142 |
} |
141 |
} |
143 |
|
142 |
|
144 |
=head2 getallreviews |
|
|
145 |
|
146 |
my $reviews=getallreviews($status, [$offset], [$row_count]); |
147 |
|
148 |
Return all reviews where in the 'reviews' database : 'approved' = $status |
149 |
|
150 |
If offset and row_count are fiven, it's return all reviews between the |
151 |
$offset position and the ($offset + $row_count) position. |
152 |
(By default : $offset = 0 and $row_count = 20) |
153 |
|
154 |
=cut |
155 |
|
156 |
sub getallreviews { |
157 |
my ( $status, $offset, $row_count ) = @_; |
158 |
my @params = ( $status, ( $offset ? $offset : 0 ), ( $row_count ? $row_count : 20 ) ); |
159 |
my $dbh = C4::Context->dbh; |
160 |
my $query = "SELECT * FROM reviews WHERE approved=? order by datereviewed desc LIMIT ?, ?"; |
161 |
my $sth = $dbh->prepare($query); |
162 |
$sth->execute(@params); |
163 |
return $sth->fetchall_arrayref( {} ); |
164 |
} |
165 |
|
166 |
=head2 approvereview |
143 |
=head2 approvereview |
167 |
|
144 |
|
168 |
approvereview($reviewid); |
145 |
approvereview($reviewid); |