catalogue.pm deals only with acquisitions.
[wip/koha-chris_n.git] / acqui / updatesupplier.pl
1 #!/usr/bin/perl
2
3 #script to show suppliers and orders
4 #written by chris@katipo.co.nz 23/2/2000
5
6
7 # Copyright 2000-2002 Katipo Communications
8 #
9 # This file is part of Koha.
10 #
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
14 # version.
15 #
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.
19 #
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
23
24 use C4::Acquisition;
25 use C4::Biblio;
26 use C4::Output;
27 use CGI;
28 use strict;
29
30 my $input=new CGI;
31 #print $input->header();
32 my $supplier=$input->param('supplier');
33 #print startpage;
34 my %data;
35 $data{'id'}=$input->param('id');
36
37 $data{'name'}=$input->param('company');
38 $data{'name'}=~ s/\'/\\\'/g;
39 $data{'postal'}=$input->param('company_postal');
40 my $address=$input->param('physical');
41 my @addresses=split('\n',$address);
42 $data{'address1'}=$addresses[0];
43 $data{'address2'}=$addresses[1];
44 $data{'address3'}=$addresses[2];
45 $data{'address4'}=$addresses[3];
46 $data{'phone'}=$input->param('company_phone');
47 $data{'fax'}=$input->param('company_fax');
48 $data{'url'}=$input->param('website');
49 $data{'contact'}=$input->param('company_contact_name');
50 $data{'contpos'}=$input->param('company_contact_position');
51 $data{'contphone'}=$input->param('contact_phone');
52 $data{'contaltphone'}=$input->param('contact_phone_2');
53 $data{'contfax'}=$input->param('contact_fax');
54 $data{'contemail'}=$input->param('company_email');
55 $data{'contnotes'}=$input->param('notes');
56 $data{'active'}=$input->param('status');
57 $data{'specialty'}=$input->param('publishers_imprints');
58 $data{'listprice'}=$input->param('list_currency');
59 $data{'invoiceprice'}=$input->param('invoice_currency');
60 $data{'gstreg'}=$input->param('gst');
61 $data{'listincgst'}=$input->param('list_gst');
62 $data{'invoiceincgst'}=$input->param('invoice_gst');
63 $data{'discount'}=$input->param('discount');
64 my $id=$input->param('id');
65 if ($data{'id'} != 0){
66   updatesup(\%data);
67 } else {
68   $id=insertsup(\%data);
69 }
70 #print startmenu('acquisitions');
71 #my ($count,@suppliers)=bookseller($supplier);
72
73 #print $input->dump;
74
75
76 #print endmenu('acquisitions');
77
78 #print endpage;
79
80 print $input->redirect("order.pl?supplier=$id");