View | Details | Raw Unified | Return to bug 12022
Collapse All | Expand All

(-)a/C4/Review.pm (-7 / +29 lines)
Lines 21-26 use strict; Link Here
21
use warnings;
21
use warnings;
22
22
23
use C4::Context;
23
use C4::Context;
24
use C4::Branch;
24
25
25
use vars qw($VERSION @ISA @EXPORT);
26
use vars qw($VERSION @ISA @EXPORT);
26
27
Lines 123-136 sub getreviews { Link Here
123
}
124
}
124
125
125
sub getallreviews {
126
sub getallreviews {
126
    my ($status, $offset, $row_count) = @_;
127
    my ( $status, $offset, $row_count ) = @_;
127
    my @params = ($status,($offset ? $offset : 0),($row_count ? $row_count : 20));
128
    my @params;
128
    my $dbh      = C4::Context->dbh;
129
    my $dbh = C4::Context->dbh;
129
    my $query    =
130
130
      "SELECT * FROM reviews WHERE approved=? order by datereviewed desc LIMIT ?, ?";
131
    my $query = "
132
       SELECT reviews.*
133
       FROM reviews
134
       LEFT JOIN borrowers USING ( borrowernumber )
135
       WHERE approved = ?
136
    ";
137
    push( @params, $status );
138
139
    if ( C4::Context->preference("IndependentBranches") ) {
140
        unless ( C4::Context->IsSuperLibrarian() ) {
141
            my @branches = GetIndependentGroupModificationRights();
142
            $query .=
143
                " AND ( borrowers.branchcode IN ( "
144
              . join( ',', ('?') x @branches )
145
              . " ) OR borrowers.branchcode  = '')";
146
            push( @params, @branches );
147
        }
148
    }
149
150
    $query .= " ORDER BY datereviewed desc LIMIT ?, ?";
151
    push( @params, ( $offset ? $offset : 0 ),
152
        ( $row_count ? $row_count : 20 ) );
153
131
    my $sth = $dbh->prepare($query) || warn $dbh->err_str;
154
    my $sth = $dbh->prepare($query) || warn $dbh->err_str;
132
    $sth->execute(@params);
155
    $sth->execute(@params);
133
	return $sth->fetchall_arrayref({});
156
    return $sth->fetchall_arrayref( {} );
134
}
157
}
135
158
136
=head2 approvereview
159
=head2 approvereview
137
- 

Return to bug 12022