Bug 2505 - Add commented use warnings where missing in the acqui/ directory
[koha.git] / acqui / newordersuggestion.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
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.
9 #
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.
13 #
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
17
18
19 =head1 NAME
20
21 newordersuggestion.pl
22
23 =head1 DESCRIPTION
24
25 this script allow to add an order from a existing suggestion.
26 The suggestion must have 'ACCEPTED' as status.
27
28 =head1 CGI PARAMETERS
29
30 =over 4
31
32 =item basketno
33
34     the number of this basket.
35
36 =item booksellerid
37
38     the bookseller who sells this record.
39
40 =item title
41
42     to filter on title when searching among ACCEPTED suggestion.
43
44 =item author
45
46     to filter on author when searching among ACCEPTED suggestion.
47
48 =item note
49
50     to filter on note when searching among ACCEPTED suggestion.
51
52 =item copyrightdate
53
54 =item publishercode
55
56 =item volumedesc
57
58 =item publicationyear
59
60 the publication year of this record.
61
62 =item place
63
64 =item isbn
65
66 the isbn of this suggestion.
67
68 =item duplicateNumber
69
70 is the biblionumber to put to the new suggestion.
71
72 =item suggestionid
73
74 the id of the suggestion to select.
75
76 =item op
77
78 can be equal to
79     * connectDuplicate :
80         then call to the function : ConnectSuggestionAndBiblio.
81         i.e set the biblionumber of this suggestion.
82     * else :
83         is the default value.
84
85 =back
86
87 =cut
88
89 use strict;
90 #use warnings; FIXME - Bug 2505
91
92 use CGI;
93 use C4::Auth;    # get_template_and_user
94 use C4::Output;
95 use C4::Suggestions;
96 use C4::Bookseller;
97 use C4::Biblio;
98
99 my $input = new CGI;
100
101 # getting the CGI params
102 my $basketno        = $input->param('basketno');
103 my $supplierid      = $input->param('booksellerid');
104 my $author          = $input->param('author');
105 my $title           = $input->param('title');
106 my $publishercode   = $input->param('publishercode');
107 my $op              = $input->param('op');
108 my $suggestionid    = $input->param('suggestionid');
109 my $duplicateNumber = $input->param('duplicateNumber');
110 my $uncertainprice = $input->param('uncertainprice');
111
112 $op = 'else' unless $op;
113
114 my $dbh = C4::Context->dbh;
115 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
116     {
117         template_name   => "acqui/newordersuggestion.tmpl",
118         type            => "intranet",
119         query           => $input,
120         authnotrequired => 1,
121         flagsrequired   => { acquisition => 'order_manage' },
122     }
123 );
124
125 if ( $op eq 'connectDuplicate' ) {
126     ConnectSuggestionAndBiblio( $suggestionid, $duplicateNumber );
127 }
128
129 # getting all suggestions.
130 my $suggestions_loop =
131         &SearchSuggestion( 
132                 { managedby     => $borrowernumber, 
133                 author                  => $author, 
134                 title                   => $title, 
135                 publishercode   => $publishercode,
136                 status              => 'ACCEPTED'});
137 my $vendor = GetBookSellerFromId($supplierid);
138 $template->param(
139     suggestions_loop        => $suggestions_loop,
140     basketno                => $basketno,
141     supplierid              => $supplierid,
142     name                                        => $vendor->{'name'},
143     "op_$op"                => 1,
144 );
145
146 output_html_with_http_headers $input, $cookie, $template->output;