Lines 27-33
use vars qw(@ISA @EXPORT);
Link Here
|
27 |
BEGIN { |
27 |
BEGIN { |
28 |
require Exporter; |
28 |
require Exporter; |
29 |
@ISA = qw(Exporter); |
29 |
@ISA = qw(Exporter); |
30 |
@EXPORT = qw(savereview updatereview numberofreviews numberofreviewsbybiblionumber); |
30 |
@EXPORT = qw(savereview updatereview numberofreviewsbybiblionumber); |
31 |
} |
31 |
} |
32 |
|
32 |
|
33 |
=head1 NAME |
33 |
=head1 NAME |
Lines 40-46
C4::Review - Perl Module containing routines for dealing with reviews of items
Link Here
|
40 |
|
40 |
|
41 |
savereview($biblionumber,$borrowernumber,$review); |
41 |
savereview($biblionumber,$borrowernumber,$review); |
42 |
updatereview($biblionumber,$borrowernumber,$review); |
42 |
updatereview($biblionumber,$borrowernumber,$review); |
43 |
my $count=numberofreviews($status); |
|
|
44 |
my $count=numberofreviewsbybiblionumber($biblionumber); |
43 |
my $count=numberofreviewsbybiblionumber($biblionumber); |
45 |
|
44 |
|
46 |
=head1 DESCRIPTION |
45 |
=head1 DESCRIPTION |
Lines 83-107
sub updatereview {
Link Here
|
83 |
$sth->execute( $review, $borrowernumber, $biblionumber ); |
82 |
$sth->execute( $review, $borrowernumber, $biblionumber ); |
84 |
} |
83 |
} |
85 |
|
84 |
|
86 |
=head2 numberofreviews |
|
|
87 |
|
88 |
my $count=numberofreviews( [$status] ); |
89 |
|
90 |
Return the number of reviews where in the 'reviews' database : 'approved' = $status |
91 |
(By default $status = 1) |
92 |
|
93 |
=cut |
94 |
|
95 |
sub numberofreviews { |
96 |
my ($param) = @_; |
97 |
my $status = ( defined($param) ? $param : 1 ); |
98 |
my $dbh = C4::Context->dbh; |
99 |
my $query = "SELECT count(*) FROM reviews WHERE approved=?"; |
100 |
my $sth = $dbh->prepare($query); |
101 |
$sth->execute($status); |
102 |
return $sth->fetchrow; |
103 |
} |
104 |
|
105 |
=head2 numberofreviewsbybiblionumber |
85 |
=head2 numberofreviewsbybiblionumber |
106 |
|
86 |
|
107 |
my $count=numberofreviewsbybiblionumber($biblionumber); |
87 |
my $count=numberofreviewsbybiblionumber($biblionumber); |