Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5be16084

Von Sven Schöling vor fast 3 Jahren hinzugefügt

  • ID 5be160844da9f03e9b95fec066418a99832d8cca
  • Vorgänger ea402a2c
  • Nachfolger 25af3ac6

DeliveryOrder: package, namespace, template und controller referenzen angepasst

Unterschiede anzeigen:

js/kivi.DeliveryOrder.js
1
namespace('kivi.Order', function(ns) {
1
namespace('kivi.DeliveryOrder', function(ns) {
2 2
  ns.check_cv = function() {
3
    if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation') {
3
    if ($('#type').val() == 'sales_delivery_order') {
4 4
      if ($('#order_customer_id').val() === '') {
5 5
        alert(kivi.t8('Please select a customer.'));
6 6
        return false;
......
51 51
    if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
52 52

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

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

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

  
63 63
    $.post("controller.pl", data, kivi.eval_json_result);
64 64
  };
......
83 83

  
84 84
    var data = $('#order_form').serializeArray();
85 85
    data = data.concat($('#print_options_form').serializeArray());
86
    data.push({ name: 'action', value: 'Order/print' });
86
    data.push({ name: 'action', value: 'DeliveryOrder/print' });
87 87

  
88 88
    $.post("controller.pl", data, kivi.eval_json_result);
89 89
  };
......
115 115
      height: 600,
116 116
      title:  kivi.t8('Send email'),
117 117
      modal:  true,
118
      beforeClose: kivi.Order.finish_send_email_dialog,
118
      beforeClose: kivi.DeliveryOrder.finish_send_email_dialog,
119 119
      close: function(event, ui) {
120 120
        email_dialog.remove();
121 121
      }
......
127 127
    email_dialog.html(html);
128 128
    email_dialog.dialog(dialog_params);
129 129

  
130
    kivi.Order.setup_send_email_dialog();
130
    kivi.DeliveryOrder.setup_send_email_dialog();
131 131

  
132 132
    $('.cancel').click(ns.close_email_dialog);
133 133

  
......
141 141
    var data = $('#order_form').serializeArray();
142 142
    data = data.concat($('[name^="email_form."]').serializeArray());
143 143
    data = data.concat($('[name^="print_options."]').serializeArray());
144
    data.push({ name: 'action', value: 'Order/send_email' });
144
    data.push({ name: 'action', value: 'DeliveryOrder/send_email' });
145 145
    $.post("controller.pl", data, kivi.eval_json_result);
146 146
  };
147 147

  
......
162 162
  ns.reload_cv_dependent_selections = function() {
163 163
    $('#order_shipto_id').val('');
164 164
    var data = $('#order_form').serializeArray();
165
    data.push({ name: 'action', value: 'Order/customer_vendor_changed' });
165
    data.push({ name: 'action', value: 'DeliveryOrder/customer_vendor_changed' });
166 166

  
167 167
    $.post("controller.pl", data, kivi.eval_json_result);
168 168
  };
......
196 196
    }
197 197

  
198 198
    var data = $('#order_form').serializeArray();
199
    data.push({ name: 'action', value: 'Order/update_exchangerate' });
199
    data.push({ name: 'action', value: 'DeliveryOrder/update_exchangerate' });
200 200

  
201 201
    $.ajax({
202 202
      url: 'controller.pl',
......
243 243
    $(select_elt).data('oldval', $(select_elt).val());
244 244

  
245 245
    var data = $('#order_form').serializeArray();
246
    data.push({ name: 'action',           value: 'Order/unit_changed'     },
246
    data.push({ name: 'action',           value: 'DeliveryOrder/unit_changed'     },
247 247
              { name: 'item_id',          value: item_id_dom.val()        },
248 248
              { name: 'old_unit',         value: oldval                   },
249 249
              { name: 'sellprice_dom_id', value: sellprice_dom.attr('id') });
......
267 267
      return;
268 268
    }
269 269
    var data = $('#order_form').serializeArray();
270
    data.push({ name: 'action',     value: 'Order/load_second_rows' },
270
    data.push({ name: 'action',     value: 'DeliveryOrder/load_second_rows' },
271 271
              { name: 'item_ids[]', value: item_id_dom.val()        });
272 272

  
273 273
    $.post("controller.pl", data, kivi.eval_json_result);
......
288 288
    }
289 289

  
290 290
    var data = $('#order_form').serializeArray();
291
    data.push({ name: 'action', value: 'Order/load_second_rows' });
291
    data.push({ name: 'action', value: 'DeliveryOrder/load_second_rows' });
292 292
    data = data.concat(item_ids);
293 293

  
294 294
    $.post("controller.pl", data, kivi.eval_json_result);
......
409 409
    $('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
410 410

  
411 411
    var data = $('#order_form').serializeArray();
412
    data.push({ name: 'action',   value: 'Order/reorder_items' },
412
    data.push({ name: 'action',   value: 'DeliveryOrder/reorder_items' },
413 413
              { name: 'order_by', value: order_by              },
414 414
              { name: 'sort_dir', value: dir                   });
415 415

  
......
451 451
    var insert_before_item_id = ns.get_insert_before_item_id($('#add_item_position').val());
452 452

  
453 453
    var data = $('#order_form').serializeArray();
454
    data.push({ name: 'action', value: 'Order/add_item' },
454
    data.push({ name: 'action', value: 'DeliveryOrder/add_item' },
455 455
              { name: 'insert_before_item_id', value: insert_before_item_id });
456 456

  
457 457
    $.post("controller.pl", data, kivi.eval_json_result);
......
468 468
  ns.add_multi_items = function(data) {
469 469
    var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val());
470 470
    data = data.concat($('#order_form').serializeArray());
471
    data.push({ name: 'action', value: 'Order/add_multi_items' },
471
    data.push({ name: 'action', value: 'DeliveryOrder/add_multi_items' },
472 472
              { name: 'insert_before_item_id', value: insert_before_item_id });
473 473
    $.post("controller.pl", data, kivi.eval_json_result);
474 474
  };
......
510 510
    var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
511 511

  
512 512
    var data = $('#order_form').serializeArray();
513
    data.push({ name: 'action',  value: 'Order/price_popup' },
513
    data.push({ name: 'action',  value: 'DeliveryOrder/price_popup' },
514 514
              { name: 'item_id', value: item_id_dom.val()   });
515 515

  
516 516
    $.post("controller.pl", data, kivi.eval_json_result);
......
533 533

  
534 534
    kivi.popup_dialog({
535 535
      url:    'controller.pl',
536
      data:   { action: 'Order/show_customer_vendor_details_dialog',
536
      data:   { action: 'DeliveryOrder/show_customer_vendor_details_dialog',
537 537
                type  : $('#type').val(),
538 538
                vc    : vc,
539 539
                vc_id : vc_id
......
553 553
    var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
554 554

  
555 555
    var data = $('#order_form').serializeArray();
556
    data.push({ name: 'action', value: 'Order/update_row_from_master_data' });
556
    data.push({ name: 'action', value: 'DeliveryOrder/update_row_from_master_data' });
557 557
    data.push({ name: 'item_ids[]', value: item_id_dom.val() });
558 558

  
559 559
    $.post("controller.pl", data, kivi.eval_json_result);
......
570 570
    }
571 571

  
572 572
    var data = $('#order_form').serializeArray();
573
    data.push({ name: 'action', value: 'Order/update_row_from_master_data' });
573
    data.push({ name: 'action', value: 'DeliveryOrder/update_row_from_master_data' });
574 574
    data = data.concat(item_ids);
575 575

  
576 576
    $.post("controller.pl", data, kivi.eval_json_result);
......
593 593

  
594 594
  ns.purchase_order_check_for_direct_delivery = function() {
595 595
    if ($('#type').val() != 'sales_order') {
596
      kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
596
      kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
597 597
    }
598 598

  
599 599
    var empty = true;
......
623 623
    if (!empty) {
624 624
      ns.direct_delivery_dialog(shipto);
625 625
    } else {
626
      kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
626
      kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
627 627
    }
628 628
  };
629 629

  
......
634 634
      $('<input type="hidden" name="use_shipto">').appendTo('#order_form').val('1');
635 635
    }
636 636

  
637
    kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
637
    kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
638 638
  };
639 639

  
640 640
  ns.direct_delivery_dialog = function(shipto) {
......
644 644
    var text2 = kivi.t8('Do you want to carry this shipping address over to the new purchase order so that the vendor can deliver the goods directly to your customer?');
645 645
    var html  = '<div id="direct-delivery-dialog"><p>' + text1 + '</p><p>' + shipto + '</p><p>' + text2 + '</p>';
646 646
    html      = html + '<hr><p>';
647
    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Order.direct_delivery_callback(true)">';
647
    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.DeliveryOrder.direct_delivery_callback(true)">';
648 648
    html      = html + '&nbsp;';
649
    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.Order.direct_delivery_callback(false)">';
649
    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.DeliveryOrder.direct_delivery_callback(false)">';
650 650
    html      = html + '</p></div>';
651 651
    $(html).hide().appendTo('#order_form');
652 652

  
......
696 696

  
697 697
  ns.create_part = function() {
698 698
    var data = $('#order_form').serializeArray();
699
    data.push({ name: 'action', value: 'Order/create_part' });
699
    data.push({ name: 'action', value: 'DeliveryOrder/create_part' });
700 700

  
701 701
    $.post("controller.pl", data, kivi.eval_json_result);
702 702
  };
......
705 705

  
706 706
$(function() {
707 707
  if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
708
    $('#order_customer_id').change(kivi.Order.reload_cv_dependent_selections);
708
    $('#order_customer_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
709 709
  } else {
710
    $('#order_vendor_id').change(kivi.Order.reload_cv_dependent_selections);
710
    $('#order_vendor_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
711 711
  }
712 712

  
713
  $('#order_currency_id').change(kivi.Order.update_exchangerate);
714
  $('#order_transdate_as_date').change(kivi.Order.update_exchangerate);
715
  $('#order_exchangerate_as_null_number').change(kivi.Order.exchangerate_changed);
713
  $('#order_currency_id').change(kivi.DeliveryOrder.update_exchangerate);
714
  $('#order_transdate_as_date').change(kivi.DeliveryOrder.update_exchangerate);
715
  $('#order_exchangerate_as_null_number').change(kivi.DeliveryOrder.exchangerate_changed);
716 716

  
717 717
  if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
718 718
    $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
......
725 725
  $('.add_item_input').keydown(function(event) {
726 726
    if (event.keyCode == 13) {
727 727
      event.preventDefault();
728
      kivi.Order.add_item();
728
      kivi.DeliveryOrder.add_item();
729 729
      return false;
730 730
    }
731 731
  });
732 732

  
733
  kivi.Order.init_row_handlers();
733
  kivi.DeliveryOrder.init_row_handlers();
734 734

  
735 735
  $('#row_table_id').on('sortstop', function(event, ui) {
736 736
    $('#row_table_id thead a img').remove();
737
    kivi.Order.renumber_positions();
737
    kivi.DeliveryOrder.renumber_positions();
738 738
  });
739 739

  
740 740
  $('#expand_all').on('click', function(event) {
......
745 745
      $('#expand_all').attr('alt', kivi.t8('Show all details'));
746 746
      $('#expand_all').attr('title', kivi.t8('Show all details'));
747 747
      $('.row_entry').each(function(idx, elt) {
748
        kivi.Order.hide_second_row(elt);
748
        kivi.DeliveryOrder.hide_second_row(elt);
749 749
      });
750 750
    } else {
751 751
      $('#expand_all').data('expanded', 1);
752 752
      $('#expand_all').attr('src', "image/collapse.svg");
753 753
      $('#expand_all').attr('alt', kivi.t8('Hide all details'));
754 754
      $('#expand_all').attr('title', kivi.t8('Hide all details'));
755
      kivi.Order.load_all_second_rows();
755
      kivi.DeliveryOrder.load_all_second_rows();
756 756
      $('.row_entry').each(function(idx, elt) {
757
        kivi.Order.show_second_row(elt);
757
        kivi.DeliveryOrder.show_second_row(elt);
758 758
      });
759 759
    }
760 760
    return false;
761 761
  });
762 762

  
763
  $('.reformat_number_as_null_number').change(kivi.Order.reformat_number_as_null_number);
763
  $('.reformat_number_as_null_number').change(kivi.DeliveryOrder.reformat_number_as_null_number);
764 764

  
765 765
});

Auch abrufbar als: Unified diff