7 use C4::Auth; # get_template_and_user
8 use C4::Interface::CGI::Output;
12 my $title = $input->param('title');
13 my $author = $input->param('author');
14 my $note = $input->param('note');
15 my $copyrightdate =$input->param('copyrightdate');
16 my $publishercode = $input->param('publishercode');
17 my $volumedesc = $input->param('volumedesc');
18 my $publicationyear = $input->param('publicationyear');
19 my $place = $input->param('place');
20 my $isbn = $input->param('isbn');
21 my $status = $input->param('status');
22 my $suggestedbyme = $input->param('suggestedbyme');
23 my $op = $input->param('op');
24 $op = 'else' unless $op;
26 my ($template, $borrowernumber, $cookie);
28 my $dbh = C4::Context->dbh;
30 if (C4::Context->preference("AnonSuggestions")) {
31 ($template, $borrowernumber, $cookie)
32 = get_template_and_user({template_name => "opac-suggestions.tmpl",
37 if (!$borrowernumber) {
38 $borrowernumber = C4::Context->preference("AnonSuggestions");
41 ($template, $borrowernumber, $cookie)
42 = get_template_and_user({template_name => "opac-suggestions.tmpl",
49 if ($op eq "add_confirm") {
50 &NewSuggestion($borrowernumber,$title,$author,$publishercode,$note,$copyrightdate,$volumedesc,$publicationyear,$place,$isbn,'');
51 # empty fields, to avoid filter in "SearchSuggestion"
57 $publicationyear = '';
63 if ($op eq "delete_confirm") {
64 my @delete_field = $input->param("delete_field");
65 foreach my $delete_field (@delete_field) {
66 &DelSuggestion($borrowernumber,$delete_field);
71 my $suggestions_loop= &SearchSuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
72 $template->param(suggestions_loop => $suggestions_loop,
75 publishercode => $publishercode,
77 suggestedbyme => $suggestedbyme,
80 output_html_with_http_headers $input, $cookie, $template->output;