X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=acqui%2Fupdatesupplier.pl;h=844e504712fe90b792b1fb1656226235cb601384;hb=31a3a7ed9353958e3f684fffc62316caf21e3e77;hp=d000d528fd7861693967c103115e24bb1685d46d;hpb=3818a8dc384f1687d287e77fdb683b3eb518e036;p=koha.git diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl index d000d528fd..844e504712 100755 --- a/acqui/updatesupplier.pl +++ b/acqui/updatesupplier.pl @@ -5,6 +5,7 @@ # Copyright 2000-2002 Katipo Communications +# Copyright 2008-2009 BibLibre SARL # # This file is part of Koha. # @@ -17,45 +18,58 @@ # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# You should have received a copy of the GNU General Public License along with -# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA +# You should have received a copy of the GNU General Public License along +# with Koha; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. =head1 NAME + updatesupplier.pl =head1 DESCRIPTION + this script allow to update or create (if id == 0) a supplier. This script is called from acqui/supplier.pl. =head1 CGI PARAMETERS -=over 4 - All informations regarding this supplier are listed on input parameter. Here is the list : + supplier, id, company, company_postal, physical, company_phone, physical, company_phone, company_fax, website, company_contact_name, company_contact_position, contact_phone, contact_phone_2, contact_fax, company_email, contact_notes, notes, status, publishers_imprints, -list_currency, gst, list_gst, invoice_gst, discount. - -=back +list_currency, gst, list_gst, invoice_gst, discount, gstrate. =cut -use C4::Bookseller; +use strict; +#use warnings; FIXME - Bug 2505 +use C4::Context; +use C4::Auth; + +use C4::Bookseller qw( ModBookseller AddBookseller ); use C4::Biblio; use C4::Output; use CGI; -use strict; my $input=new CGI; +my ($template, $loggedinuser, $cookie) = get_template_and_user( + { template_name => "", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => { acquisition => 'vendors_manage' }, + debug => 1, + } +); + #print $input->header(); -my $supplier=$input->param('supplier'); +my $booksellerid=$input->param('booksellerid'); #print startpage; my %data; -$data{'id'}=$input->param('id'); +$data{'id'}=$booksellerid; $data{'name'}=$input->param('company'); $data{'postal'}=$input->param('company_postal'); @@ -66,6 +80,7 @@ $data{'address2'}=$addresses[1]; $data{'address3'}=$addresses[2]; $data{'address4'}=$addresses[3]; $data{'phone'}=$input->param('company_phone'); +$data{'accountnumber'}=$input->param('accountnumber'); $data{'fax'}=$input->param('company_fax'); $data{'url'}=$input->param('website'); $data{'contact'}=$input->param('company_contact_name'); @@ -78,19 +93,29 @@ $data{'contnotes'}=$input->param('contact_notes'); # warn "".$data{'contnotes'}; $data{'notes'}=$input->param('notes'); $data{'active'}=$input->param('status'); -$data{'specialty'}=$input->param('publishers_imprints'); + $data{'listprice'}=$input->param('list_currency'); $data{'invoiceprice'}=$input->param('invoice_currency'); $data{'gstreg'}=$input->param('gst'); $data{'listincgst'}=$input->param('list_gst'); -$data{'invoiceincgst'}=$input->param('invoiceincgst'); -$data{'discount'}=$input->param('discount'); -my $id=$input->param('id'); -if ($data{'id'} != 0){ - ModBookseller(\%data); +$data{'invoiceincgst'}=$input->param('invoice_gst'); +#have to transform this into fraction so it's easier to use +my $gstrate = $input->param('gstrate'); +if ($gstrate eq '') { + $data{'gstrate'} = undef; } else { - $id=AddBookseller(\%data); + $data{'gstrate'} = $input->param('gstrate')/100; } - +$data{'discount'}=$input->param('discount'); +$data{'active'}=$input->param('status'); +if($data{'name'}) { + if ($data{'id'}){ + ModBookseller(\%data); + } else { + $data{id}=AddBookseller(\%data); + } #redirect to booksellers.pl -print $input->redirect("booksellers.pl?supplier=$id"); +print $input->redirect("booksellers.pl?booksellerid=".$data{id}); +} else { +print $input->redirect("supplier.pl?op=enter"); # fail silently. +}