commit 255d89a0ff95321a926f15b963641750fe7d1c97
Author: Werner Hahn <wh@futureworldsearch.net>
Date:   Mon Sep 25 12:14:44 2017 +0200

    WebshopApi: ShopOrder als Record

diff --git a/SL/Controller/RecordLinks.pm b/SL/Controller/RecordLinks.pm
index b71467752..b477ba22e 100644
--- a/SL/Controller/RecordLinks.pm
+++ b/SL/Controller/RecordLinks.pm
@@ -15,6 +15,7 @@ use SL::DB::PurchaseInvoice;
 use SL::DB::RecordLink;
 use SL::DB::RequirementSpec;
 use SL::DBUtils qw(like);
+use SL::DB::ShopOrder;
 use SL::JSON;
 use SL::Locale::String;
 
@@ -36,7 +37,8 @@ my %link_type_defaults = (
 );
 
 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',  },
@@ -60,6 +62,7 @@ sub action_ajax_list {
   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) ],
diff --git a/SL/Presenter/Record.pm b/SL/Presenter/Record.pm
index 708e72653..ae2164e8b 100644
--- a/SL/Presenter/Record.pm
+++ b/SL/Presenter/Record.pm
@@ -43,6 +43,7 @@ sub grouped_record_list {
   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};
@@ -167,9 +168,9 @@ sub record_list {
 
 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                     },
@@ -231,6 +232,23 @@ sub _requirement_spec_list {
   );
 }
 
+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) = @_;
 
