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
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
22 use C4
::Auth
; # get_template_and_user
28 my $title = $input->param('title');
29 my $author = $input->param('author');
30 my $note = $input->param('note');
31 my $copyrightdate = $input->param('copyrightdate');
32 my $publishercode = $input->param('publishercode');
33 my $volumedesc = $input->param('volumedesc');
34 my $publicationyear = $input->param('publicationyear');
35 my $place = $input->param('place');
36 my $isbn = $input->param('isbn');
37 my $status = $input->param('status');
38 my $suggestedbyme = (defined $input->param('suggestedby')?
$input->param('suggestedby'):1);
39 my $op = $input->param('op');
40 $op = 'else' unless $op;
42 my ( $template, $borrowernumber, $cookie );
44 my $dbh = C4
::Context
->dbh;
46 if ( C4
::Context
->preference("AnonSuggestions") ) {
47 ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
49 template_name
=> "opac-suggestions.tmpl",
55 if ( !$borrowernumber ) {
56 $borrowernumber = C4
::Context
->preference("AnonSuggestions");
60 ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
62 template_name
=> "opac-suggestions.tmpl",
70 if ( $op eq "add_confirm" ) {
72 $borrowernumber, $title, $author, $publishercode,
73 $note, $copyrightdate, $volumedesc, $publicationyear,
77 # empty fields, to avoid filter in "SearchSuggestion"
83 $publicationyear = '';
89 if ( $op eq "delete_confirm" ) {
90 my @delete_field = $input->param("delete_field");
91 foreach my $delete_field (@delete_field) {
92 &DelSuggestion
( $borrowernumber, $delete_field );
97 my $suggestions_loop =
98 &SearchSuggestion
( $borrowernumber, $author, $title, $publishercode, $status,
101 foreach my $suggestion(@
$suggestions_loop) {
102 if($suggestion->{'suggestedby'} == $borrowernumber) {
103 $suggestion->{'showcheckbox'} = $borrowernumber;
105 $suggestion->{'showcheckbox'} = 0;
110 suggestions_loop
=> $suggestions_loop,
113 publishercode
=> $publishercode,
115 suggestedbyme
=> $suggestedbyme,
120 output_html_with_http_headers
$input, $cookie, $template->output;