Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 69966b4c

Von Bernd Bleßmann vor mehr als 6 Jahren hinzugefügt

  • ID 69966b4c3df791edabe5e7265010293efbba18ed
  • Vorgänger f747a789
  • Nachfolger 552ed9ba

Auftrags-Controller: Workflow Auftrag VK <-> EK

Unterschiede anzeigen:

SL/Controller/Order.pm
1367 1367

  
1368 1368
  my $destination_type = $::form->{type} eq _sales_quotation_type()   ? _sales_order_type()
1369 1369
                       : $::form->{type} eq _request_quotation_type() ? _purchase_order_type()
1370
                       : $::form->{type} eq _purchase_order_type()    ? _sales_order_type()
1371
                       : $::form->{type} eq _sales_order_type()       ? _purchase_order_type()
1370 1372
                       : '';
1371 1373

  
1372 1374
  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
......
1379 1381

  
1380 1382
  # change form type
1381 1383
  $::form->{type} = $destination_type;
1382
  $self->init_type;
1384
  $self->type($self->init_type);
1385
  $self->cv  ($self->init_cv);
1383 1386
  $self->_check_auth;
1384 1387

  
1385 1388
  $self->_recalc();
......
1498 1501
        action => [
1499 1502
          t8('Sales Order'),
1500 1503
          submit   => [ '#order_form', { action => "Order/sales_order" } ],
1501
          only_if  => (any { $self->type eq $_ } (_sales_quotation_type())),
1504
          only_if  => (any { $self->type eq $_ } (_sales_quotation_type(), _purchase_order_type())),
1502 1505
          disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
1503 1506
        ],
1504 1507
        action => [
1505 1508
          t8('Purchase Order'),
1506 1509
          submit   => [ '#order_form', { action => "Order/purchase_order" } ],
1507
          only_if  => (any { $self->type eq $_ } (_request_quotation_type())),
1510
          only_if  => (any { $self->type eq $_ } (_sales_order_type(), _request_quotation_type())),
1508 1511
          disabled => !$self->order->id ? t8('This object has not been saved yet.') : undef,
1509 1512
        ],
1510 1513
      ], # end of combobox "Workflow"
......
1823 1826

  
1824 1827
=item * custom shipto address
1825 1828

  
1829
=item * check for direct delivery (workflow sales order -> purchase order)
1830

  
1826 1831
=item * language / part translations
1827 1832

  
1828 1833
=item * access rights
SL/DB/Order.pm
214 214
    { from => 'sales_order',       to => 'sales_order',       abbr => 'soso' },
215 215
    { from => 'request_quotation', to => 'request_quotation', abbr => 'rqrq' },
216 216
    { from => 'purchase_order',    to => 'purchase_order',    abbr => 'popo' },
217
    { from => 'sales_order',       to => 'purchase_order',    abbr => 'sopo' },
218
    { from => 'purchase_order',    to => 'sales_order',       abbr => 'poso' },
217 219
  );
218 220
  my $from_to = (grep { $_->{from} eq $source->type && $_->{to} eq $destination_type} @from_tos)[0];
219 221
  croak("Cannot convert from '" . $source->type . "' to '" . $destination_type . "'") if !$from_to;
220 222

  
223
  my $is_abbr_any = sub {
224
    # foreach my $abbr (@_) {
225
    #   croak "no such abbreviation: '$abbr'" if !grep { $_->{abbr} eq $abbr } @from_tos;
226
    # }
227
    any { $from_to->{abbr} eq $_ } @_;
228
  };
229

  
221 230
  my ($item_parent_id_column, $item_parent_column);
222 231

  
223 232
  if (ref($source) eq 'SL::DB::Order') {
......
236 245
               transdate => DateTime->today_local,
237 246
            );
238 247

  
248
  if ( $is_abbr_any->(qw(sopo poso)) ) {
249
    $args{ordnumber} = undef;
250
    $args{reqdate}   = DateTime->today_local->next_workday();
251
    $args{employee}  = SL::DB::Manager::Employee->current;
252
  }
253
  if ( $is_abbr_any->(qw(sopo)) ) {
254
    $args{customer_id}      = undef;
255
    $args{salesman_id}      = undef;
256
    $args{payment_id}       = undef;
257
    $args{delivery_term_id} = undef;
258
  }
259
  if ( $is_abbr_any->(qw(poso)) ) {
260
    $args{vendor_id} = undef;
261
  }
262

  
239 263
  # Custom shipto addresses (the ones specific to the sales/purchase
240 264
  # record and not to the customer/vendor) are only linked from
241 265
  # shipto → order. Meaning order.shipto_id
......
269 293
                                                     )),
270 294
                                                 custom_variables => \@custom_variables,
271 295
    );
296
    if ( $is_abbr_any->(qw(sopo)) ) {
297
      $current_oe_item->sellprice($source_item->lastcost);
298
      $current_oe_item->discount(0);
299
    }
300
    if ( $is_abbr_any->(qw(poso)) ) {
301
      $current_oe_item->lastcost($source_item->sellprice);
302
    }
272 303
    $current_oe_item->{"converted_from_orderitems_id"} = $_->{id} if ref($item_parent) eq 'SL::DB::Order';
273 304
    $current_oe_item;
274 305
  } @{ $items };
js/kivi.Order.js
450 450
  };
451 451

  
452 452
  ns.price_chooser_item_row = function(clicked) {
453
    if (!ns.check_cv()) return;
453 454
    var row = $(clicked).parents("tbody").first();
454 455
    var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
455 456

  

Auch abrufbar als: Unified diff