Bug 12032: disable automatic URL conversion by TinyMCE in news
[koha.git] / acqui / updatesupplier.pl
blob7b3bf9d6d8c403bd403ced759a29163ffe9226d5
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
8 # Copyright 2008-2009 BibLibre SARL
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License along
22 # with Koha; if not, write to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 =head1 NAME
27 updatesupplier.pl
29 =head1 DESCRIPTION
31 this script allow to update or create (if id == 0)
32 a supplier. This script is called from acqui/supplier.pl.
34 =head1 CGI PARAMETERS
36 All informations regarding this supplier are listed on input parameter.
37 Here is the list :
39 supplier, id, company, company_postal, physical, company_phone,
40 physical, company_phone, company_fax, website, company_contact_name,
41 company_contact_position, contact_phone, contact_phone_2, contact_fax,
42 company_email, contact_notes, notes, status, publishers_imprints,
43 list_currency, gst, list_gst, invoice_gst, discount, gstrate.
45 =cut
47 use strict;
48 #use warnings; FIXME - Bug 2505
49 use C4::Context;
50 use C4::Auth;
52 use C4::Bookseller qw( ModBookseller AddBookseller );
53 use C4::Biblio;
54 use C4::Output;
55 use CGI;
57 my $input=new CGI;
58 my ($template, $loggedinuser, $cookie) = get_template_and_user(
59 { template_name => "",
60 query => $input,
61 type => "intranet",
62 authnotrequired => 0,
63 flagsrequired => { acquisition => 'vendors_manage' },
64 debug => 1,
68 #print $input->header();
69 my $booksellerid=$input->param('booksellerid');
70 #print startpage;
71 my %data;
72 $data{'id'}=$booksellerid;
74 $data{'name'}=$input->param('company');
75 $data{'postal'}=$input->param('company_postal');
76 my $address=$input->param('physical');
77 my @addresses=split('\n',$address);
78 $data{'address1'}=$addresses[0];
79 $data{'address2'}=$addresses[1];
80 $data{'address3'}=$addresses[2];
81 $data{'address4'}=$addresses[3];
82 $data{'phone'}=$input->param('company_phone');
83 $data{'accountnumber'}=$input->param('accountnumber');
84 $data{'fax'}=$input->param('company_fax');
85 $data{'url'}=$input->param('website');
86 $data{'contact'}=$input->param('company_contact_name');
87 $data{'contpos'}=$input->param('company_contact_position');
88 $data{'contphone'}=$input->param('contact_phone');
89 $data{'contaltphone'}=$input->param('contact_phone_2');
90 $data{'contfax'}=$input->param('contact_fax');
91 $data{'contemail'}=$input->param('company_email');
92 $data{'contnotes'}=$input->param('contact_notes');
93 # warn "".$data{'contnotes'};
94 $data{'notes'}=$input->param('notes');
95 $data{'active'}=$input->param('status');
97 $data{'listprice'}=$input->param('list_currency');
98 $data{'invoiceprice'}=$input->param('invoice_currency');
99 $data{'gstreg'}=$input->param('gst');
100 $data{'listincgst'}=$input->param('list_gst');
101 $data{'invoiceincgst'}=$input->param('invoice_gst');
102 #have to transform this into fraction so it's easier to use
103 $data{'gstrate'} = $input->param('gstrate');
104 $data{'discount'} = $input->param('discount');
105 $data{deliverytime} = $input->param('deliverytime');
106 $data{'active'}=$input->param('status');
107 if($data{'name'}) {
108 if ($data{'id'}){
109 ModBookseller(\%data);
110 } else {
111 $data{id}=AddBookseller(\%data);
113 #redirect to booksellers.pl
114 print $input->redirect("booksellers.pl?booksellerid=".$data{id});
115 } else {
116 print $input->redirect("supplier.pl?op=enter"); # fail silently.