RecordLinks: credit_notes verlinken, und Typ von Rechnungen anzeigen
[kivitendo-erp.git] / SL / Presenter / Record.pm
index 4f9a518..23c5d46 100644 (file)
@@ -27,6 +27,7 @@ sub grouped_record_list {
   my %groups = _sort_grouped_lists(_group_records($list));
   my $output = '';
 
+  $output .= _requirement_spec_list(       $self, $groups{requirement_specs},        %params) if $groups{requirement_specs};
   $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};
@@ -74,7 +75,12 @@ sub record_list {
   if ($with_columns{record_link_direction}) {
     push @columns, {
       title => $::locale->text('Link direction'),
-      data  => sub { $_[0]->{_record_link_direction} eq 'from' ? $::locale->text('Row was source for current record') : $::locale->text('Row was created from current record') },
+      data  => sub {
+          $_[0]->{_record_link_depth} > 1
+        ? $::locale->text('Row was linked to another record')
+        : $_[0]->{_record_link_direction} eq 'from'
+        ? $::locale->text('Row was source for current record')
+        : $::locale->text('Row was created from current record') },
     };
   }
 
@@ -142,6 +148,7 @@ sub _group_records {
   my ($list) = @_;
 
   my %matchers = (
+    requirement_specs        => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec')                                         },
     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                     },
@@ -182,6 +189,24 @@ sub _sort_grouped_lists {
   return %groups;
 }
 
+sub _requirement_spec_list {
+  my ($self, $list, %params) = @_;
+
+  return $self->record_list(
+    $list,
+    title   => $::locale->text('Requirement specs'),
+    type    => 'requirement_spec',
+    columns => [
+      [ $::locale->text('Requirement spec number'), sub { $self->requirement_spec($_[0], display => 'table-cell') } ],
+      [ $::locale->text('Customer'),                'customer'                                                      ],
+      [ $::locale->text('Title'),                   'title'                                                         ],
+      [ $::locale->text('Project'),                 'project',                                                      ],
+      [ $::locale->text('Status'),                  sub { $_[0]->status->description }                              ],
+    ],
+    %params,
+  );
+}
+
 sub _sales_quotation_list {
   my ($self, $list, %params) = @_;
 
@@ -315,6 +340,7 @@ sub _sales_invoice_list {
     type    => 'sales_invoice',
     columns => [
       [ $::locale->text('Invoice Date'),            'transdate'               ],
+      [ $::locale->text('Type'),                    sub { $_[0]->displayable_type } ],
       [ $::locale->text('Invoice Number'),          sub { $self->sales_invoice($_[0], display => 'table-cell') } ],
       [ $::locale->text('Quotation Number'),        'quonumber' ],
       [ $::locale->text('Order Number'),            'ordnumber' ],
@@ -357,6 +383,7 @@ sub _ar_transaction_list {
     type    => 'ar_transaction',
     columns => [
       [ $::locale->text('Invoice Date'),            'transdate'               ],
+      [ $::locale->text('Type'),                    sub { $_[0]->displayable_type } ],
       [ $::locale->text('Invoice Number'),          sub { $self->ar_transaction($_[0], display => 'table-cell') } ],
       [ $::locale->text('Customer'),                'customer'                ],
       [ $::locale->text('Net amount'),              'netamount'               ],
@@ -545,13 +572,13 @@ C<link>.
 =item C<with_columns>
 
 Can be set by the caller to indicate additional columns to
-list. Currently supported:
+be listed. Currently supported:
 
 =over 2
 
 =item C<record_link_destination>
 
-The record link destination. Requires that the records to list have
+The record link destination. Requires that the records to be listed have
 been retrieved via the L<SL::DB::Helper::LinkedRecords> helper.
 
 =back
@@ -559,7 +586,7 @@ been retrieved via the L<SL::DB::Helper::LinkedRecords> helper.
 =item C<edit_record_links>
 
 If trueish additional controls will be rendered that allow the user to
-remove and add record links. Requires that the records to list have
+remove and add record links. Requires that the records to be listed have
 been retrieved via the L<SL::DB::Helper::LinkedRecords> helper.
 
 =back