Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 00662498

Von Werner Hahn vor mehr als 7 Jahren hinzugefügt

  • ID 00662498babe5cfa1bc24c246be228d71fe6d215
  • Vorgänger 5a19dcad
  • Nachfolger 5a973c14

Shopmodul: RecordLinks - Vernüpfte Belege gefixt(bei 2 Shoporder),Linktext anstatt id shop_ordernumber

Unterschiede anzeigen:

SL/Controller/RecordLinks.pm
38 38

  
39 39
my @link_type_specifics = (
40 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', },
41
  { title => t8('Shop Order'),              type => 'shop_order',              model => 'ShopOrder',       number => 'shop_ordernumber', date => 'order_date', project => undef, },
42 42
  { title => t8('Sales quotation'),         type => 'sales_quotation',         model => 'Order',           number => 'quonumber', },
43 43
  { title => t8('Sales Order'),             type => 'sales_order',             model => 'Order',           number => 'ordnumber', },
44 44
  { title => t8('Sales delivery order'),    type => 'sales_delivery_order',    model => 'DeliveryOrder',   number => 'donumber',  },
......
62 62
  eval {
63 63
    my $linked_records = $self->object->linked_records(direction => 'both', recursive => 1, save_path => 1);
64 64
    push @{ $linked_records }, $self->object->sepa_export_items if $self->object->can('sepa_export_items');
65
    $main::lxdebug->dump(0, 'WH: RECORDS:', \$linked_records);
66 65

  
67 66
    my $output         = SL::Presenter->get->grouped_record_list(
68 67
      $linked_records,
SL/DB/Helper/LinkedRecords.pm
312 312
                  'SL::DB::PurchaseInvoice' => sub { $_[0]->invnumber },
313 313
                  'SL::DB::RequirementSpec' => sub { $_[0]->id },
314 314
                  'SL::DB::Letter'          => sub { $_[0]->letternumber },
315
                  'SL::DB::ShopOrder'       => sub { $_[0]->shop_ordernumber },
315 316
                  UNKNOWN                   => '9999999999999999',
316 317
                );
317 318
  my $number_xtor = sub {
......
341 342
              'SL::DB::PurchaseInvoice' => 150,
342 343
              'SL::DB::PurchaseInvoice' => 150,
343 344
              'SL::DB::Letter'          => 200,
345
              'SL::DB::ShopOrder'       => 250,
344 346
              UNKNOWN                   => 999,
345 347
            );
346 348
  my $score_xtor = sub {
SL/DB/ShopOrder.pm
103 103
   return $order;
104 104
};
105 105

  
106
sub compare_to {
107
  my ($self, $other) = @_;
108

  
109
  return  1 if  $self->transfer_date && !$other->transfer_date;
110
  return -1 if !$self->transfer_date &&  $other->transfer_date;
111

  
112
  my $result = 0;
113
  $result    = $self->transfer_date <=> $other->transfer_date if $self->transfer_date;
114
  return $result || ($self->id <=> $other->id);
115
}
116

  
106 117
1;
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
  $output .= _shop_order_list(             $self, $groups{shop_orders},              %params) if $groups{shop_orders};
47 47
  $output .= _sales_quotation_list(        $self, $groups{sales_quotations},         %params) if $groups{sales_quotations};
48 48
  $output .= _sales_order_list(            $self, $groups{sales_orders},             %params) if $groups{sales_orders};
49 49
  $output .= _sales_delivery_order_list(   $self, $groups{sales_delivery_orders},    %params) if $groups{sales_delivery_orders};
......
168 168

  
169 169
sub _group_records {
170 170
  my ($list) = @_;
171
$main::lxdebug->dump(0, 'WH: GROUP_RECORDS: ',\@_);
172 171
  my %matchers = (
173 172
    requirement_specs        => sub { (ref($_[0]) eq 'SL::DB::RequirementSpec')                                         },
174
    shop_orders              => sub { (ref($_[0]) eq 'SL::DB::ShopOrder')                                               },
173
    shop_orders              => sub { (ref($_[0]) eq 'SL::DB::ShopOrder')       &&  $_[0]->id                           },
175 174
    sales_quotations         => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_quotation')   },
176 175
    sales_orders             => sub { (ref($_[0]) eq 'SL::DB::Order')           &&  $_[0]->is_type('sales_order')       },
177 176
    sales_delivery_orders    => sub { (ref($_[0]) eq 'SL::DB::DeliveryOrder')   &&  $_[0]->is_sales                     },
......
235 234

  
236 235
sub _shop_order_list {
237 236
  my ($self, $list, %params) = @_;
238
$main::lxdebug->dump(0, 'WH: ORDER_LIST: ',\@_);
237

  
239 238
  return $self->record_list(
240 239
    $list,
241 240
    title   => $::locale->text('Shop Orders'),
242 241
    type    => 'shop_order',
243 242
    columns => [
244
      [ $::locale->text('Shop Order Date'),         'order_date'                                                              ],
245
      [ $::locale->text('Shop Order Number'),        sub { $self->shop_order($_[0], display => 'table-cell') }                 ],
246
      [ $::locale->text('Transfer Date'),           'transfer_date'                                                            ],
247
      #     [ $::locale->text('Customer'),                'customer'                                                                 ],
248
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
249
      #[ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
250
      #[ $::locale->text('Project'),                 'globalproject', ],
251
      #[ $::locale->text('Closed'),                  'closed'                                                                   ],
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'                                                        ],
252 247
    ],
253 248
    %params,
254 249
  );
......
262 257
    title   => $::locale->text('Sales Quotations'),
263 258
    type    => 'sales_quotation',
264 259
    columns => [
265
      [ $::locale->text('Quotation Date'),          'transdate'                                                                ],
266
      [ $::locale->text('Quotation Number'),        sub { $self->sales_quotation($_[0], display => 'table-cell') }   ],
267
      [ $::locale->text('Customer'),                'customer'                                                                 ],
268
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
269
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
270
      [ $::locale->text('Project'),                 'globalproject', ],
271
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
260
      [ $::locale->text('Quotation Date'),          'transdate'                                                     ],
261
      [ $::locale->text('Quotation Number'),        sub { $self->sales_quotation($_[0], display => 'table-cell') }  ],
262
      [ $::locale->text('Customer'),                'customer'                                                      ],
263
      [ $::locale->text('Amount'),                  'amount'                                                        ],
264
      [ $::locale->text('Transaction description'), 'transaction_description'                                       ],
265
      [ $::locale->text('Project'),                 'globalproject',                                                ],
266
      [ $::locale->text('Closed'),                  'closed'                                                        ],
272 267
    ],
273 268
    %params,
274 269
  );
......
282 277
    title   => $::locale->text('Request Quotations'),
283 278
    type    => 'request_quotation',
284 279
    columns => [
285
      [ $::locale->text('Quotation Date'),          'transdate'                                                                ],
286
      [ $::locale->text('Quotation Number'),        sub { $self->request_quotation($_[0], display => 'table-cell') }   ],
287
      [ $::locale->text('Vendor'),                  'vendor'                                                                   ],
288
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
289
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
290
      [ $::locale->text('Project'),                 'globalproject', ],
291
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
280
      [ $::locale->text('Quotation Date'),          'transdate'                                                      ],
281
      [ $::locale->text('Quotation Number'),        sub { $self->request_quotation($_[0], display => 'table-cell') } ],
282
      [ $::locale->text('Vendor'),                  'vendor'                                                         ],
283
      [ $::locale->text('Net amount'),              'netamount'                                                      ],
284
      [ $::locale->text('Transaction description'), 'transaction_description'                                        ],
285
      [ $::locale->text('Project'),                 'globalproject',                                                 ],
286
      [ $::locale->text('Closed'),                  'closed'                                                         ],
292 287
    ],
293 288
    %params,
294 289
  );
......
302 297
    title   => $::locale->text('Sales Orders'),
303 298
    type    => 'sales_order',
304 299
    columns => [
305
      [ $::locale->text('Order Date'),              'transdate'                                                                ],
306
      [ $::locale->text('Order Number'),            sub { $self->sales_order($_[0], display => 'table-cell') }   ],
307
      [ $::locale->text('Quotation'),               'quonumber' ],
308
      [ $::locale->text('Customer'),                'customer'                                                                 ],
309
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
310
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
311
      [ $::locale->text('Project'),                 'globalproject', ],
312
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
300
      [ $::locale->text('Order Date'),              'transdate'                                                      ],
301
      [ $::locale->text('Order Number'),            sub { $self->sales_order($_[0], display => 'table-cell') }       ],
302
      [ $::locale->text('Quotation'),               'quonumber'                                                      ],
303
      [ $::locale->text('Customer'),                'customer'                                                       ],
304
      [ $::locale->text('Amount'),                  'amount'                                                         ],
305
      [ $::locale->text('Transaction description'), 'transaction_description'                                        ],
306
      [ $::locale->text('Project'),                 'globalproject',                                                 ],
307
      [ $::locale->text('Closed'),                  'closed'                                                         ],
313 308
    ],
314 309
    %params,
315 310
  );
......
323 318
    title   => $::locale->text('Purchase Orders'),
324 319
    type    => 'purchase_order',
325 320
    columns => [
326
      [ $::locale->text('Order Date'),              'transdate'                                                                ],
321
      [ $::locale->text('Order Date'),              'transdate'                                                     ],
327 322
      [ $::locale->text('Order Number'),            sub { $self->purchase_order($_[0], display => 'table-cell') }   ],
328
      [ $::locale->text('Request for Quotation'),   'quonumber' ],
329
      [ $::locale->text('Vendor'),                  'vendor'                                                                 ],
330
      [ $::locale->text('Net amount'),              'netamount'                                                                ],
331
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
332
      [ $::locale->text('Project'),                 'globalproject', ],
333
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
323
      [ $::locale->text('Request for Quotation'),   'quonumber'                                                     ],
324
      [ $::locale->text('Vendor'),                  'vendor'                                                        ],
325
      [ $::locale->text('Net amount'),              'netamount'                                                     ],
326
      [ $::locale->text('Transaction description'), 'transaction_description'                                       ],
327
      [ $::locale->text('Project'),                 'globalproject',                                                ],
328
      [ $::locale->text('Closed'),                  'closed'                                                        ],
334 329
    ],
335 330
    %params,
336 331
  );
......
344 339
    title   => $::locale->text('Sales Delivery Orders'),
345 340
    type    => 'sales_delivery_order',
346 341
    columns => [
347
      [ $::locale->text('Delivery Order Date'),     'transdate'                                                                ],
342
      [ $::locale->text('Delivery Order Date'),     'transdate'                                                         ],
348 343
      [ $::locale->text('Delivery Order Number'),   sub { $self->sales_delivery_order($_[0], display => 'table-cell') } ],
349
      [ $::locale->text('Order Number'),            'ordnumber' ],
350
      [ $::locale->text('Customer'),                'customer'                                                                 ],
351
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
352
      [ $::locale->text('Project'),                 'globalproject', ],
353
      [ $::locale->text('Delivered'),               'delivered'                                                                ],
354
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
344
      [ $::locale->text('Order Number'),            'ordnumber'                                                         ],
345
      [ $::locale->text('Customer'),                'customer'                                                          ],
346
      [ $::locale->text('Transaction description'), 'transaction_description'                                           ],
347
      [ $::locale->text('Project'),                 'globalproject',                                                    ],
348
      [ $::locale->text('Delivered'),               'delivered'                                                         ],
349
      [ $::locale->text('Closed'),                  'closed'                                                            ],
355 350
    ],
356 351
    %params,
357 352
  );
......
365 360
    title   => $::locale->text('Purchase Delivery Orders'),
366 361
    type    => 'purchase_delivery_order',
367 362
    columns => [
368
      [ $::locale->text('Delivery Order Date'),     'transdate'                                                                ],
363
      [ $::locale->text('Delivery Order Date'),     'transdate'                                                            ],
369 364
      [ $::locale->text('Delivery Order Number'),   sub { $self->purchase_delivery_order($_[0], display => 'table-cell') } ],
370
      [ $::locale->text('Order Number'),            'ordnumber' ],
371
      [ $::locale->text('Vendor'),                  'vendor'                                                                 ],
372
      [ $::locale->text('Transaction description'), 'transaction_description'                                                  ],
373
      [ $::locale->text('Project'),                 'globalproject', ],
374
      [ $::locale->text('Delivered'),               'delivered'                                                                ],
375
      [ $::locale->text('Closed'),                  'closed'                                                                   ],
365
      [ $::locale->text('Order Number'),            'ordnumber'                                                            ],
366
      [ $::locale->text('Vendor'),                  'vendor'                                                               ],
367
      [ $::locale->text('Transaction description'), 'transaction_description'                                              ],
368
      [ $::locale->text('Project'),                 'globalproject',                                                       ],
369
      [ $::locale->text('Delivered'),               'delivered'                                                            ],
370
      [ $::locale->text('Closed'),                  'closed'                                                               ],
376 371
    ],
377 372
    %params,
378 373
  );
......
386 381
    title   => $::locale->text('Sales Invoices'),
387 382
    type    => 'sales_invoice',
388 383
    columns => [
389
      [ $::locale->text('Invoice Date'),            'transdate'               ],
390
      [ $::locale->text('Type'),                    sub { $_[0]->displayable_type } ],
384
      [ $::locale->text('Invoice Date'),            'transdate'                                                  ],
385
      [ $::locale->text('Type'),                    sub { $_[0]->displayable_type }                              ],
391 386
      [ $::locale->text('Invoice Number'),          sub { $self->sales_invoice($_[0], display => 'table-cell') } ],
392
      [ $::locale->text('Quotation Number'),        'quonumber' ],
393
      [ $::locale->text('Order Number'),            'ordnumber' ],
394
      [ $::locale->text('Customer'),                'customer'                ],
395
      [ $::locale->text('Net amount'),              'netamount'               ],
396
      [ $::locale->text('Paid'),                    'paid'                    ],
397
      [ $::locale->text('Transaction description'), 'transaction_description' ],
387
      [ $::locale->text('Quotation Number'),        'quonumber'                                                  ],
388
      [ $::locale->text('Order Number'),            'ordnumber'                                                  ],
389
      [ $::locale->text('Customer'),                'customer'                                                   ],
390
      [ $::locale->text('Amount'),                  'amount'                                                     ],
391
      [ $::locale->text('Paid'),                    'paid'                                                       ],
392
      [ $::locale->text('Transaction description'), 'transaction_description'                                    ],
398 393
    ],
399 394
    %params,
400 395
  );
SL/Presenter/ShopOrder.pm
18 18

  
19 19
  my $text = join '', (
20 20
    $params{no_link} ? '' : '<a href="controller.pl?action=ShopOrder/show&amp;id='.$self->escape($shop_order->id).'">',
21
    $self->escape($shop_order->id),
21
    $self->escape($shop_order->shop_ordernumber),
22 22
    $params{no_link} ? '' : '</a>',
23 23
  );
24 24
  return $self->escaped_text($text);

Auch abrufbar als: Unified diff