Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 06806380

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

  • ID 068063804d2061fe26e70f7bfdba2a99c18d935a
  • Vorgänger 00c3a0ed
  • Nachfolger eb474565

Auftrags-Controller: Mini-Refactoring: js-save-Funktionen zusammengefasst

Unterschiede anzeigen:

SL/Controller/Order.pm
1395 1395
      combobox => [
1396 1396
        action => [
1397 1397
          t8('Save'),
1398
          call      => [ 'kivi.Order.save', $::instance_conf->get_order_warn_duplicate_parts ],
1398
          call      => [ 'kivi.Order.save', 'save', $::instance_conf->get_order_warn_duplicate_parts ],
1399 1399
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1400 1400
        ],
1401 1401
        action => [
1402 1402
          t8('Save as new'),
1403
          call      => [ 'kivi.Order.save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
1403
          call      => [ 'kivi.Order.save', 'save_as_new', $::instance_conf->get_order_warn_duplicate_parts ],
1404 1404
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1405 1405
          disabled  => !$self->order->id ? t8('This object has not been saved yet.') : undef,
1406 1406
        ],
1407 1407
        action => [
1408 1408
          t8('Save and Delivery Order'),
1409
          call      => [ 'kivi.Order.save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
1409
          call      => [ 'kivi.Order.save', 'save_and_delivery_order', $::instance_conf->get_order_warn_duplicate_parts ],
1410 1410
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1411 1411
          only_if   => (any { $self->type eq $_ } (_sales_order_type(), _purchase_order_type()))
1412 1412
        ],
1413 1413
        action => [
1414 1414
          t8('Save and Invoice'),
1415
          call      => [ 'kivi.Order.save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
1415
          call      => [ 'kivi.Order.save', 'save_and_invoice', $::instance_conf->get_order_warn_duplicate_parts ],
1416 1416
          checks    => [ 'kivi.Order.check_save_active_periodic_invoices' ],
1417 1417
        ],
1418 1418
      ], # end of combobox "Save"
js/kivi.Order.js
35 35
    return true;
36 36
  };
37 37

  
38
  ns.save = function(warn_on_duplicates) {
38
  ns.save = function(action, warn_on_duplicates) {
39 39
    if (!ns.check_cv()) return;
40 40
    if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
41 41

  
42 42
    var data = $('#order_form').serializeArray();
43
    data.push({ name: 'action', value: 'Order/save' });
44

  
45
    $.post("controller.pl", data, kivi.eval_json_result);
46
  };
47

  
48
  ns.save_as_new = function(warn_on_duplicates) {
49
    if (!ns.check_cv()) return;
50
    if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
51

  
52
    var data = $('#order_form').serializeArray();
53
    data.push({ name: 'action', value: 'Order/save_as_new' });
54

  
55
    $.post("controller.pl", data, kivi.eval_json_result);
56
  };
57

  
58
  ns.save_and_delivery_order = 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_delivery_order' });
64

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

  
68
  ns.save_and_invoice = function(warn_on_duplicates) {
69
    if (!ns.check_cv()) return;
70
    if (warn_on_duplicates && !ns.check_save_duplicate_parts()) return;
71

  
72
    var data = $('#order_form').serializeArray();
73
    data.push({ name: 'action', value: 'Order/save_and_invoice' });
43
    data.push({ name: 'action', value: 'Order/' + action });
74 44

  
75 45
    $.post("controller.pl", data, kivi.eval_json_result);
76 46
  };

Auch abrufbar als: Unified diff