3 #origninally script to provide intranet (librarian) advanced search facility
4 #now script to do searching for acquisitions
6 # Copyright 2000-2002 Katipo Communications
7 # Copyright 2008-2009 BibLibre SARL
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License along with
21 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
22 # Suite 330, Boston, MA 02111-1307 USA
30 this script allows to perform a new order from an existing record.
37 the title the librarian has typed to search an existing record.
40 the keyword the librarian has typed to search an existing record.
43 the author of the new record.
46 the number of result per page to display
49 the id of the bookseller this script has to add an order.
52 the basket number to know on which basket this script have to add a new order.
70 #getting all CGI params into a hash.
71 my $params = $input->Vars;
73 my $page = $params->{'page'} || 1;
74 my $query = $params->{'q'};
75 my $results_per_page = $params->{'num'} || 20;
76 my $booksellerid = $params->{'booksellerid'};
77 my $basketno = $params->{'basketno'};
78 my $sub = $params->{'sub'};
79 my $bookseller = GetBookSellerFromId
($booksellerid);
81 # getting the template
82 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
84 template_name
=> "acqui/neworderbiblio.tmpl",
88 flagsrequired
=> { acquisition
=> 'order_manage' },
92 # Searching the catalog.
93 my ($error, $marcresults, $total_hits) = SimpleSearch
($query, $results_per_page * ($page - 1), $results_per_page);
96 warn "error: ".$error;
98 query_error
=> $error,
99 basketno
=> $basketno,
100 booksellerid
=> $bookseller->{'id'},
101 name
=> $bookseller->{'name'},
103 output_html_with_http_headers
$input, $cookie, $template->output;
110 foreach my $result ( @
{$marcresults} ) {
111 my $marcrecord = MARC
::File
::USMARC
::decode
( $result );
112 my $biblio = TransformMarcToKoha
( C4
::Context
->dbh, $marcrecord, '' );
114 $biblio->{booksellerid
} = $booksellerid;
115 push @results, $biblio;
120 basketno
=> $basketno,
121 booksellerid
=> $bookseller->{'id'},
122 name
=> $bookseller->{'name'},
123 resultsloop
=> \
@results,
124 total
=> $total_hits,
126 pagination_bar
=> pagination_bar
( "$ENV{'SCRIPT_NAME'}?q=$query&booksellerid=$booksellerid&", getnbpages
( $total_hits, $results_per_page ), $page, 'page' ),
130 output_html_with_http_headers
$input, $cookie, $template->output;