DeliveryOrder: package, namespace, template und controller referenzen angepasst
authorSven Schöling <s.schoeling@googlemail.com>
Fri, 13 Aug 2021 12:50:09 +0000 (14:50 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 13:52:11 +0000 (14:52 +0100)
SL/Controller/DeliveryOrder.pm
js/kivi.DeliveryOrder.js
templates/webpages/delivery_order/form.html
templates/webpages/delivery_order/tabs/_item_input.html
templates/webpages/delivery_order/tabs/_row.html
templates/webpages/delivery_order/tabs/basic_data.html

index 3bbd852..06647f4 100644 (file)
@@ -1,4 +1,4 @@
-package SL::Controller::Order;
+package SL::Controller::DeliveryOrder;
 
 use strict;
 use parent qw(SL::Controller::Base);
@@ -77,7 +77,7 @@ sub action_add {
 
   $self->pre_render();
   $self->render(
-    'order/form',
+    'delivery_order/form',
     title => $self->get_title_for('add'),
     %{$self->{template_args}}
   );
@@ -105,7 +105,7 @@ sub action_edit {
 
   $self->pre_render();
   $self->render(
-    'order/form',
+    'delivery_order/form',
     title => $self->get_title_for('edit'),
     %{$self->{template_args}}
   );
@@ -128,15 +128,15 @@ sub action_edit_collective {
 
   # fall back to save as new if only one id is given
   if (scalar @multi_ids == 1) {
-    $self->order(SL::DB::Order->new(id => $multi_ids[0])->load);
+    $self->order(SL::DB::DeliveryOrder->new(id => $multi_ids[0])->load);
     $self->action_save_as_new();
     return;
   }
 
   # make new order from given orders
-  my @multi_orders = map { SL::DB::Order->new(id => $_)->load } @multi_ids;
+  my @multi_orders = map { SL::DB::DeliveryOrder->new(id => $_)->load } @multi_ids;
   $self->{converted_from_oe_id} = join ' ', map { $_->id } @multi_orders;
-  $self->order(SL::DB::Order->new_from_multi(\@multi_orders, sort_sources_by => 'transdate'));
+  $self->order(SL::DB::DeliveryOrder->new_from_multi(\@multi_orders, sort_sources_by => 'transdate'));
 
   $self->action_edit();
 }
@@ -206,7 +206,7 @@ sub action_save_as_new {
   }
 
   # load order from db to check if values changed
-  my $saved_order = SL::DB::Order->new(id => $order->id)->load;
+  my $saved_order = SL::DB::DeliveryOrder->new(id => $order->id)->load;
 
   my %new_attrs;
   # Lets assign a new number if the user hasn't changed the previous one.
@@ -239,7 +239,7 @@ sub action_save_as_new {
   $new_attrs{employee}  = SL::DB::Manager::Employee->current;
 
   # Create new record from current one
-  $self->order(SL::DB::Order->new_from($order, destination_type => $order->type, attributes => \%new_attrs));
+  $self->order(SL::DB::DeliveryOrder->new_from($order, destination_type => $order->type, attributes => \%new_attrs));
 
   # no linked records on save as new
   delete $::form->{$_} for qw(converted_from_oe_id converted_from_orderitems_ids);
@@ -677,7 +677,7 @@ sub action_add_item {
   $self->get_item_cvpartnumber($item);
 
   my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
-  my $row_as_html = $self->p->render('order/tabs/_row',
+  my $row_as_html = $self->p->render('delivery_order/tabs/_row',
                                      ITEM => $item,
                                      ID   => $item_id,
                                      SELF => $self,
@@ -707,7 +707,7 @@ sub action_add_item {
       $self->order->add_items( $item );
       $self->get_item_cvpartnumber($item);
       my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
-      my $row_as_html = $self->p->render('order/tabs/_row',
+      my $row_as_html = $self->p->render('delivery_order/tabs/_row',
                                          ITEM => $item,
                                          ID   => $item_id,
                                          SELF => $self,
@@ -764,7 +764,7 @@ sub action_add_multi_items {
   foreach my $item (@items) {
     $self->get_item_cvpartnumber($item);
     my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000);
-    my $row_as_html = $self->p->render('order/tabs/_row',
+    my $row_as_html = $self->p->render('delivery_order/tabs/_row',
                                        ITEM => $item,
                                        ID   => $item_id,
                                        SELF => $self,
@@ -893,7 +893,7 @@ sub action_return_from_create_part {
   $_->{render_longdescription} = 1 for @{ $self->order->items_sorted };
 
   $self->render(
-    'order/form',
+    'delivery_order/form',
     title => $self->get_title_for('edit'),
     %{$self->{template_args}}
   );
@@ -980,7 +980,7 @@ sub js_load_second_row {
     $item->parse_custom_variable_values;
   }
 
-  my $row_as_html = $self->p->render('order/tabs/_second_row', ITEM => $item, TYPE => $self->type);
+  my $row_as_html = $self->p->render('delivery_order/tabs/_second_row', ITEM => $item, TYPE => $self->type);
 
   $self->js
     ->html('#second_row_' . $item_id, $row_as_html)
@@ -1171,37 +1171,16 @@ sub build_shipto_inputs {
 # Needed, if customer/vendor changed.
 sub build_business_info_row
 {
-  $_[0]->p->render('order/tabs/_business_info_row', SELF => $_[0]);
+  $_[0]->p->render('delivery_order/tabs/_business_info_row', SELF => $_[0]);
 }
 
 
-sub render_price_dialog {
-  my ($self, $record_item) = @_;
-
-  my $price_source = SL::PriceSource->new(record_item => $record_item, record => $self->order);
-
-  $self->js
-    ->run(
-      'kivi.io.price_chooser_dialog',
-      t8('Available Prices'),
-      $self->render('order/tabs/_price_sources_dialog', { output => 0 }, price_source => $price_source)
-    )
-    ->reinit_widgets;
-
-#   if (@errors) {
-#     $self->js->text('#dialog_flash_error_content', join ' ', @errors);
-#     $self->js->show('#dialog_flash_error');
-#   }
-
-  $self->js->render;
-}
-
 sub load_order {
   my ($self) = @_;
 
   return if !$::form->{id};
 
-  $self->order(SL::DB::Order->new(id => $::form->{id})->load);
+  $self->order(SL::DB::DeliveryOrder->new(id => $::form->{id})->load);
 
   # Add an empty custom shipto to the order, so that the dialog can render the cvar inputs.
   # You need a custom shipto object to call cvars_by_config to get the cvars.
@@ -1223,8 +1202,8 @@ sub make_order {
   # be retrieved via items until the order is saved. Adding empty items to new
   # order here solves this problem.
   my $order;
-  $order   = SL::DB::Order->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
-  $order ||= SL::DB::Order->new(orderitems  => [],
+  $order   = SL::DB::DeliveryOrder->new(id => $::form->{id})->load(with => [ 'orderitems', 'orderitems.part' ]) if $::form->{id};
+  $order ||= SL::DB::DeliveryOrder->new(orderitems  => [],
                                 quotation   => (any { $self->type eq $_ } (sales_quotation_type(), request_quotation_type())),
                                 currency_id => $::instance_conf->get_currency_id(),);
 
@@ -1278,7 +1257,7 @@ sub make_item {
   # add_custom_variables adds cvars to an orderitem with no cvars for saving, but
   # they cannot be retrieved via custom_variables until the order/orderitem is
   # saved. Adding empty custom_variables to new orderitem here solves this problem.
-  $item ||= SL::DB::OrderItem->new(custom_variables => []);
+  $item ||= SL::DB::DeliveryOrderItem->new(custom_variables => []);
 
   $item->assign_attributes(%$attr);
 
@@ -1298,7 +1277,7 @@ sub make_item {
 sub new_item {
   my ($record, $attr) = @_;
 
-  my $item = SL::DB::OrderItem->new;
+  my $item = SL::DB::DeliveryOrderItem->new;
 
   # Remove attributes where the user left or set the inputs empty.
   # So these attributes will be undefined and we can distinguish them
@@ -1461,14 +1440,14 @@ sub save {
       $self->order->custom_shipto(undef);
     }
 
-    SL::DB::OrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
+    SL::DB::DeliveryOrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete || []};
     $self->order->save(cascade => 1);
 
     # link records
     if ($::form->{converted_from_oe_id}) {
       my @converted_from_oe_ids = split ' ', $::form->{converted_from_oe_id};
       foreach my $converted_from_oe_id (@converted_from_oe_ids) {
-        my $src = SL::DB::Order->new(id => $converted_from_oe_id)->load;
+        my $src = SL::DB::DeliveryOrder->new(id => $converted_from_oe_id)->load;
         $src->update_attributes(closed => 1) if $src->type =~ /_quotation$/;
         $src->link_to_record($self->order);
       }
@@ -1508,7 +1487,7 @@ sub workflow_sales_or_request_for_quotation {
 
   my $destination_type = $::form->{type} eq sales_order_type() ? sales_quotation_type() : request_quotation_type();
 
-  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
+  $self->order(SL::DB::DeliveryOrder->new_from($self->order, destination_type => $destination_type));
   $self->{converted_from_oe_id} = delete $::form->{id};
 
   # set item ids to new fake id, to identify them as new items
@@ -1531,7 +1510,7 @@ sub workflow_sales_or_request_for_quotation {
   $_->{render_second_row} = 1 for @{ $self->order->items_sorted };
 
   $self->render(
-    'order/form',
+    'delivery_order/form',
     title => $self->get_title_for('edit'),
     %{$self->{template_args}}
   );
@@ -1559,10 +1538,10 @@ sub workflow_sales_or_purchase_order {
   my $custom_shipto;
   if (   $::form->{type} eq sales_order_type() && $destination_type eq purchase_order_type()
       && $::form->{use_shipto} && $self->order->shipto) {
-    $custom_shipto = $self->order->shipto->clone('SL::DB::Order');
+    $custom_shipto = $self->order->shipto->clone('SL::DB::DeliveryOrder');
   }
 
-  $self->order(SL::DB::Order->new_from($self->order, destination_type => $destination_type));
+  $self->order(SL::DB::DeliveryOrder->new_from($self->order, destination_type => $destination_type));
   $self->{converted_from_oe_id} = delete $::form->{id};
 
   # set item ids to new fake id, to identify them as new items
@@ -1594,7 +1573,7 @@ sub workflow_sales_or_purchase_order {
   $_->{render_second_row} = 1 for @{ $self->order->items_sorted };
 
   $self->render(
-    'order/form',
+    'delivery_order/form',
     title => $self->get_title_for('edit'),
     %{$self->{template_args}}
   );
@@ -1695,17 +1674,17 @@ sub setup_edit_action_bar {
         ],
         action => [
           t8('Save and Quotation'),
-          submit   => [ '#order_form', { action => "Order/sales_quotation" } ],
+          submit   => [ '#order_form', { action => "DeliveryOrder/sales_quotation" } ],
           only_if  => (any { $self->type eq $_ } (sales_order_type())),
         ],
         action => [
           t8('Save and RFQ'),
-          submit   => [ '#order_form', { action => "Order/request_for_quotation" } ],
+          submit   => [ '#order_form', { action => "DeliveryOrder/request_for_quotation" } ],
           only_if  => (any { $self->type eq $_ } (purchase_order_type())),
         ],
         action => [
           t8('Save and Sales Order'),
-          submit   => [ '#order_form', { action => "Order/sales_order" } ],
+          submit   => [ '#order_form', { action => "DeliveryOrder/sales_order" } ],
           only_if  => (any { $self->type eq $_ } (sales_quotation_type(), purchase_order_type())),
         ],
         action => [
@@ -2113,11 +2092,11 @@ and ajax.
 
 the controller
 
-=item * C<template/webpages/order/form.html>
+=item * C<template/webpages/delivery_order/form.html>
 
 main form
 
-=item * C<template/webpages/order/tabs/basic_data.html>
+=item * C<template/webpages/delivery_order/tabs/basic_data.html>
 
 Main tab for basic_data.
 
@@ -2126,26 +2105,22 @@ reused from generic code.
 
 =over 4
 
-=item * C<template/webpages/order/tabs/_business_info_row.html>
+=item * C<template/webpages/delivery_order/tabs/_business_info_row.html>
 
 For displaying information on business type
 
-=item * C<template/webpages/order/tabs/_item_input.html>
+=item * C<template/webpages/delivery_order/tabs/_item_input.html>
 
 The input line for items
 
-=item * C<template/webpages/order/tabs/_row.html>
+=item * C<template/webpages/delivery_order/tabs/_row.html>
 
 One row for already entered items
 
-=item * C<template/webpages/order/tabs/_tax_row.html>
+=item * C<template/webpages/delivery_order/tabs/_tax_row.html>
 
 Displaying tax information
 
-=item * C<template/webpages/order/tabs/_price_sources_dialog.html>
-
-Dialog for selecting price and discount sources
-
 =back
 
 =item * C<js/kivi.Order.js>
index c28033f..f90184f 100644 (file)
@@ -1,6 +1,6 @@
-namespace('kivi.Order', function(ns) {
+namespace('kivi.DeliveryOrder', function(ns) {
   ns.check_cv = function() {
-    if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation') {
+    if ($('#type').val() == 'sales_delivery_order') {
       if ($('#order_customer_id').val() === '') {
         alert(kivi.t8('Please select a customer.'));
         return false;
@@ -51,14 +51,14 @@ namespace('kivi.Order', function(ns) {
     if (warn_on_reqdate    && !ns.check_valid_reqdate())   return;
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/' + action });
+    data.push({ name: 'action', value: 'DeliveryOrder/' + action });
 
     $.post("controller.pl", data, kivi.eval_json_result);
   };
 
   ns.delete_order = function() {
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/delete' });
+    data.push({ name: 'action', value: 'DeliveryOrder/delete' });
 
     $.post("controller.pl", data, kivi.eval_json_result);
   };
@@ -83,7 +83,7 @@ namespace('kivi.Order', function(ns) {
 
     var data = $('#order_form').serializeArray();
     data = data.concat($('#print_options_form').serializeArray());
-    data.push({ name: 'action', value: 'Order/print' });
+    data.push({ name: 'action', value: 'DeliveryOrder/print' });
 
     $.post("controller.pl", data, kivi.eval_json_result);
   };
@@ -115,7 +115,7 @@ namespace('kivi.Order', function(ns) {
       height: 600,
       title:  kivi.t8('Send email'),
       modal:  true,
-      beforeClose: kivi.Order.finish_send_email_dialog,
+      beforeClose: kivi.DeliveryOrder.finish_send_email_dialog,
       close: function(event, ui) {
         email_dialog.remove();
       }
@@ -127,7 +127,7 @@ namespace('kivi.Order', function(ns) {
     email_dialog.html(html);
     email_dialog.dialog(dialog_params);
 
-    kivi.Order.setup_send_email_dialog();
+    kivi.DeliveryOrder.setup_send_email_dialog();
 
     $('.cancel').click(ns.close_email_dialog);
 
@@ -141,7 +141,7 @@ namespace('kivi.Order', function(ns) {
     var data = $('#order_form').serializeArray();
     data = data.concat($('[name^="email_form."]').serializeArray());
     data = data.concat($('[name^="print_options."]').serializeArray());
-    data.push({ name: 'action', value: 'Order/send_email' });
+    data.push({ name: 'action', value: 'DeliveryOrder/send_email' });
     $.post("controller.pl", data, kivi.eval_json_result);
   };
 
@@ -162,7 +162,7 @@ namespace('kivi.Order', function(ns) {
   ns.reload_cv_dependent_selections = function() {
     $('#order_shipto_id').val('');
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/customer_vendor_changed' });
+    data.push({ name: 'action', value: 'DeliveryOrder/customer_vendor_changed' });
 
     $.post("controller.pl", data, kivi.eval_json_result);
   };
@@ -196,7 +196,7 @@ namespace('kivi.Order', function(ns) {
     }
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/update_exchangerate' });
+    data.push({ name: 'action', value: 'DeliveryOrder/update_exchangerate' });
 
     $.ajax({
       url: 'controller.pl',
@@ -243,7 +243,7 @@ namespace('kivi.Order', function(ns) {
     $(select_elt).data('oldval', $(select_elt).val());
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action',           value: 'Order/unit_changed'     },
+    data.push({ name: 'action',           value: 'DeliveryOrder/unit_changed'     },
               { name: 'item_id',          value: item_id_dom.val()        },
               { name: 'old_unit',         value: oldval                   },
               { name: 'sellprice_dom_id', value: sellprice_dom.attr('id') });
@@ -267,7 +267,7 @@ namespace('kivi.Order', function(ns) {
       return;
     }
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action',     value: 'Order/load_second_rows' },
+    data.push({ name: 'action',     value: 'DeliveryOrder/load_second_rows' },
               { name: 'item_ids[]', value: item_id_dom.val()        });
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -288,7 +288,7 @@ namespace('kivi.Order', function(ns) {
     }
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/load_second_rows' });
+    data.push({ name: 'action', value: 'DeliveryOrder/load_second_rows' });
     data = data.concat(item_ids);
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -409,7 +409,7 @@ namespace('kivi.Order', function(ns) {
     $('#' + order_by + '_header_id a').append('<img border=0 data-sort-dir=' + dir + ' src=' + src + ' alt="' + kivi.t8('sort items') + '">');
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action',   value: 'Order/reorder_items' },
+    data.push({ name: 'action',   value: 'DeliveryOrder/reorder_items' },
               { name: 'order_by', value: order_by              },
               { name: 'sort_dir', value: dir                   });
 
@@ -451,7 +451,7 @@ namespace('kivi.Order', function(ns) {
     var insert_before_item_id = ns.get_insert_before_item_id($('#add_item_position').val());
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/add_item' },
+    data.push({ name: 'action', value: 'DeliveryOrder/add_item' },
               { name: 'insert_before_item_id', value: insert_before_item_id });
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -468,7 +468,7 @@ namespace('kivi.Order', function(ns) {
   ns.add_multi_items = function(data) {
     var insert_before_item_id = ns.get_insert_before_item_id($('#multi_items_position').val());
     data = data.concat($('#order_form').serializeArray());
-    data.push({ name: 'action', value: 'Order/add_multi_items' },
+    data.push({ name: 'action', value: 'DeliveryOrder/add_multi_items' },
               { name: 'insert_before_item_id', value: insert_before_item_id });
     $.post("controller.pl", data, kivi.eval_json_result);
   };
@@ -510,7 +510,7 @@ namespace('kivi.Order', function(ns) {
     var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action',  value: 'Order/price_popup' },
+    data.push({ name: 'action',  value: 'DeliveryOrder/price_popup' },
               { name: 'item_id', value: item_id_dom.val()   });
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -533,7 +533,7 @@ namespace('kivi.Order', function(ns) {
 
     kivi.popup_dialog({
       url:    'controller.pl',
-      data:   { action: 'Order/show_customer_vendor_details_dialog',
+      data:   { action: 'DeliveryOrder/show_customer_vendor_details_dialog',
                 type  : $('#type').val(),
                 vc    : vc,
                 vc_id : vc_id
@@ -553,7 +553,7 @@ namespace('kivi.Order', function(ns) {
     var item_id_dom = $(row).find('[name="orderitem_ids[+]"]');
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/update_row_from_master_data' });
+    data.push({ name: 'action', value: 'DeliveryOrder/update_row_from_master_data' });
     data.push({ name: 'item_ids[]', value: item_id_dom.val() });
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -570,7 +570,7 @@ namespace('kivi.Order', function(ns) {
     }
 
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/update_row_from_master_data' });
+    data.push({ name: 'action', value: 'DeliveryOrder/update_row_from_master_data' });
     data = data.concat(item_ids);
 
     $.post("controller.pl", data, kivi.eval_json_result);
@@ -593,7 +593,7 @@ namespace('kivi.Order', function(ns) {
 
   ns.purchase_order_check_for_direct_delivery = function() {
     if ($('#type').val() != 'sales_order') {
-      kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
+      kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
     }
 
     var empty = true;
@@ -623,7 +623,7 @@ namespace('kivi.Order', function(ns) {
     if (!empty) {
       ns.direct_delivery_dialog(shipto);
     } else {
-      kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
+      kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
     }
   };
 
@@ -634,7 +634,7 @@ namespace('kivi.Order', function(ns) {
       $('<input type="hidden" name="use_shipto">').appendTo('#order_form').val('1');
     }
 
-    kivi.submit_form_with_action($('#order_form'), 'Order/purchase_order');
+    kivi.submit_form_with_action($('#order_form'), 'DeliveryOrder/purchase_order');
   };
 
   ns.direct_delivery_dialog = function(shipto) {
@@ -644,9 +644,9 @@ namespace('kivi.Order', function(ns) {
     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?');
     var html  = '<div id="direct-delivery-dialog"><p>' + text1 + '</p><p>' + shipto + '</p><p>' + text2 + '</p>';
     html      = html + '<hr><p>';
-    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.Order.direct_delivery_callback(true)">';
+    html      = html + '<input type="button" value="' + kivi.t8('Yes') + '" size="30" onclick="kivi.DeliveryOrder.direct_delivery_callback(true)">';
     html      = html + '&nbsp;';
-    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.Order.direct_delivery_callback(false)">';
+    html      = html + '<input type="button" value="' + kivi.t8('No')  + '" size="30" onclick="kivi.DeliveryOrder.direct_delivery_callback(false)">';
     html      = html + '</p></div>';
     $(html).hide().appendTo('#order_form');
 
@@ -696,7 +696,7 @@ namespace('kivi.Order', function(ns) {
 
   ns.create_part = function() {
     var data = $('#order_form').serializeArray();
-    data.push({ name: 'action', value: 'Order/create_part' });
+    data.push({ name: 'action', value: 'DeliveryOrder/create_part' });
 
     $.post("controller.pl", data, kivi.eval_json_result);
   };
@@ -705,14 +705,14 @@ namespace('kivi.Order', function(ns) {
 
 $(function() {
   if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
-    $('#order_customer_id').change(kivi.Order.reload_cv_dependent_selections);
+    $('#order_customer_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
   } else {
-    $('#order_vendor_id').change(kivi.Order.reload_cv_dependent_selections);
+    $('#order_vendor_id').change(kivi.DeliveryOrder.reload_cv_dependent_selections);
   }
 
-  $('#order_currency_id').change(kivi.Order.update_exchangerate);
-  $('#order_transdate_as_date').change(kivi.Order.update_exchangerate);
-  $('#order_exchangerate_as_null_number').change(kivi.Order.exchangerate_changed);
+  $('#order_currency_id').change(kivi.DeliveryOrder.update_exchangerate);
+  $('#order_transdate_as_date').change(kivi.DeliveryOrder.update_exchangerate);
+  $('#order_exchangerate_as_null_number').change(kivi.DeliveryOrder.exchangerate_changed);
 
   if ($('#type').val() == 'sales_order' || $('#type').val() == 'sales_quotation' ) {
     $('#add_item_parts_id').on('set_item:PartPicker', function(e,o) { $('#add_item_sellprice_as_number').val(kivi.format_amount(o.sellprice, -2)) });
@@ -725,16 +725,16 @@ $(function() {
   $('.add_item_input').keydown(function(event) {
     if (event.keyCode == 13) {
       event.preventDefault();
-      kivi.Order.add_item();
+      kivi.DeliveryOrder.add_item();
       return false;
     }
   });
 
-  kivi.Order.init_row_handlers();
+  kivi.DeliveryOrder.init_row_handlers();
 
   $('#row_table_id').on('sortstop', function(event, ui) {
     $('#row_table_id thead a img').remove();
-    kivi.Order.renumber_positions();
+    kivi.DeliveryOrder.renumber_positions();
   });
 
   $('#expand_all').on('click', function(event) {
@@ -745,21 +745,21 @@ $(function() {
       $('#expand_all').attr('alt', kivi.t8('Show all details'));
       $('#expand_all').attr('title', kivi.t8('Show all details'));
       $('.row_entry').each(function(idx, elt) {
-        kivi.Order.hide_second_row(elt);
+        kivi.DeliveryOrder.hide_second_row(elt);
       });
     } else {
       $('#expand_all').data('expanded', 1);
       $('#expand_all').attr('src', "image/collapse.svg");
       $('#expand_all').attr('alt', kivi.t8('Hide all details'));
       $('#expand_all').attr('title', kivi.t8('Hide all details'));
-      kivi.Order.load_all_second_rows();
+      kivi.DeliveryOrder.load_all_second_rows();
       $('.row_entry').each(function(idx, elt) {
-        kivi.Order.show_second_row(elt);
+        kivi.DeliveryOrder.show_second_row(elt);
       });
     }
     return false;
   });
 
-  $('.reformat_number_as_null_number').change(kivi.Order.reformat_number_as_null_number);
+  $('.reformat_number_as_null_number').change(kivi.DeliveryOrder.reformat_number_as_null_number);
 
 });
index c3ff986..a06b7c4 100644 (file)
@@ -8,7 +8,7 @@
   <form method="post" action="controller.pl" id="print_options_form">
     [% SELF.print_options %]
     <br>
-    [% L.button_tag('kivi.Order.print()', LxERP.t8('Print')) %]
+    [% L.button_tag('kivi.DeliveryOrder.print()', LxERP.t8('Print')) %]
     <a href="#" onclick="$('#print_options').dialog('close');">[% LxERP.t8("Cancel") %]</a>
   </form>
 </div>
@@ -38,7 +38,7 @@
 [%- END %]
     </ul>
 
-    [% PROCESS "order/tabs/basic_data.html" %]
+    [% PROCESS "delivery_order/tabs/basic_data.html" %]
     [% PROCESS 'webdav/_list.html' %]
     <div id="ui-tabs-1">
       [%- LxERP.t8("Loading...") %]
index 1b1bf60..255d4f8 100644 (file)
@@ -22,7 +22,7 @@
             [%- type_options.push([ 'assortment', LxERP.t8('Assortment')]) %]
           [%- END %]
           [% L.select_tag('add_item.create_part_type', type_options) %]
-          [% L.button_tag('kivi.Order.create_part()', LxERP.t8('+')) %]
+          [% L.button_tag('kivi.DeliveryOrder.create_part()', LxERP.t8('+')) %]
         </td>
         <td>[% L.input_tag('add_item.position', '', size = 5, class="add_item_input numeric") %]</td>
         <td>
@@ -31,7 +31,7 @@
           [% P.part.picker('add_item.parts_id', SELF.created_part, style='width: 300px', class="add_item_input",
                             fat_set_item=1,
                             multiple_pos_input=1,
-                            action={set_multi_items='kivi.Order.add_multi_items'},
+                            action={set_multi_items='kivi.DeliveryOrder.add_multi_items'},
                             classification_id=SELF.part_picker_classification_ids.as_list.join(','),
                             $PARAM_KEY=PARAM_VAL) %]</td>
         <td>[% L.input_tag('add_item.description', SELF.created_part.description, class="add_item_input") %]</td>
@@ -42,7 +42,7 @@
         [%- SET price = LxERP.format_amount(((SELF.type == 'sales_quotation' || SELF.type == 'sales_order') ? SELF.created_part.sellprice : SELF.created_part.lastcost), -2) -%]
         <td>[% L.input_tag('add_item.sellprice_as_number', price, size = 10, class="add_item_input numeric") %]</td>
         <td>[% L.input_tag('add_item.discount_as_percent', '', size = 5, class="add_item_input numeric") %]</td>
-        <td>[% L.button_tag('kivi.Order.add_item()', LxERP.t8('Add part')) %]</td>
+        <td>[% L.button_tag('kivi.DeliveryOrder.add_item()', LxERP.t8('Add part')) %]</td>
       </tr>
     </tbody>
   </table>
index 6483647..c93d18c 100644 (file)
@@ -28,7 +28,7 @@
       <img src="image/updown.png" alt="[%- LxERP.t8('reorder item') %]" class="dragdrop">
     </td>
     <td align="center">
-      [%- L.button_tag("kivi.Order.delete_order_item_row(this)",
+      [%- L.button_tag("kivi.DeliveryOrder.delete_order_item_row(this)",
                        LxERP.t8("X"),
                        confirm=LxERP.t8("Are you sure?")) %]
     </td>
@@ -37,7 +37,7 @@
       [%- L.img_tag(src="image/rotate_cw.svg",
                     alt=LxERP.t8('Update from master data'),
                     title= LxERP.t8('Update from master data'),
-                    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);",
+                    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);",
                     id='update_from_master') %]
     </td>
     [%- END -%]
@@ -60,7 +60,7 @@
                      size='40',
                      style='width: 300px') %]
       [%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %]
-      [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %]
+      [%- L.button_tag("kivi.DeliveryOrder.show_longdescription_dialog(this)", LxERP.t8("L")) %]
     </td>
     [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
     <td nowrap>
@@ -73,7 +73,7 @@
                       size = 5,
                       class="reformat_number numeric") %]
       [%- IF ITEM.part.formel -%]
-        [%- L.button_tag("kivi.Order.show_calculate_qty_dialog(this)", LxERP.t8("*/")) %]
+        [%- L.button_tag("kivi.DeliveryOrder.show_calculate_qty_dialog(this)", LxERP.t8("*/")) %]
         [%- L.hidden_tag("formula[+]", ITEM.part.formel) -%]
       [%- END -%]
     </td>
     <td colspan="100%">
       [%- IF MYCONFIG.show_form_details || ITEM.render_second_row %]
         <div name="second_row" data-loaded="1">
-          [%- PROCESS order/tabs/_second_row.html ITEM=ITEM TYPE=SELF.type %]
+          [%- PROCESS delivery_order/tabs/_second_row.html ITEM=ITEM TYPE=SELF.type %]
         </div>
       [%- ELSE %]
         <div name="second_row" id="second_row_[% ID %]">
index a2ffd71..1f53f89 100644 (file)
@@ -16,7 +16,7 @@
             [% SET cv_id = SELF.cv _ '_id' %]
             <td>
               [% P.customer_vendor.picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]
-              [% P.button_tag("kivi.Order.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
+              [% P.button_tag("kivi.DeliveryOrder.show_vc_details_dialog()", LxERP.t8("Details (one letter abbreviation)")) %]
             </td>
           </tr>
 
                                  with_empty=0,
                                  style='width: 300px') %]
               </span>
-              [% L.button_tag("kivi.Order.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
+              [% L.button_tag("kivi.DeliveryOrder.edit_custom_shipto()", LxERP.t8("Custom shipto")) %]
             </td>
           </tr>
 
-          [%- PROCESS order/tabs/_business_info_row.html SELF=SELF %]
+          [%- PROCESS delivery_order/tabs/_business_info_row.html SELF=SELF %]
 
           <tr>
             <th align="right">[% 'Steuersatz' | $T8 %]</th>
           [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
           <tr>
             <th width="70%" align="right" nowrap>[% 'Order Number' | $T8 %]</th>
-            <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11, onchange='kivi.Order.set_number_in_title(this)') %]</td>
+            <td>[% L.input_tag('order.ordnumber', SELF.order.ordnumber, size = 11, onchange='kivi.DeliveryOrder.set_number_in_title(this)') %]</td>
           </tr>
           [%- END -%]
 
             [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
               <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11) %]</td>
             [%- ELSE -%]
-              <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11, onchange='kivi.Order.set_number_in_title(this)') %]</td>
+              <td>[% L.input_tag('order.quonumber', SELF.order.quonumber, size = 11, onchange='kivi.DeliveryOrder.set_number_in_title(this)') %]</td>
             [%- END -%]
           </tr>
 
     </tr>
   </table>
 
-  [%- PROCESS order/tabs/_item_input.html SELF=SELF %]
+  [%- PROCESS delivery_order/tabs/_item_input.html SELF=SELF %]
 
-  [% L.button_tag('kivi.Order.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
+  [% L.button_tag('kivi.DeliveryOrder.open_multi_items_dialog()', LxERP.t8('Add multiple items')) %]
 
   <table width="100%">
     <tr>
                   [%- L.img_tag(src="image/rotate_cw.svg",
                                 alt=LxERP.t8('Update from master data'),
                                 title= LxERP.t8('Update from master data'),
-                                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();",
+                                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();",
                                 id='update_from_master') %]
                 </th>
                 [%- END %]
-                <th id="partnumber_header_id"   class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
+                <th id="partnumber_header_id"   class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
                 [%- IF SELF.search_cvpartnumber -%]
-                <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>
+                <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>
                 [%- END -%]
                 <th id="partclass_header_id"    class="listheading" nowrap width="2">[%- 'Type'  | $T8 %]</th>
-                <th id="description_header_id"  class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.Order.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
+                <th id="description_header_id"  class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
                 [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
-                <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>
+                <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>
                 [%- END -%]
-                <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
+                <th id="qty_header_id"          class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
                 <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
                 <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>
-                <th class="listheading" nowrap width="5" >[%- 'Price Source' | $T8 %] </th>
-                <th id="sellprice_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Order.reorder_items("sellprice")'> [%- 'Price'       | $T8 %]</a></th>
-                <th id="discount_header_id"    class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.Order.reorder_items("discount")'>  [%- 'Discount'    | $T8 %]</a></th>
+                <th id="sellprice_header_id"   class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("sellprice")'> [%- 'Price'       | $T8 %]</a></th>
+                <th id="discount_header_id"    class="listheading" nowrap width="15" ><a href='#' onClick='javascript:kivi.DeliveryOrder.reorder_items("discount")'>  [%- 'Discount'    | $T8 %]</a></th>
                 <th class="listheading" nowrap width="10">[%- 'Extended'     | $T8 %] </th>
               </tr>
             </thead>
 
             [%- FOREACH item = SELF.order.items_sorted %]
-              [%- PROCESS order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id)  -%]
+              [%- PROCESS delivery_order/tabs/_row.html ITEM=item ID=(item.id||item.new_fake_id)  -%]
             [%- END %]
 
           </table>