Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 07dd84c0

Von Bernd Bleßmann vor fast 7 Jahren hinzugefügt

  • ID 07dd84c04c1208d618ff007afaa24ad0074add31
  • Vorgänger fdebfd5d
  • Nachfolger 78e36cfd

Auftrags-Controller: Workflow -> Rechnung (Speichern und Rechnung erfassen)

Unterschiede anzeigen:

SL/Controller/Order.pm
39 39
__PACKAGE__->run_before('_check_auth');
40 40

  
41 41
__PACKAGE__->run_before('_recalc',
42
                        only => [ qw(save save_and_delivery_order print create_pdf send_email) ]);
42
                        only => [ qw(save save_and_delivery_order save_and_invoice print create_pdf send_email) ]);
43 43

  
44 44
__PACKAGE__->run_before('_get_unalterable_data',
45
                        only => [ qw(save save_and_delivery_order print create_pdf send_email) ]);
45
                        only => [ qw(save save_and_delivery_order save_and_invoice print create_pdf send_email) ]);
46 46

  
47 47
#
48 48
# actions
......
340 340
  $self->redirect_to(@redirect_params);
341 341
}
342 342

  
343
# save the order and redirect to the frontend subroutine for a new
344
# invoice
345
sub action_save_and_invoice {
346
  my ($self) = @_;
347

  
348
  my $errors = $self->_save();
349

  
350
  if (scalar @{ $errors }) {
351
    $self->js->flash('error', $_) foreach @{ $errors };
352
    return $self->js->render();
353
  }
354
  flash_later('info', $::locale->text('The order has been saved'));
355

  
356
  my @redirect_params = (
357
    controller => 'oe.pl',
358
    action     => 'oe_invoice_from_order',
359
    id         => $self->order->id,
360
  );
361

  
362
  $self->redirect_to(@redirect_params);
363
}
364

  
343 365
# set form elements in respect to a changed customer or vendor
344 366
#
345 367
# This action is called on an change of the customer/vendor picker.
......
1123 1145
          t8('Save and Delivery Order'),
1124 1146
          call      => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
1125 1147
        ],
1148
        action => [
1149
          t8('Save and Invoice'),
1150
          call      => [ 'kivi.Order.save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
1151
        ],
1126 1152

  
1127 1153
      ], # end of combobox "Save"
1128 1154

  
......
1349 1375

  
1350 1376
=item * credit limit
1351 1377

  
1352
=item * more workflows (save as new / invoice)
1378
=item * more workflows (save as new, quotation, purchase order)
1353 1379

  
1354 1380
=item * price sources: little symbols showing better price / better discount
1355 1381

  
......
1450 1476

  
1451 1477
A warning when leaving the page without saveing unchanged inputs.
1452 1478

  
1479
=item *
1480

  
1481
Workflows for delivery order and invoice are in the menu "Save", because the
1482
order is saved before opening the new document form. Nevertheless perhaps these
1483
workflow buttons should be put under "Workflows".
1484

  
1485

  
1453 1486
=back
1454 1487

  
1455 1488
=head1 AUTHOR
bin/mozilla/oe.pl
2048 2048
  delivery_order();
2049 2049
}
2050 2050

  
2051
sub oe_invoice_from_order {
2052

  
2053
  return if !$::form->{id};
2054

  
2055
  my $order = SL::DB::Order->new(id => $::form->{id})->load;
2056
  $order->flatten_to_form($::form, format_amounts => 1);
2057

  
2058
  # fake last empty row
2059
  $::form->{rowcount}++;
2060

  
2061
  invoice();
2062
}
2063

  
2051 2064
sub yes {
2052 2065
  call_sub($main::form->{yes_nextsub});
2053 2066
}
js/kivi.Order.js
55 55
    $.post("controller.pl", data, kivi.eval_json_result);
56 56
  };
57 57

  
58
  ns.save_and_invoice = function(warn_on_duplicates) {
59
    if (!ns.check_cv()) return;
60
    if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
61

  
62
    var data = $('#order_form').serializeArray();
63
    data.push({ name: 'action', value: 'Order/save_and_invoice' });
64

  
65
    $.post("controller.pl", data, kivi.eval_json_result);
66
  };
67

  
58 68
  ns.delete_order = function() {
59 69
    var data = $('#order_form').serializeArray();
60 70
    data.push({ name: 'action', value: 'Order/delete' });

Auch abrufbar als: Unified diff