Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 255d89a0

Von Werner Hahn vor etwa 7 Jahren hinzugefügt

  • ID 255d89a0ff95321a926f15b963641750fe7d1c97
  • Vorgänger 31378f48
  • Nachfolger 6a13cdd5

WebshopApi: ShopOrder als Record

Unterschiede anzeigen:

SL/Controller/RecordLinks.pm
15 15
use SL::DB::RecordLink;
16 16
use SL::DB::RequirementSpec;
17 17
use SL::DBUtils qw(like);
18
use SL::DB::ShopOrder;
18 19
use SL::JSON;
19 20
use SL::Locale::String;
20 21

  
......
36 37
);
37 38

  
38 39
my @link_type_specifics = (
39
  { 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', },
40
  { title => t8('Requirement spec'),        type => 'requirement_spec',        model => 'RequirementSpec', number => 'id', project => 'project', description => 'title', date => undef, filter => 'working_copy_filter', },
41
  { title => t8('Shop Order'),              type => 'shop_order',              model => 'ShopOrder',       number => 'shop_ordernumber', date => 'order_date', project => undef, },
40 42
  { title => t8('Sales quotation'),         type => 'sales_quotation',         model => 'Order',           number => 'quonumber', },
41 43
  { title => t8('Sales Order'),             type => 'sales_order',             model => 'Order',           number => 'ordnumber', },
42 44
  { title => t8('Sales delivery order'),    type => 'sales_delivery_order',    model => 'DeliveryOrder',   number => 'donumber',  },
......
60 62
  eval {
61 63
    my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1);
62 64
    push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items');
65

  
63 66
    my $output         = SL::Presenter->get->grouped_record_list(
64 67
      $linked_records,
65 68
      with_columns      => [ qw(record_link_direction) ],
SL/Presenter/Record.pm
43 43
  my $output = '';
44 44

  
45 45
  $output .= _requirement_spec_list(       $self, $groups{requirement_specs},        %params) if $groups{requirement_specs};
46
  $output .= _shop_order_list(             $self, $groups{shop_orders},              %params) if $groups{shop_orders};
46 47
  $output .= _sales_quotation_list(        $self, $groups{sales_quotations},         %params) if $groups{sales_quotations};
47 48
  $output .= _sales_order_list(            $self, $groups{sales_orders},             %params) if $groups{sales_orders};
48 49
  $output .= _sales_delivery_order_list(   $self, $groups{sales_delivery_orders},    %params) if $groups{sales_delivery_orders};
......
167 168

  
168 169
sub _group_records {
169 170
  my ($list) = @_;
170

  
171 171
  my %matchers = (
172 172
    requirement_specs        => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec')                                         },
173
    shop_orders              => sub { (ref($_[0]) eq 'SL::DB::ShopOrder')       &&  $_[0]->id                           },
173 174
    sales_quotations         => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_quotation')   },
174 175
    sales_orders             => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_order')       },
175 176
    sales_delivery_orders    => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder')   &&  $_[0]->is_sales                     },
......
231 232
  );
232 233
}
233 234

  
235
sub _shop_order_list {
236
  my ($self, $list, %params) = @_;
237

  
238
  return $self->record_list(
239
    $list,
240
    title   => $::locale->text('Shop Orders'),
241
    type    => 'shop_order',
242
    columns => [
243
      [ $::locale->text('Shop Order Date'),         sub { $_[0]->order_date->to_kivitendo }                         ],
244
      [ $::locale->text('Shop Order Number'),       sub { $self->shop_order($_[0], display => 'table-cell') }       ],
245
      [ $::locale->text('Transfer Date'),           'transfer_date'                                                 ],
246
      [ $::locale->text('Amount'),                  'amount'                                                        ],
247
    ],
248
    %params,
249
  );
250
}
251

  
234 252
sub _sales_quotation_list {
235 253
  my ($self, $list, %params) = @_;
236 254

  

Auch abrufbar als: Unified diff