X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FPriceSource%2FCustomer.pm;h=fe67d9128835ec63ac23add5e64f81c0a4d76527;hb=b36fb0f412d2d2b43b8d98d787743cbe1fbf2540;hp=6bf06bc3018c32060f7ddedc88396ca8b00678ad;hpb=89b2668811eac6023ad58322e2f9970ddb6a27c9;p=kivitendo-erp.git diff --git a/SL/PriceSource/Customer.pm b/SL/PriceSource/Customer.pm index 6bf06bc30..fe67d9128 100644 --- a/SL/PriceSource/Customer.pm +++ b/SL/PriceSource/Customer.pm @@ -16,6 +16,7 @@ sub available_prices { } sub available_discounts { my ($self, %params) = @_; + return if $self->part->not_discountable; return unless $self->record->is_sales; return unless $self->record->customer; return unless $self->record->customer->discount != 0; @@ -28,7 +29,9 @@ sub available_discounts { ); } -sub price_from_source { +sub price_from_source { } + +sub discount_from_source { my ($self, $source, $spec) = @_; my $customer = SL::DB::Customer->load_cached($spec); @@ -40,7 +43,7 @@ sub price_from_source { ) } - if (!$self->record->customer) { + if (!$self->record->can('customer') || !$self->record->customer) { return SL::PriceSource::Discount->new( discount => $customer->discount, spec => $customer->id, @@ -56,7 +59,7 @@ sub price_from_source { spec => $customer->id, description => t8('Customer Discount'), price_source => $self, - invalid => t8('This discount is only valid for customer #1', $customer->full_description), + invalid => t8('This discount is only valid for customer #1', $customer->displayable_name), ) }