From aa60c5493c365f32ebef636d43ca37ea1cfeefd4 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 10 Nov 2020 09:30:10 +0100 Subject: [PATCH] =?utf8?q?Neuer=20Angebots-/Auftragscontroller:=20Unterst?= =?utf8?q?=C3=BCtzung=20f=C3=BCr=20Artikel=C3=BCbersetzungen=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die longdescription wird jetzt doch als Hidden im Formular mit übertragen. Dadurch werden gewisse Randfälle und Diskrepanzen zwischen Form-Inhalt und Datenbank-Inhalt vermieden. Nur hiermit ist es jetzt auch möglich, auch den Langtext durch die Funktion »aus Stammdaten aktualisieren« zurückzusetzen. --- SL/Controller/Order.pm | 38 ++++++------------------- js/kivi.Order.js | 32 ++------------------- templates/webpages/order/tabs/_row.html | 4 +-- 3 files changed, 12 insertions(+), 62 deletions(-) diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index b7eadbe08..606f98534 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -94,11 +94,10 @@ sub action_edit { foreach my $item (@{$self->order->items_sorted}) { $item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); } - # trigger rendering values for second row/longdescription as hidden, - # because they are loaded only on demand. So we need to keep the values - # from the source. - $_->{render_second_row} = 1 for @{ $self->order->items_sorted }; - $_->{render_longdescription} = 1 for @{ $self->order->items_sorted }; + # trigger rendering values for second row as hidden, because they + # are loaded only on demand. So we need to keep the values from + # the source. + $_->{render_second_row} = 1 for @{ $self->order->items_sorted }; } $self->recalc(); @@ -995,22 +994,6 @@ sub action_price_popup { $self->render_price_dialog($item); } -# get the longdescription for an item if the dialog to enter/change the -# longdescription was opened and the longdescription is empty -# -# If this item is new, get the longdescription from Part. -# Otherwise get it from OrderItem. -sub action_get_item_longdescription { - my $longdescription; - - if ($::form->{item_id}) { - $longdescription = SL::DB::OrderItem->new(id => $::form->{item_id})->load->longdescription; - } elsif ($::form->{parts_id}) { - $longdescription = get_part_texts($::form->{parts_id}, $::form->{language_id})->{longdescription}; - } - $_[0]->render(\ $longdescription, { type => 'text' }); -} - # load the second row for one or more items # # This action gets the html code for all items second rows by rendering a template for @@ -1742,11 +1725,10 @@ sub workflow_sales_or_purchase_order { $self->get_unalterable_data(); $self->pre_render(); - # trigger rendering values for second row/longdescription as hidden, - # because they are loaded only on demand. So we need to keep the values - # from the source. - $_->{render_second_row} = 1 for @{ $self->order->items_sorted }; - $_->{render_longdescription} = 1 for @{ $self->order->items_sorted }; + # trigger rendering values for second row as hidden, because they + # are loaded only on demand. So we need to keep the values from the + # source. + $_->{render_second_row} = 1 for @{ $self->order->items_sorted }; $self->render( 'order/form', @@ -2321,10 +2303,6 @@ How to expand/collapse second row. Now it can be done clicking the icon or =item * -Possibility to change longdescription in input row? - -=item * - Possibility to select PriceSources in input row? =item * diff --git a/js/kivi.Order.js b/js/kivi.Order.js index c23466eab..d74e3470d 100644 --- a/js/kivi.Order.js +++ b/js/kivi.Order.js @@ -580,41 +580,15 @@ namespace('kivi.Order', function(ns) { var position = $(row).find('[name="position"]').html(); var partnumber = $(row).find('[name="partnumber"]').html(); var description_elt = $(row).find('[name="order.orderitems[].description"]'); - var description = description_elt.val(); var longdescription_elt = $(row).find('[name="order.orderitems[].longdescription"]'); - var longdescription; - - if (!longdescription_elt.length) { - var data = [ - { name: 'action', value: 'Order/get_item_longdescription' }, - { name: 'type', value: $('#type').val() }, - { name: 'language_id', value: $('#order_language_id').val() }, - { name: 'item_id', value: $(row).find('[name="order.orderitems[+].id"]').val() }, - { name: 'parts_id', value: $(row).find('[name="order.orderitems[].parts_id"]').val() } - ]; - - $.ajax({ - url: 'controller.pl', - data: data, - method: "GET", - async: false, - dataType: 'text', - success: function(val) { - longdescription = val; - } - }); - } else { - longdescription = longdescription_elt.val(); - } var params = { runningnumber: position, partnumber: partnumber, - description: description, - default_longdescription: longdescription, + description: description_elt.val(), + default_longdescription: longdescription_elt.val(), set_function: function(val) { - longdescription_elt.remove(); - $('').insertAfter(description_elt).val(val); + longdescription_elt.val(val); } }; diff --git a/templates/webpages/order/tabs/_row.html b/templates/webpages/order/tabs/_row.html index b93b72861..0c29b3b5b 100644 --- a/templates/webpages/order/tabs/_row.html +++ b/templates/webpages/order/tabs/_row.html @@ -59,9 +59,7 @@ ITEM.description, size='40', style='width: 300px') %] - [%- IF ITEM.render_longdescription -%] - [%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %] - [%- END -%] + [%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %] [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %] [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] -- 2.20.1