X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fbp.pl;h=173f8b6c182b858b10ea18ebdaab10679f63a9bf;hb=c9902d7658d0cacdf665971b32de0e054637efd0;hp=6e7d9277a7d20d7d6b85d466f3c7b5714acd00bf;hpb=be4e11d36f40d90622fdf35eb07ab207422b5455;p=kivitendo-erp.git diff --git a/bin/mozilla/bp.pl b/bin/mozilla/bp.pl index 6e7d9277a..173f8b6c1 100644 --- a/bin/mozilla/bp.pl +++ b/bin/mozilla/bp.pl @@ -33,18 +33,49 @@ use SL::BP; use Data::Dumper; +use List::Util qw(first); 1; require "bin/mozilla/common.pl"; +use strict; + # end of main +sub assert_bp_access { + my $form = $main::form; + + my %access_map = ( + 'invoice' => 'invoice_edit', + 'sales_order' => 'sales_order_edit', + 'sales_quotation' => 'sales_quotation_edit', + 'purchase_order' => 'purchase_order_edit', + 'request_quotation' => 'request_quotation_edit', + 'check' => 'cash', + 'receipt' => 'cash', + ); + + if ($form->{type} && $access_map{$form->{type}}) { + $main::auth->assert($access_map{$form->{type}}); + + } else { + $main::auth->assert('DOES_NOT_EXIST'); + } +} + sub search { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + my ($name, $account, $onload); + + assert_bp_access(); # $locale->text('Sales Invoices') - # $locale->text('Packing Lists') # $locale->text('Sales Orders') # $locale->text('Purchase Orders') # $locale->text('Quotations') @@ -55,7 +86,7 @@ sub search { # setup customer/vendor selection BP->get_vc(\%myconfig, \%$form); - if (@{ $form->{"all_$form->{vc}"} }) { + if (@{ $form->{"all_$form->{vc}"} || [] }) { map { $name .= "