use SL::DB::RecordLink;
use SL::DB::RequirementSpec;
use SL::DBUtils qw(like);
+use SL::DB::ShopOrder;
use SL::JSON;
use SL::Locale::String;
);
my @link_type_specifics = (
- { title => t8('Requirement spec'), type => 'requirement_spec', model => 'RequirementSpec', number => 'id', description => 'title', description_title => t8('Title'), date => undef, project => 'project', filter => 'working_copy_filter', },
+ { title => t8('Requirement spec'), type => 'requirement_spec', model => 'RequirementSpec', number => 'id', project => 'project', description => 'title', date => undef, filter => 'working_copy_filter', },
+ { title => t8('Shop Order'), type => 'shop_order', model => 'ShopOrder', number => 'shop_ordernumber', date => 'order_date', project => undef, },
{ title => t8('Sales quotation'), type => 'sales_quotation', model => 'Order', number => 'quonumber', },
{ title => t8('Sales Order'), type => 'sales_order', model => 'Order', number => 'ordnumber', },
{ title => t8('Sales delivery order'), type => 'sales_delivery_order', model => 'DeliveryOrder', number => 'donumber', },
eval {
my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1);
push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items');
+
my $output = SL::Presenter->get->grouped_record_list(
$linked_records,
with_columns => [ qw(record_link_direction) ],
my $output = '';
$output .= _requirement_spec_list( $self, $groups{requirement_specs}, %params) if $groups{requirement_specs};
+ $output .= _shop_order_list( $self, $groups{shop_orders}, %params) if $groups{shop_orders};
$output .= _sales_quotation_list( $self, $groups{sales_quotations}, %params) if $groups{sales_quotations};
$output .= _sales_order_list( $self, $groups{sales_orders}, %params) if $groups{sales_orders};
$output .= _sales_delivery_order_list( $self, $groups{sales_delivery_orders}, %params) if $groups{sales_delivery_orders};
sub _group_records {
my ($list) = @_;
-
my %matchers = (
requirement_specs => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec') },
+ shop_orders => sub { (ref($_[0]) eq 'SL::DB::ShopOrder') && $_[0]->id },
sales_quotations => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_quotation') },
sales_orders => sub { (ref($_[0]) eq 'SL::DB::Order') && $_[0]->is_type('sales_order') },
sales_delivery_orders => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder') && $_[0]->is_sales },
);
}
+sub _shop_order_list {
+ my ($self, $list, %params) = @_;
+
+ return $self->record_list(
+ $list,
+ title => $::locale->text('Shop Orders'),
+ type => 'shop_order',
+ columns => [
+ [ $::locale->text('Shop Order Date'), sub { $_[0]->order_date->to_kivitendo } ],
+ [ $::locale->text('Shop Order Number'), sub { $self->shop_order($_[0], display => 'table-cell') } ],
+ [ $::locale->text('Transfer Date'), 'transfer_date' ],
+ [ $::locale->text('Amount'), 'amount' ],
+ ],
+ %params,
+ );
+}
+
sub _sales_quotation_list {
my ($self, $list, %params) = @_;