Zusätzliche Rechnungsadressen: in Verkaufsbelegmasken auswählbar
[kivitendo-erp.git] / SL / DB / Customer.pm
index 2032a41..d72d0c9 100644 (file)
@@ -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;