Escape ISO8859-1 characters. msgmerge still hates these strings, but at
[koha.git] / acqui / order.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #script to show suppliers and orders
6 #written by chris@katipo.co.nz 23/2/2000
7
8
9 # Copyright 2000-2002 Katipo Communications
10 #
11 # This file is part of Koha.
12 #
13 # Koha is free software; you can redistribute it and/or modify it under the
14 # terms of the GNU General Public License as published by the Free Software
15 # Foundation; either version 2 of the License, or (at your option) any later
16 # version.
17 #
18 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
19 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
20 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
24 # Suite 330, Boston, MA  02111-1307 USA
25
26 use strict;
27 use C4::Catalogue;
28 use C4::Auth;
29 use C4::Biblio;
30 use C4::Output;
31 use CGI;
32 use C4::Interface::CGI::Output;
33 use C4::Database;
34 use HTML::Template;
35 use C4::Catalogue;
36 use C4::Date;
37
38 my $query=new CGI;
39 my ($template, $loggedinuser, $cookie)
40     = get_template_and_user({template_name => "acqui/order.tmpl",
41                              query => $query,
42                              type => "intranet",
43                              authnotrequired => 0,
44                              flagsrequired => {acquisition => 1},
45                              debug => 1,
46                              });
47
48 my $supplier=$query->param('supplier');
49 my ($count,@suppliers)=bookseller($supplier);
50
51 my $colour='#EEEEEE';
52 my $toggle=0;
53 my @loop_suppliers;
54 for (my $i=0; $i<$count; $i++) {
55         my ($ordcount,$orders)=getorders($suppliers[$i]->{'id'});
56         my %line;
57         if ($toggle==0){
58                 $line{color}='#EEEEEE';
59                 $toggle=1;
60         } else {
61                 $line{color}='white';
62                 $toggle=0;
63         }
64         $line{id} =$suppliers[$i]->{'id'};
65         $line{name} = $suppliers[$i]->{'name'};
66         $line{active} = $suppliers[$i]->{'active'};
67         $line{total} = $orders->[0]->{'count(*)'};
68         $line{authorisedby} = $orders->[0]->{'authorisedby'};
69         $line{entrydate} = $orders->[0]->{'entrydate'};
70         my @loop_basket;
71         for (my $i2=0;$i2<$ordcount;$i2++){
72                 my %inner_line;
73                 $inner_line{basketno} =$orders->[$i2]->{'basketno'};
74                 $inner_line{total} =$orders->[$i2]->{'count(*)'};
75                 $inner_line{authorisedby} = $orders->[$i2]->{'authorisedby'};
76                 $inner_line{entrydate} = format_date($orders->[$i2]->{'entrydate'});
77                 push @loop_basket, \%inner_line;
78         }
79         $line{loop_basket} = \@loop_basket;
80         push @loop_suppliers, \%line;
81 }
82 $template->param(loop_suppliers => \@loop_suppliers,
83                                                 supplier => $supplier,
84                                                 count => $count);
85
86 output_html_with_http_headers $query, $cookie, $template->output;