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
24 this script allow to add an order from a existing suggestion.
31 the number of this basket.
34 the bookseller who sells this record.
37 the title of this record suggested.
40 the author of this suggestion.
43 this param allow to enter a note with this suggestion.
46 the copyright date for this suggestion.
53 the publication year of this record.
58 the isbn of this suggestion.
61 is the biblionumber to put to the new suggestion.
64 the id of the suggestion to select.
69 then call to the function : ConnectSuggestionAndBiblio.
70 i.e set the biblionumber of this suggestion.
80 use C4::Auth; # get_template_and_user
81 use C4::Interface::CGI::Output;
88 my $basketno = $input->param('basketno');
89 my $supplierid = $input->param('booksellerid');
90 my $title = $input->param('title');
91 my $author = $input->param('author');
92 my $note = $input->param('note');
93 my $copyrightdate =$input->param('copyrightdate');
94 my $publishercode = $input->param('publishercode');
95 my $volumedesc = $input->param('volumedesc');
96 my $publicationyear = $input->param('publicationyear');
97 my $place = $input->param('place');
98 my $isbn = $input->param('isbn');
99 my $duplicateNumber = $input->param('duplicateNumber');
100 my $suggestionid = $input->param('suggestionid');
102 my $status = 'ACCEPTED'; # the suggestion had to be accepeted before to order it.
103 my $suggestedbyme = -1; # search ALL suggestors
104 my $op = $input->param('op');
105 $op = 'else' unless $op;
107 my $dbh = C4::Context->dbh;
108 my ($template, $borrowernumber, $cookie)
109 = get_template_and_user({template_name => "acqui/newordersuggestion.tmpl",
112 authnotrequired => 1,
113 flagsrequired => {acquisition => 1},
116 if ($op eq 'connectDuplicate') {
117 ConnectSuggestionAndBiblio($suggestionid,$duplicateNumber);
119 my $suggestions_loop= &SearchSuggestion($borrowernumber,$author,$title,$publishercode,$status,$suggestedbyme);
120 foreach (@$suggestions_loop) {
121 unless ($_->{biblionumber}) {
122 my (@kohafields, @and_or, @value, @relation, $offset,$length);
123 # search on biblio.title
125 push @kohafields, "title";
126 push @and_or, "\@and";
127 push @relation, "\@attr 5=1";
128 push @value, $_->{title};
131 push @kohafields, "author";
132 push @and_or, "\@and";
134 push @value, $_->{author};
136 # ... and on publicationyear.
137 if ($_->{publicationyear}) {
138 push @kohafields, "copyrightdate";
139 push @and_or, "\@and";
141 push @value, $_->{publicationyear};
143 # ... and on publisher.
144 if ($_->{publishercode}) {
145 push @kohafields, "publishercode";
146 push @and_or, "\@and";
148 push @value, $_->{publishercode};
151 my ($nbresult,@finalresult) = ZEBRAsearch_kohafields(\@kohafields,\@value,\@relation,"",\@and_or,0,"",0,1);
153 # there is at least 1 result => return the 1st one
155 $_->{duplicateBiblionumber} = $finalresult[0]->{biblionumber};
159 $template->param(suggestions_loop => $suggestions_loop,
162 publishercode => $publishercode,
164 suggestedbyme => $suggestedbyme,
165 basketno => $basketno,
166 supplierid => $supplierid,
168 intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
169 intranetstylesheet => C4::Context->preference("intranetstylesheet"),
170 IntranetNav => C4::Context->preference("IntranetNav"),
172 output_html_with_http_headers $input, $cookie, $template->output;