}
},
periodic_invoices_config => {
- type => 'one to many',
+ type => 'one to one',
class => 'SL::DB::PeriodicInvoicesConfig',
column_map => { id => 'oe_id' },
},
# methods
-sub items { goto &orderitems; }
-sub payment_terms { goto &payment; }
+sub items { goto &orderitems; }
+
+sub items_sorted {
+ my ($self) = @_;
+
+ my @sorted = sort {$a->id <=> $b->id } @{ $self->items };
+ return wantarray ? @sorted : \@sorted;
+}
sub type {
my $self = shift;
sub is_sales {
croak 'not an accessor' if @_ > 1;
- return shift->customer_id;
+ return !!shift->customer_id;
}
sub invoices {
return $self->${ \ $number_method{$self->type} }(@_);
}
+sub date {
+ goto &transdate;
+}
+
1;
__END__