class => 'SL::DB::PeriodicInvoicesConfig',
column_map => { id => 'oe_id' },
},
- payment_term => {
- type => 'one to one',
- class => 'SL::DB::PaymentTerm',
- column_map => { payment_id => 'id' },
- },
- contact => {
- type => 'one to one',
- class => 'SL::DB::Contact',
- column_map => { cp_id => 'cp_id' },
- },
- shipto => {
- type => 'one to one',
- class => 'SL::DB::Shipto',
- column_map => { shipto_id => 'shipto_id' },
- },
- department => {
- type => 'one to one',
- class => 'SL::DB::Department',
- column_map => { department_id => 'id' },
- },
- language => {
- type => 'one to one',
- class => 'SL::DB::Language',
- column_map => { language_id => 'id' },
- },
);
__PACKAGE__->meta->initialize;
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__