Initial revision
[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 use C4::Acquisitions;
7 use C4::Output;
8 use CGI;
9 use strict;
10
11 my $input=new CGI;
12 #print $input->header();
13 my $supplier=$input->param('supplier');
14 #print startpage;
15 my %data;
16 $data{'id'}=$input->param('id');
17
18 $data{'name'}=$input->param('company');
19 $data{'name'}=~ s/\'/\\\'/g;
20 $data{'postal'}=$input->param('company_postal');
21 my $address=$input->param('physical');
22 my @addresses=split('\n',$address);
23 $data{'address1'}=$addresses[0];
24 $data{'address2'}=$addresses[1];
25 $data{'address3'}=$addresses[2];
26 $data{'address4'}=$addresses[3];
27 $data{'phone'}=$input->param('company_phone');
28 $data{'fax'}=$input->param('company_fax');
29 $data{'url'}=$input->param('website');
30 $data{'contact'}=$input->param('company_contact_name');
31 $data{'contpos'}=$input->param('company_contact_position');
32 $data{'contphone'}=$input->param('contact_phone');
33 $data{'contaltphone'}=$input->param('contact_phone_2');
34 $data{'contfax'}=$input->param('contact_fax');
35 $data{'contemail'}=$input->param('company_email');
36 $data{'contnotes'}=$input->param('notes');
37 $data{'active'}=$input->param('status');
38 $data{'specialty'}=$input->param('publishers_imprints');
39 $data{'listprice'}=$input->param('list_currency');
40 $data{'invoiceprice'}=$input->param('invoice_currency');
41 $data{'gstreg'}=$input->param('gst');
42 $data{'listincgst'}=$input->param('list_gst');
43 $data{'invoiceincgst'}=$input->param('invoice_gst');
44 $data{'discount'}=$input->param('discount');
45 my $id=$input->param('id');
46 if ($data{'id'} != 0){
47   updatesup(\%data);
48 } else {
49   $id=insertsup(\%data);
50 }
51 #print startmenu('acquisitions');
52 #my ($count,@suppliers)=bookseller($supplier);
53
54 #print $input->dump;
55
56
57 #print endmenu('acquisitions');
58
59 #print endpage;
60
61 print $input->redirect("order.pl?supplier=$id");