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();
$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
$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',
=item *
-Possibility to change longdescription in input row?
-
-=item *
-
Possibility to select PriceSources in input row?
=item *
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();
- $('<input type="hidden" name="order.orderitems[].longdescription">').insertAfter(description_elt).val(val);
+ longdescription_elt.val(val);
}
};