3 # Copyright 2012 BibLibre
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 use Koha::Acquisition::Bookseller;
32 my $title = $query->param('title_filter');
33 my $ISSN = $query->param('ISSN_filter');
34 my $EAN = $query->param('EAN_filter');
35 my $publisher = $query->param('publisher_filter');
36 my $supplier = $query->param('supplier_filter');
37 my $branch = $query->param('branch_filter');
38 my $routing = $query->param('routing') || C4::Context->preference("RoutingSerials");
39 my $searched = $query->param('searched');
40 my $biblionumber = $query->param('biblionumber');
42 my $basketno = $query->param('basketno');
43 my $booksellerid = $query->param('booksellerid');
45 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
46 { template_name => "acqui/newordersubscription.tt",
50 flagsrequired => { acquisition => 'order_manage' },
54 my $basket = GetBasket($basketno);
55 $booksellerid = $basket->{booksellerid} unless $booksellerid;
56 my $bookseller = Koha::Acquisition::Bookseller->fetch({ id => $booksellerid });
60 @subscriptions = SearchSubscriptions({
64 publisher => $publisher,
65 bookseller => $supplier,
70 foreach my $sub (@subscriptions) {
71 $sub->{alreadyOnOrder} = subscriptionCurrentlyOnOrder $sub->{subscriptionid};
73 # to toggle between create or edit routing list options
75 $sub->{routingedit} = check_routing( $sub->{subscriptionid} );
79 my $branches = GetBranches();
81 foreach (sort keys %$branches){
83 $selected = 1 if defined $branch && $branch eq $_;
84 push @branches_loop, {
86 branchname => $branches->{$_}->{branchname},
87 selected => $selected,
92 subs_loop => \@subscriptions,
93 title_filter => $title,
96 publisher_filter => $publisher,
97 supplier_filter => $supplier,
98 branch_filter => $branch,
99 branches_loop => \@branches_loop,
100 done_searched => $searched,
102 booksellerid => $booksellerid,
103 basketno => $basket->{basketno},
104 basketname => $basket->{basketname},
105 booksellername => $bookseller->{name},
107 output_html_with_http_headers $query, $cookie, $template->output;