X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/01c084af1ab0f2fd98dfcb3a2d4c7fdf8af7a95f..c6dd542b51ae9549ad42a54f9023b905412bbab9:/SL/Controller/CustomerVendor.pm diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index 5d60deb57..625ec62e0 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -61,6 +61,29 @@ __PACKAGE__->run_before( 'ajaj_get_contact', ] ); + +# make sure this comes after _load_customer_vendor +__PACKAGE__->run_before( + '_check_customer_vendor_all_edit', + only => [ + 'edit', + 'show', + 'update', + 'delete', + 'save', + 'save_and_ap_transaction', + 'save_and_ar_transaction', + 'save_and_close', + 'save_and_invoice', + 'save_and_order', + 'save_and_quotation', + 'save_and_rfq', + 'delete', + 'delete_contact', + 'delete_shipto', + ] +); + __PACKAGE__->run_before( '_create_customer_vendor', only => [ @@ -803,6 +826,16 @@ sub _load_customer_vendor { } } +sub _check_customer_vendor_all_edit { + my ($self) = @_; + + unless ($::auth->assert('customer_vendor_all_edit', 1)) { + die($::locale->text("You don't have the rights to edit this customer.") . "\n") + if $self->{cv}->is_customer and + SL::DB::Manager::Employee->current->id != $self->{cv}->salesman_id; + }; +}; + sub _create_customer_vendor { my ($self) = @_;