Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 330c2119

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

  • ID 330c21190f7c7cb55d99bfc132a35633ea8d4a84
  • Vorgänger 995ea08d
  • Nachfolger 0ae21038

DeliveryOrder: package, namespace, template und controller referenzen angepasst

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1
package SL::Controller::Order;
1
package SL::Controller::DeliveryOrder;
2 2

  
3 3
use strict;
4 4
use parent qw(SL::Controller::Base);
......
77 77

  
78 78
  $self->pre_render();
79 79
  $self->render(
80
    'order/form',
80
    'delivery_order/form',
81 81
    title => $self->get_title_for('add'),
82 82
    %{$self->{template_args}}
83 83
  );
......
105 105

  
106 106
  $self->pre_render();
107 107
  $self->render(
108
    'order/form',
108
    'delivery_order/form',
109 109
    title => $self->get_title_for('edit'),
110 110
    %{$self->{template_args}}
111 111
  );
......
128 128

  
129 129
  # fall back to save as new if only one id is given
130 130
  if (scalar @multi_ids == 1) {
131
    $self->order(SL::DB::Order->new(id => $multi_ids[0])->load);
131
    $self->order(SL::DB::DeliveryOrder->new(id => $multi_ids[0])->load);
132 132
    $self->action_save_as_new();
133 133
    return;
134 134
  }
135 135

  
136 136
  # make new order from given orders
137
  my @multi_orders = map { SL::DB::Order->new(id => $_)->load } @multi_ids;
137
  my @multi_orders = map { SL::DB::DeliveryOrder->new(id => $_)->load } @multi_ids;
138 138
  $self->{converted_from_oe_id} = join ' ', map { $_->id } @multi_orders;
139
  $self->order(SL::DB::Order->new_from_multi(\@multi_orders, sort_sources_by => 'transdate'));
139
  $self->order(SL::DB::DeliveryOrder->new_from_multi(\@multi_orders, sort_sources_by => 'transdate'));
140 140

  
141 141
  $self->action_edit();
142 142
}
......
206 206
  }
207 207

  
208 208
  # load order from db to check if values changed
209
  my $saved_order = SL::DB::Order->new(id => $order->id)->load;
209
  my $saved_order = SL::DB::DeliveryOrder->new(id => $order->id)->load;
210 210

  
211 211
  my %new_attrs;
212 212
  # Lets assign a new number if the user hasn't changed the previous one.
......
239 239
  $new_attrs{employee}  = SL::DB::Manager::Employee->current;
240 240

  
241 241
  # Create new record from current one
242
  $self->order(SL::DB::Order->new_from($order, destination_type => $order->type, attributes => \%new_attrs));
242
  $self->order(SL::DB::DeliveryOrder->new_from($order, destination_type => $order->type, attributes => \%new_attrs));
243 243

  
244 244
  # no linked records on save as new
245 245
  delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
......
677 677
  $self->get_item_cvpartnumber($item);
678 678

  
679 679
  my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
680
  my $row_as_html = $self->p->render('order/tabs/_row',
680
  my $row_as_html = $self->p->render('delivery_order/tabs/_row',
681 681
                                     ITEM => $item,
682 682
                                     ID   => $item_id,
683 683
                                     SELF => $self,
......
707 707
      $self->order->add_items( $item );
708 708
      $self->get_item_cvpartnumber($item);
709 709
      my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
710
      my $row_as_html = $self->p->render('order/tabs/_row',
710
      my $row_as_html = $self->p->render('delivery_order/tabs/_row',
711 711
                                         ITEM => $item,
712 712
                                         ID   => $item_id,
713 713
                                         SELF => $self,
......
764 764
  foreach my $item (@items) {
765 765
    $self->get_item_cvpartnumber($item);
766 766
    my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
767
    my $row_as_html = $self->p->render('order/tabs/_row',
767
    my $row_as_html = $self->p->render('delivery_order/tabs/_row',
768 768
                                       ITEM => $item,
769 769
                                       ID   => $item_id,
770 770
                                       SELF => $self,
......
893 893
  $_->{render_longdescription} = 1 for @{ $self->order->items_sorted };
894 894

  
895 895
  $self->render(
896
    'order/form',
896
    'delivery_order/form',
897 897
    title => $self->get_title_for('edit'),
898 898
    %{$self->{template_args}}
899 899
  );
......
980 980
    $item->parse_custom_variable_values;
981 981
  }
982 982

  
983
  my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item, TYPE => $self->type);
983
  my $row_as_html = $self->p->render('delivery_order/tabs/_second_row', ITEM => $item, TYPE => $self->type);
984 984

  
985 985
  $self->js
986 986
    ->html('#second_row_' . $item_id, $row_as_html)
......
1171 1171
# Needed, if customer/vendor changed.
1172 1172
sub build_business_info_row
1173 1173
{
1174
  $_[0]->p->render('order/tabs/_business_info_row', SELF => $_[0]);
1174
  $_[0]->p->render('delivery_order/tabs/_business_info_row', SELF => $_[0]);
1175 1175
}
1176 1176

  
1177 1177

  
1178
sub render_price_dialog {
1179
  my ($self, $record_item) = @_;
1180

  
1181
  my $price_source = SL::PriceSource->new(record_item => $record_item, record => $self->order);
1182

  
1183
  $self->js
1184
    ->run(
1185
      'kivi.io.price_chooser_dialog',
1186
      t8('Available Prices'),
1187
      $self->render('order/tabs/_price_sources_dialog', { output => 0 }, price_source => $price_source)
1188
    )
1189
    ->reinit_widgets;
1190

  
1191
#   if (@errors) {
1192
#     $self->js->text('#dialog_flash_error_content', join ' ', @errors);
1193
#     $self->js->show('#dialog_flash_error');
1194
#   }
1195

  
1196
  $self->js->render;
1197
}
1198

  
1199 1178
sub load_order {
1200 1179
  my ($self) = @_;
1201 1180

  
1202 1181
  return if !$::form->{id};
1203 1182

  
1204
  $self->order(SL::DB::Order->new(id => $::form->{id})->load);
1183
  $self->order(SL::DB::DeliveryOrder->new(id => $::form->{id})->load);
1205 1184

  
1206 1185
  # Add an empty custom shipto to the order, so that the dialog can render the cvar inputs.
1207 1186
  # You need a custom shipto object to call cvars_by_config to get the cvars.
......
1223 1202
  # be retrieved via items until the order is saved. Adding empty items to new
1224 1203
  # order here solves this problem.
1225 1204
  my $order;
1226
  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
1227
  $order ||= SL::DB::Order->new(orderitems  => [],
1205
  $order   = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
1206
  $order ||= SL::DB::DeliveryOrder->new(orderitems  => [],
1228 1207
                                quotation   => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type())),
1229 1208
                                currency_id => $::instance_conf->get_currency_id(),);
1230 1209

  
......
1278 1257
  # add_custom_variables adds cvars to an orderitem with no cvars for saving, but
1279 1258
  # they cannot be retrieved via custom_variables until the order/orderitem is
1280 1259
  # saved. Adding empty custom_variables to new orderitem here solves this problem.
1281
  $item ||= SL::DB::OrderItem->new(custom_variables => []);
1260
  $item ||= SL::DB::DeliveryOrderItem->new(custom_variables => []);
1282 1261

  
1283 1262
  $item->assign_attributes(%$attr);
1284 1263

  
......
1298 1277
sub new_item {
1299 1278
  my ($record, $attr) = @_;
1300 1279

  
1301
  my $item = SL::DB::OrderItem->new;
1280
  my $item = SL::DB::DeliveryOrderItem->new;
1302 1281

  
1303 1282
  # Remove attributes where the user left or set the inputs empty.
1304 1283
  # So these attributes will be undefined and we can distinguish them
......
1461 1440
      $self->order->custom_shipto(undef);
1462 1441
    }
1463 1442

  
1464
    SL::DB::OrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
1443
    SL::DB::DeliveryOrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
1465 1444
    $self->order->save(cascade => 1);
1466 1445

  
1467 1446
    # link records
1468 1447
    if ($::form->{converted_from_oe_id}) {
1469 1448
      my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
1470 1449
      foreach my $converted_from_oe_id (@converted_from_oe_ids) {
1471
        my $src = SL::DB::Order->new(id => $converted_from_oe_id)->load;
1450
        my $src = SL::DB::DeliveryOrder->new(id => $converted_from_oe_id)->load;
1472 1451
        $src->update_attributes(closed => 1) if $src->type =~ /_quotation$/;
1473 1452
        $src->link_to_record($self->order);
1474 1453
      }
......
1508 1487

  
1509 1488
  my $destination_type = $::form->{type} eq sales_order_type() ? sales_quotation_type() : request_quotation_type();
1510 1489

  
1511
  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
1490
  $self->order(SL::DB::DeliveryOrder->new_from($self->order, destination_type => $destination_type));
1512 1491
  $self->{converted_from_oe_id} = delete $::form->{id};
1513 1492

  
1514 1493
  # set item ids to new fake id, to identify them as new items
......
1531 1510
  $_->{render_second_row} = 1 for @{ $self->order->items_sorted };
1532 1511

  
1533 1512
  $self->render(
1534
    'order/form',
1513
    'delivery_order/form',
1535 1514
    title => $self->get_title_for('edit'),
1536 1515
    %{$self->{template_args}}
1537 1516
  );
......
1559 1538
  my $custom_shipto;
1560 1539
  if (   $::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type()
1561 1540
      && $::form->{use_shipto} && $self->order->shipto) {
1562
    $custom_shipto = $self->order->shipto->clone('SL::DB::Order');
1541
    $custom_shipto = $self->order->shipto->clone('SL::DB::DeliveryOrder');
1563 1542
  }
1564 1543

  
1565
  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
1544
  $self->order(SL::DB::DeliveryOrder->new_from($self->order, destination_type => $destination_type));
1566 1545
  $self->{converted_from_oe_id} = delete $::form->{id};
1567 1546

  
1568 1547
  # set item ids to new fake id, to identify them as new items
......
1594 1573
  $_->{render_second_row} = 1 for @{ $self->order->items_sorted };
1595 1574

  
1596 1575
  $self->render(
1597
    'order/form',
1576
    'delivery_order/form',
1598 1577
    title => $self->get_title_for('edit'),
1599 1578
    %{$self->{template_args}}
1600 1579
  );
......
1695 1674
        ],
1696 1675
        action => [
1697 1676
          t8('Save and Quotation'),
1698
          submit   => [ '#order_form', { action => "Order/sales_quotation" } ],
1677
          submit   => [ '#order_form', { action => "DeliveryOrder/sales_quotation" } ],
1699 1678
          only_if  => (any { $self->type eq $_ } (sales_order_type())),
1700 1679
        ],
1701 1680
        action => [
1702 1681
          t8('Save and RFQ'),
1703
          submit   => [ '#order_form', { action => "Order/request_for_quotation" } ],
1682
          submit   => [ '#order_form', { action => "DeliveryOrder/request_for_quotation" } ],
1704 1683
          only_if  => (any { $self->type eq $_ } (purchase_order_type())),
1705 1684
        ],
1706 1685
        action => [
1707 1686
          t8('Save and Sales Order'),
1708
          submit   => [ '#order_form', { action => "Order/sales_order" } ],
1687
          submit   => [ '#order_form', { action => "DeliveryOrder/sales_order" } ],
1709 1688
          only_if  => (any { $self->type eq $_ } (sales_quotation_type(), purchase_order_type())),
1710 1689
        ],
1711 1690
        action => [
......
2113 2092

  
2114 2093
the controller
2115 2094

  
2116
=item * C<template/webpages/order/form.html>
2095
=item * C<template/webpages/delivery_order/form.html>
2117 2096

  
2118 2097
main form
2119 2098

  
2120
=item * C<template/webpages/order/tabs/basic_data.html>
2099
=item * C<template/webpages/delivery_order/tabs/basic_data.html>
2121 2100

  
2122 2101
Main tab for basic_data.
2123 2102

  
......
2126 2105

  
2127 2106
=over 4
2128 2107

  
2129
=item * C<template/webpages/order/tabs/_business_info_row.html>
2108
=item * C<template/webpages/delivery_order/tabs/_business_info_row.html>
2130 2109

  
2131 2110
For displaying information on business type
2132 2111

  
2133
=item * C<template/webpages/order/tabs/_item_input.html>
2112
=item * C<template/webpages/delivery_order/tabs/_item_input.html>
2134 2113

  
2135 2114
The input line for items
2136 2115

  
2137
=item * C<template/webpages/order/tabs/_row.html>
2116
=item * C<template/webpages/delivery_order/tabs/_row.html>
2138 2117

  
2139 2118
One row for already entered items
2140 2119

  
2141
=item * C<template/webpages/order/tabs/_tax_row.html>
2120
=item * C<template/webpages/delivery_order/tabs/_tax_row.html>
2142 2121

  
2143 2122
Displaying tax information
2144 2123

  
2145
=item * C<template/webpages/order/tabs/_price_sources_dialog.html>
2146

  
2147
Dialog for selecting price and discount sources
2148

  
2149 2124
=back
2150 2125

  
2151 2126
=item * C<js/kivi.Order.js>
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
});
templates/webpages/delivery_order/form.html
8 8
  <form method="post" action="controller.pl" id="print_options_form">
9 9
    [% SELF.print_options %]
10 10
    <br>
11
    [% L.button_tag('kivi.Order.print()', LxERP.t8('Print')) %]
11
    [% L.button_tag('kivi.DeliveryOrder.print()', LxERP.t8('Print')) %]
12 12
    <a href="#" onclick="$('#print_options').dialog('close');">[% LxERP.t8("Cancel") %]</a>
13 13
  </form>
14 14
</div>
......
38 38
[%- END %]
39 39
    </ul>
40 40

  
41
    [% PROCESS "order/tabs/basic_data.html" %]
41
    [% PROCESS "delivery_order/tabs/basic_data.html" %]
42 42
    [% PROCESS 'webdav/_list.html' %]
43 43
    <div id="ui-tabs-1">
44 44
      [%- LxERP.t8("Loading...") %]
templates/webpages/delivery_order/tabs/_item_input.html
22 22
            [%- type_options.push([ 'assortment', LxERP.t8('Assortment')]) %]
23 23
          [%- END %]
24 24
          [% L.select_tag('add_item.create_part_type', type_options) %]
25
          [% L.button_tag('kivi.Order.create_part()', LxERP.t8('+')) %]
25
          [% L.button_tag('kivi.DeliveryOrder.create_part()', LxERP.t8('+')) %]
26 26
        </td>
27 27
        <td>[% L.input_tag('add_item.position', '', size = 5, class="add_item_input numeric") %]</td>
28 28
        <td>
......
31 31
          [% P.part.picker('add_item.parts_id', SELF.created_part, style='width: 300px', class="add_item_input",
32 32
                            fat_set_item=1,
33 33
                            multiple_pos_input=1,
34
                            action={set_multi_items='kivi.Order.add_multi_items'},
34
                            action={set_multi_items='kivi.DeliveryOrder.add_multi_items'},
35 35
                            classification_id=SELF.part_picker_classification_ids.as_list.join(','),
36 36
                            $PARAM_KEY=PARAM_VAL) %]</td>
37 37
        <td>[% L.input_tag('add_item.description', SELF.created_part.description, class="add_item_input") %]</td>
......
42 42
        [%- SET price = LxERP.format_amount(((SELF.type == 'sales_quotation' || SELF.type == 'sales_order') ? SELF.created_part.sellprice : SELF.created_part.lastcost), -2) -%]
43 43
        <td>[% L.input_tag('add_item.sellprice_as_number', price, size = 10, class="add_item_input numeric") %]</td>
44 44
        <td>[% L.input_tag('add_item.discount_as_percent', '', size = 5, class="add_item_input numeric") %]</td>
45
        <td>[% L.button_tag('kivi.Order.add_item()', LxERP.t8('Add part')) %]</td>
45
        <td>[% L.button_tag('kivi.DeliveryOrder.add_item()', LxERP.t8('Add part')) %]</td>
46 46
      </tr>
47 47
    </tbody>
48 48
  </table>
templates/webpages/delivery_order/tabs/_row.html
28 28
      <img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]" class="dragdrop">
29 29
    </td>
30 30
    <td align="center">
31
      [%- L.button_tag("kivi.Order.delete_order_item_row(this)",
31
      [%- L.button_tag("kivi.DeliveryOrder.delete_order_item_row(this)",
32 32
                       LxERP.t8("X"),
33 33
                       confirm=LxERP.t8("Are you sure?")) %]
34 34
    </td>
......
37 37
      [%- L.img_tag(src="image/rotate_cw.svg",
38 38
                    alt=LxERP.t8('Update from master data'),
39 39
                    title= LxERP.t8('Update from master data'),
40
                    onclick="if (!confirm('" _ LxERP.t8("Are you sure to update this position from master data?") _ "')) return false; kivi.Order.update_row_from_master_data(this);",
40
                    onclick="if (!confirm('" _ LxERP.t8("Are you sure to update this position from master data?") _ "')) return false; kivi.DeliveryOrder.update_row_from_master_data(this);",
41 41
                    id='update_from_master') %]
42 42
    </td>
43 43
    [%- END -%]
......
60 60
                     size='40',
61 61
                     style='width: 300px') %]
62 62
      [%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %]
63
      [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %]
63
      [%- L.button_tag("kivi.DeliveryOrder.show_longdescription_dialog(this)", LxERP.t8("L")) %]
64 64
    </td>
65 65
    [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
66 66
    <td nowrap>
......
73 73
                      size = 5,
74 74
                      class="reformat_number numeric") %]
75 75
      [%- IF ITEM.part.formel -%]
76
        [%- L.button_tag("kivi.Order.show_calculate_qty_dialog(this)", LxERP.t8("*/")) %]
76
        [%- L.button_tag("kivi.DeliveryOrder.show_calculate_qty_dialog(this)", LxERP.t8("*/")) %]
77 77
        [%- L.hidden_tag("formula[+]", ITEM.part.formel) -%]
78 78
      [%- END -%]
79 79
    </td>
......
141 141
    <td colspan="100%">
142 142
      [%- IF MYCONFIG.show_form_details || ITEM.render_second_row %]
143 143
        <div name="second_row" data-loaded="1">
144
          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM TYPE=SELF.type %]
144
          [%- PROCESS delivery_order/tabs/_second_row.html ITEM=ITEM TYPE=SELF.type %]
145 145
        </div>
146 146
      [%- ELSE %]
147 147
        <div name="second_row" id="second_row_[% ID %]">
templates/webpages/delivery_order/tabs/basic_data.html
16 16
            [% SET cv_id = SELF.cv _ '_id' %]
17 17
            <td>
18 18
              [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]
19
              [% P.button_tag("kivi.Order.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
19
              [% P.button_tag("kivi.DeliveryOrder.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
20 20
            </td>
21 21
          </tr>
22 22

  
......
47 47
                                 with_empty=0,
48 48
                                 style='width: 300px') %]
49 49
              </span>
50
              [% L.button_tag("kivi.Order.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
50
              [% L.button_tag("kivi.DeliveryOrder.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
51 51
            </td>
52 52
          </tr>
53 53

  
54
          [%- PROCESS order/tabs/_business_info_row.html SELF=SELF %]
54
          [%- PROCESS delivery_order/tabs/_business_info_row.html SELF=SELF %]
55 55

  
56 56
          <tr>
57 57
            <th align="right">[% 'Steuersatz' | $T8 %]</th>
......
149 149
          [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
150 150
          <tr>
151 151
            <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
152
            <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11, onchange='kivi.Order.set_number_in_title(this)') %]</td>
152
            <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11, onchange='kivi.DeliveryOrder.set_number_in_title(this)') %]</td>
153 153
          </tr>
154 154
          [%- END -%]
155 155

  
......
163 163
            [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
164 164
              <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11) %]</td>
165 165
            [%- ELSE -%]
166
              <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11, onchange='kivi.Order.set_number_in_title(this)') %]</td>
166
              <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11, onchange='kivi.DeliveryOrder.set_number_in_title(this)') %]</td>
167 167
            [%- END -%]
168 168
          </tr>
169 169

  
......
225 225
    </tr>
226 226
  </table>
227 227

  
228
  [%- PROCESS order/tabs/_item_input.html SELF=SELF %]
228
  [%- PROCESS delivery_order/tabs/_item_input.html SELF=SELF %]
229 229

  
230
  [% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
230
  [% L.button_tag('kivi.DeliveryOrder.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
231 231

  
232 232
  <table width="100%">
233 233
    <tr>
......
256 256
                  [%- L.img_tag(src="image/rotate_cw.svg",
257 257
                                alt=LxERP.t8('Update from master data'),
258 258
                                title= LxERP.t8('Update from master data'),
259
                                onclick="if (!confirm('" _ LxERP.t8("Are you sure to update all positions from master data?") _ "')) return false; kivi.Order.update_all_rows_from_master_data();",
259
                                onclick="if (!confirm('" _ LxERP.t8("Are you sure to update all positions from master data?") _ "')) return false; kivi.DeliveryOrder.update_all_rows_from_master_data();",
260 260
                                id='update_from_master') %]
261 261
                </th>
262 262
                [%- END %]
263
                <th id="partnumber_header_id"   class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
263
                <th id="partnumber_header_id"   class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
264 264
                [%- IF SELF.search_cvpartnumber -%]
265
                <th id="cvpartnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("cvpartnumber")' > [%- SELF.cv == "customer" ? LxERP.t8('Customer Part Number') : LxERP.t8('Model') %]</a></th>
265
                <th id="cvpartnumber_header_id" class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("cvpartnumber")' > [%- SELF.cv == "customer" ? LxERP.t8('Customer Part Number') : LxERP.t8('Model') %]</a></th>
266 266
                [%- END -%]
267 267
                <th id="partclass_header_id"    class="listheading" nowrap width="2">[%- 'Type'  | $T8 %]</th>
268
                <th id="description_header_id"  class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.Order.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
268
                <th id="description_header_id"  class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
269 269
                [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
270
                <th id="shipped_qty_header_id"  class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
270
                <th id="shipped_qty_header_id"  class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
271 271
                [%- END -%]
272
                <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
272
                <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
273 273
                <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
274 274
                <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
275
                <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
276
                <th id="sellprice_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Order.reorder_items("sellprice")'> [%- 'Price'       | $T8 %]</a></th>
277
                <th id="discount_header_id"    class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Order.reorder_items("discount")'>  [%- 'Discount'    | $T8 %]</a></th>
275
                <th id="sellprice_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("sellprice")'> [%- 'Price'       | $T8 %]</a></th>
276
                <th id="discount_header_id"    class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("discount")'>  [%- 'Discount'    | $T8 %]</a></th>
278 277
                <th class="listheading" nowrap width="10">[%- 'Extended'     | $T8 %] </th>
279 278
              </tr>
280 279
            </thead>
281 280

  
282 281
            [%- FOREACH item = SELF.order.items_sorted %]
283
              [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id)  -%]
282
              [%- PROCESS delivery_order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id)  -%]
284 283
            [%- END %]
285 284

  
286 285
          </table>

Auch abrufbar als: Unified diff