oops, removing un-needed $dbh->commit() calls
[koha.git] / acqui / updatesupplier.pl
blob419cc9e0a65b890d68deeac5cdf6f1a32fb97590
1 #!/usr/bin/perl
3 #script to show suppliers and orders
4 #written by chris@katipo.co.nz 23/2/2000
7 # Copyright 2000-2002 Katipo Communications
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
14 # version.
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
24 =head1 NAME
25 updatesupplier.pl
27 =head1 DESCRIPTION
28 this script allow to update or create (if id == 0)
29 a supplier. This script is called from acqui/supplier.pl.
31 =head1 CGI PARAMETERS
33 =over 4
35 All informations regarding this supplier are listed on input parameter.
36 Here is the list :
37 supplier, id, company, company_postal, physical, company_phone,
38 physical, company_phone, company_fax, website, company_contact_name,
39 company_contact_position, contact_phone, contact_phone_2, contact_fax,
40 company_email, contact_notes, notes, status, publishers_imprints,
41 list_currency, gst, list_gst, invoice_gst, discount.
43 =back
45 =cut
47 use C4::Bookseller;
48 use C4::Biblio;
49 use C4::Output;
50 use CGI;
51 use strict;
53 my $input=new CGI;
54 #print $input->header();
55 my $supplier=$input->param('supplier');
56 #print startpage;
57 my %data;
58 $data{'id'}=$input->param('id');
60 $data{'name'}=$input->param('company');
61 $data{'postal'}=$input->param('company_postal');
62 my $address=$input->param('physical');
63 my @addresses=split('\n',$address);
64 $data{'address1'}=$addresses[0];
65 $data{'address2'}=$addresses[1];
66 $data{'address3'}=$addresses[2];
67 $data{'address4'}=$addresses[3];
68 $data{'phone'}=$input->param('company_phone');
69 $data{'fax'}=$input->param('company_fax');
70 $data{'url'}=$input->param('website');
71 $data{'contact'}=$input->param('company_contact_name');
72 $data{'contpos'}=$input->param('company_contact_position');
73 $data{'contphone'}=$input->param('contact_phone');
74 $data{'contaltphone'}=$input->param('contact_phone_2');
75 $data{'contfax'}=$input->param('contact_fax');
76 $data{'contemail'}=$input->param('company_email');
77 $data{'contnotes'}=$input->param('contact_notes');
78 # warn "".$data{'contnotes'};
79 $data{'notes'}=$input->param('notes');
80 $data{'active'}=$input->param('status');
81 $data{'specialty'}=$input->param('publishers_imprints');
82 $data{'listprice'}=$input->param('list_currency');
83 $data{'invoiceprice'}=$input->param('invoice_currency');
84 $data{'gstreg'}=$input->param('gst');
85 $data{'listincgst'}=$input->param('list_gst');
86 $data{'invoiceincgst'}=$input->param('invoice_gst');
87 $data{'discount'}=$input->param('discount');
88 if($data{'name'}) {
89 if ($data{'id'}){
90 ModBookseller(\%data);
91 } else {
92 $data{id}=AddBookseller(\%data);
94 #redirect to booksellers.pl
95 print $input->redirect("booksellers.pl?supplier=".$data{id});
96 } else {
97 print $input->redirect("supplier.pl?op=enter"); # fail silently.