X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FCustomer.pm;h=d72d0c91ac9f4abf9fcd1b6c6a6b5b7a00dc678c;hb=a3449070f9bb3621bf675b40510a324942e7117e;hp=2032a4179357c60bd76a20e9e77af3f2d1ae4ed3;hpb=b5b366c932e2a8118cafa0d27432fa268099d419;p=kivitendo-erp.git diff --git a/SL/DB/Customer.pm b/SL/DB/Customer.pm index 2032a4179..d72d0c91a 100644 --- a/SL/DB/Customer.pm +++ b/SL/DB/Customer.pm @@ -2,6 +2,7 @@ package SL::DB::Customer; use strict; +use List::Util qw(first); use Rose::DB::Object::Helpers qw(as_tree); use SL::Locale::String qw(t8); @@ -114,4 +115,11 @@ sub create_zugferd_invoices_for_this_customer { return $self->create_zugferd_invoices; } +sub default_billing_address { + my $self = shift; + + die 'not an accessor' if @_ > 1; + return first { $_->default_address } @{ $self->additional_billing_addresses }; +} + 1;