Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7ac17a23

Von Tamino Steinert vor fast 2 Jahren hinzugefügt

  • ID 7ac17a232bc54c8c6882416e60159ff07a59b0a8
  • Vorgänger c1808a62
  • Nachfolger 8522a85e

Workflow: delivery_order ↔ reclamation

Unterschiede anzeigen:

bin/mozilla/do.pl
121 121
  $main::lxdebug->leave_sub();
122 122
}
123 123

  
124
sub add_from_reclamation {
125

  
126
  require SL::DB::Reclamation;
127
  my $reclamation = SL::DB::Reclamation->new(id => $::form->{from_id})->load;
128
  my ($delivery_order, $error) = $reclamation->convert_to_delivery_order();
129
  if($error) {
130
    croak("Error while converting: " . $error);
131
  }
132

  
133
  # edit new saved delivery order
134
  $::form->{id} = $delivery_order->id;
135
  edit();
136
}
137

  
124 138
sub edit {
125 139
  $main::lxdebug->enter_sub();
126 140

  
......
369 383

  
370 384
      'separator',
371 385

  
372
      action => [
373
        t8('Invoice'),
374
        submit => [ '#form', { action => "invoice" } ],
375
        disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef,
376
        confirm  => $::form->{delivered}                                                                         ? undef
377
                  : ($::form->{vc} eq 'customer' && $::instance_conf->get_sales_delivery_order_check_stocked)    ? t8('This record has not been stocked out. Proceed?')
378
                  : ($::form->{vc} eq 'vendor'   && $::instance_conf->get_purchase_delivery_order_check_stocked) ? t8('This record has not been stocked in. Proceed?')
379
                  :                                                                                                undef,
386
      combobox => [
387
        action => [ t8('Workflow') ],
388
        action => [
389
          t8('Invoice'),
390
          submit => [ '#form', { action => "invoice" } ],
391
          disabled => !$::form->{id} ? t8('This record has not been saved yet.') : undef,
392
          confirm  => $::form->{delivered}                                                                         ? undef
393
                    : ($::form->{vc} eq 'customer' && $::instance_conf->get_sales_delivery_order_check_stocked)    ? t8('This record has not been stocked out. Proceed?')
394
                    : ($::form->{vc} eq 'vendor'   && $::instance_conf->get_purchase_delivery_order_check_stocked) ? t8('This record has not been stocked in. Proceed?')
395
                    :                                                                                                undef,
396
        ],
397
        action => [
398
          t8('Save and Reclamation'),
399
          submit => [ '#form', { action => "save_and_reclamation" } ],
400
        ],
380 401
      ],
381 402

  
382 403
      combobox => [
......
1319 1340
  $main::lxdebug->leave_sub();
1320 1341
}
1321 1342

  
1343
sub save_and_reclamation {
1344
  my $form     = $main::form;
1345
  my $type     = $form->{type};
1346

  
1347
  # save the delivery order
1348
  save(no_redirect => 1);
1349

  
1350
  my $to_reclamation_type =
1351
    $type eq 'sales_delivery_order' ? 'sales_reclamation'
1352
                                    : 'purchase_reclamation';
1353
  $form->{callback} =
1354
    'controller.pl?action=Reclamation/add_from_delivery_order' .
1355
    '&type=' . $to_reclamation_type .
1356
    '&from_id=' . $form->escape($form->{id});
1357
  $form->redirect;
1358
}
1359

  
1322 1360
sub save_as_new {
1323 1361
  $main::lxdebug->enter_sub();
1324 1362

  

Auch abrufbar als: Unified diff