Revision aa60c549
Von Moritz Bunkus vor etwa 4 Jahren hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
94 | 94 |
foreach my $item (@{$self->order->items_sorted}) { |
95 | 95 |
$item->{new_fake_id} = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); |
96 | 96 |
} |
97 |
# trigger rendering values for second row/longdescription as hidden, |
|
98 |
# because they are loaded only on demand. So we need to keep the values |
|
99 |
# from the source. |
|
100 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted }; |
|
101 |
$_->{render_longdescription} = 1 for @{ $self->order->items_sorted }; |
|
97 |
# trigger rendering values for second row as hidden, because they |
|
98 |
# are loaded only on demand. So we need to keep the values from |
|
99 |
# the source. |
|
100 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted }; |
|
102 | 101 |
} |
103 | 102 |
|
104 | 103 |
$self->recalc(); |
... | ... | |
995 | 994 |
$self->render_price_dialog($item); |
996 | 995 |
} |
997 | 996 |
|
998 |
# get the longdescription for an item if the dialog to enter/change the |
|
999 |
# longdescription was opened and the longdescription is empty |
|
1000 |
# |
|
1001 |
# If this item is new, get the longdescription from Part. |
|
1002 |
# Otherwise get it from OrderItem. |
|
1003 |
sub action_get_item_longdescription { |
|
1004 |
my $longdescription; |
|
1005 |
|
|
1006 |
if ($::form->{item_id}) { |
|
1007 |
$longdescription = SL::DB::OrderItem->new(id => $::form->{item_id})->load->longdescription; |
|
1008 |
} elsif ($::form->{parts_id}) { |
|
1009 |
$longdescription = get_part_texts($::form->{parts_id}, $::form->{language_id})->{longdescription}; |
|
1010 |
} |
|
1011 |
$_[0]->render(\ $longdescription, { type => 'text' }); |
|
1012 |
} |
|
1013 |
|
|
1014 | 997 |
# load the second row for one or more items |
1015 | 998 |
# |
1016 | 999 |
# This action gets the html code for all items second rows by rendering a template for |
... | ... | |
1742 | 1725 |
$self->get_unalterable_data(); |
1743 | 1726 |
$self->pre_render(); |
1744 | 1727 |
|
1745 |
# trigger rendering values for second row/longdescription as hidden, |
|
1746 |
# because they are loaded only on demand. So we need to keep the values |
|
1747 |
# from the source. |
|
1748 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted }; |
|
1749 |
$_->{render_longdescription} = 1 for @{ $self->order->items_sorted }; |
|
1728 |
# trigger rendering values for second row as hidden, because they |
|
1729 |
# are loaded only on demand. So we need to keep the values from the |
|
1730 |
# source. |
|
1731 |
$_->{render_second_row} = 1 for @{ $self->order->items_sorted }; |
|
1750 | 1732 |
|
1751 | 1733 |
$self->render( |
1752 | 1734 |
'order/form', |
... | ... | |
2321 | 2303 |
|
2322 | 2304 |
=item * |
2323 | 2305 |
|
2324 |
Possibility to change longdescription in input row? |
|
2325 |
|
|
2326 |
=item * |
|
2327 |
|
|
2328 | 2306 |
Possibility to select PriceSources in input row? |
2329 | 2307 |
|
2330 | 2308 |
=item * |
js/kivi.Order.js | ||
---|---|---|
580 | 580 |
var position = $(row).find('[name="position"]').html(); |
581 | 581 |
var partnumber = $(row).find('[name="partnumber"]').html(); |
582 | 582 |
var description_elt = $(row).find('[name="order.orderitems[].description"]'); |
583 |
var description = description_elt.val(); |
|
584 | 583 |
var longdescription_elt = $(row).find('[name="order.orderitems[].longdescription"]'); |
585 |
var longdescription; |
|
586 |
|
|
587 |
if (!longdescription_elt.length) { |
|
588 |
var data = [ |
|
589 |
{ name: 'action', value: 'Order/get_item_longdescription' }, |
|
590 |
{ name: 'type', value: $('#type').val() }, |
|
591 |
{ name: 'language_id', value: $('#order_language_id').val() }, |
|
592 |
{ name: 'item_id', value: $(row).find('[name="order.orderitems[+].id"]').val() }, |
|
593 |
{ name: 'parts_id', value: $(row).find('[name="order.orderitems[].parts_id"]').val() } |
|
594 |
]; |
|
595 |
|
|
596 |
$.ajax({ |
|
597 |
url: 'controller.pl', |
|
598 |
data: data, |
|
599 |
method: "GET", |
|
600 |
async: false, |
|
601 |
dataType: 'text', |
|
602 |
success: function(val) { |
|
603 |
longdescription = val; |
|
604 |
} |
|
605 |
}); |
|
606 |
} else { |
|
607 |
longdescription = longdescription_elt.val(); |
|
608 |
} |
|
609 | 584 |
|
610 | 585 |
var params = { |
611 | 586 |
runningnumber: position, |
612 | 587 |
partnumber: partnumber, |
613 |
description: description, |
|
614 |
default_longdescription: longdescription, |
|
588 |
description: description_elt.val(),
|
|
589 |
default_longdescription: longdescription_elt.val(),
|
|
615 | 590 |
set_function: function(val) { |
616 |
longdescription_elt.remove(); |
|
617 |
$('<input type="hidden" name="order.orderitems[].longdescription">').insertAfter(description_elt).val(val); |
|
591 |
longdescription_elt.val(val); |
|
618 | 592 |
} |
619 | 593 |
}; |
620 | 594 |
|
templates/webpages/order/tabs/_row.html | ||
---|---|---|
59 | 59 |
ITEM.description, |
60 | 60 |
size='40', |
61 | 61 |
style='width: 300px') %] |
62 |
[%- IF ITEM.render_longdescription -%] |
|
63 |
[%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %] |
|
64 |
[%- END -%] |
|
62 |
[%- L.hidden_tag("order.orderitems[].longdescription", ITEM.longdescription) %] |
|
65 | 63 |
[%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %] |
66 | 64 |
</td> |
67 | 65 |
[%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%] |
Auch abrufbar als: Unified diff
Neuer Angebots-/Auftragscontroller: Unterstützung für Artikelübersetzungen 3
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.