corrected init script name for apache2
[koha.git] / opac / opac-suggestions.pl
bloba8b8a6b8f41d5e532fed09a4a86f74f1034e135b
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 require Exporter;
20 use CGI;
21 use C4::Auth; # get_template_and_user
22 use C4::Output;
23 use C4::Suggestions;
25 my $input = new CGI;
26 my $title = $input->param('title');
27 my $author = $input->param('author');
28 my $note = $input->param('note');
29 my $copyrightdate = $input->param('copyrightdate');
30 my $publishercode = $input->param('publishercode');
31 my $volumedesc = $input->param('volumedesc');
32 my $publicationyear = $input->param('publicationyear');
33 my $place = $input->param('place');
34 my $isbn = $input->param('isbn');
35 my $status = $input->param('status');
36 my $suggestedbyme = $input->param('suggestedbyme');
37 my $op = $input->param('op');
38 $op = 'else' unless $op;
40 my ( $template, $borrowernumber, $cookie );
42 my $dbh = C4::Context->dbh;
44 if ( C4::Context->preference("AnonSuggestions") ) {
45 ( $template, $borrowernumber, $cookie ) = get_template_and_user(
47 template_name => "opac-suggestions.tmpl",
48 query => $input,
49 type => "opac",
50 authnotrequired => 1,
53 if ( !$borrowernumber ) {
54 $borrowernumber = C4::Context->preference("AnonSuggestions");
57 else {
58 ( $template, $borrowernumber, $cookie ) = get_template_and_user(
60 template_name => "opac-suggestions.tmpl",
61 query => $input,
62 type => "opac",
63 authnotrequired => 1,
68 if ( $op eq "add_confirm" ) {
69 &NewSuggestion(
70 $borrowernumber, $title, $author, $publishercode,
71 $note, $copyrightdate, $volumedesc, $publicationyear,
72 $place, $isbn, ''
75 # empty fields, to avoid filter in "SearchSuggestion"
76 $title = '';
77 $author = '';
78 $publishercode = '';
79 $copyrightdate = '';
80 $volumedesc = '';
81 $publicationyear = '';
82 $place = '';
83 $isbn = '';
84 $op = 'else';
87 if ( $op eq "delete_confirm" ) {
88 my @delete_field = $input->param("delete_field");
89 foreach my $delete_field (@delete_field) {
90 &DelSuggestion( $borrowernumber, $delete_field );
92 $op = 'else';
95 my $suggestions_loop =
96 &SearchSuggestion( $borrowernumber, $author, $title, $publishercode, $status,
97 $suggestedbyme );
98 $template->param(
99 suggestions_loop => $suggestions_loop,
100 title => $title,
101 author => $author,
102 publishercode => $publishercode,
103 status => $status,
104 suggestedbyme => $suggestedbyme,
105 "op_$op" => 1,
108 output_html_with_http_headers $input, $cookie, $template->output;