Merge remote branch 'kc/new/bug_5563' into kcmaster
[koha.git] / reviews / reviewswaiting.pl
blob4d28a9671ab80e48796a2661833b434b23bc87d4
1 #!/usr/bin/perl
3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA 02111-1307 USA
18 use strict;
19 use warnings;
21 use CGI;
22 use C4::Auth;
23 use C4::Output;
24 use C4::Context;
25 use C4::Review;
26 use C4::Members;
27 use C4::Biblio;
29 my $query = new CGI;
30 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32 template_name => "reviews/reviewswaiting.tmpl",
33 query => $query,
34 type => "intranet",
35 authnotrequired => 0,
36 flagsrequired => { tools => 'moderate_comments' },
37 debug => 1,
41 my $op = $query->param('op') || '';
42 my $reviewid = $query->param('reviewid');
44 if ( $op eq 'approve' ) {
45 approvereview($reviewid);
47 elsif ( $op eq 'delete' ) {
48 deletereview($reviewid);
51 my $reviews = getallreviews(0);
53 foreach ( @$reviews ) {
54 my $borrowernumber = $_->{borrowernumber};
55 my $borrowerData = GetMember('borrowernumber' => $borrowernumber);
56 my $biblioData = GetBiblioData($_->{biblionumber});
57 # setting some borrower info into this hash
58 $_->{bibliotitle} = $biblioData->{'title'};
59 $_->{surname} = $borrowerData->{'surname'};
60 $_->{firstname} = $borrowerData->{'firstname'};
63 $template->param( reviews => $reviews );
65 output_html_with_http_headers $query, $cookie, $template->output;