use strict;
+use List::Util qw(first);
use Rose::DB::Object::Helpers qw(as_tree);
use SL::Locale::String qw(t8);
use SL::DB::VC;
__PACKAGE__->meta->add_relationship(
+ additional_billing_addresses => {
+ type => 'one to many',
+ class => 'SL::DB::AdditionalBillingAddress',
+ column_map => { id => 'customer_id' },
+ manager_args => { sort_by => 'lower(additional_billing_addresses.name)' },
+ },
shipto => {
type => 'one to many',
class => 'SL::DB::Shipto',
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;