Can now approve or delete reviews
[wip/koha-chris_n.git] / reviews / reviewswaiting.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5 use C4::Auth;
6 use C4::Output;
7 use C4::Interface::CGI::Output;
8 use C4::Context;
9 use HTML::Template;
10 use C4::Review;
11
12 my $query = new CGI;
13 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
14     {
15         template_name   => "reviews/reviewswaiting.tmpl",
16         query           => $query,
17         type            => "intranet",
18         authnotrequired => 0,
19         flagsrequired   => { catalogue => 1 },
20         debug           => 1,
21     }
22 );
23
24 my $op       = $query->param('op');
25 my $reviewid = $query->param('reviewid');
26
27 if ( $op eq 'approve' ) {
28     approvereview($reviewid);
29 }
30 elsif ( $op eq 'delete' ) {
31     deletereview($reviewid);
32 }
33
34 my $reviews = getallreviews(0);
35 $template->param( reviews => $reviews );
36
37 output_html_with_http_headers $query, $cookie, $template->output;