->replaceWith('#order_cp_id', $self->build_contact_select)
->replaceWith('#order_shipto_id', $self->build_shipto_select)
->val('#order_taxzone_id', $self->order->{$self->cv}->taxzone_id)
- ->focus('#order_cv_id')
+ ->focus('#order_' . $self->cv . ' _id')
->render($self);
}
my $item = SL::DB::Manager::OrderItem->find_by_or_create(id => $item_id);
my $cv_class = "SL::DB::" . ucfirst($self->cv);
- my $cv_discount = $::form->{cv_id}? $cv_class->new(id => $::form->{cv_id})->load->discount :0.0;
+ my $cv_discount = $::form->{cv_id}? $cv_class->new(id => $::form->{$self->cv . '_id'})->load->discount :0.0;
$item->assign_attributes(
parts_id => $part->id,
sub _setup {
my ($self) = @_;
- $::form->{order}->{ $self->cv . '_id' } = delete $::form->{order}->{cv_id} if $::form->{order}->{cv_id};
$self->order->assign_attributes(%{$::form->{order}});
# bb: todo: currency later
<tr>
<th align="right">[% SELF.cv | $T8 %]</th>
[% SET cv_id = SELF.cv _ '_id' %]
- <td>[% L.customer_vendor_picker('order.cv_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]</td>
+ <td>[% L.customer_vendor_picker("order.${SELF.cv}" _ '_id', SELF.order.$cv_id, type=SELF.cv, style='width: 300px') %]</td>
</tr>
<tr id='cp_row' [%- IF !SELF.order.${SELF.cv}.contacts.size %]style='display:none;'[%- END %]>
<script type='text/javascript'>
function reload_cv_dependend_selections() {
$.post("controller.pl", { 'action': 'Order/customer_vendor_changed',
- 'cv_id': function(){ return $('#order_cv_id').val() },
+ 'cv_id': function(){ return $('#order_[%- cv_id%]').val() },
'type': function(){ return $('#type').val() },
}, kivi.eval_json_result);
}
}
function set_item_values(event) {
- var cv_id = $('#order_cv_id').val();
+ var cv_id = $('#order_[%- cv_id %]').val();
var parts_id = $(event.target).val();
var row = $(event.target).parents("tr").first();
$(function(){
- $('#order_cv_id').change(reload_cv_dependend_selections);
+ $('#order_[%- cv_id %]').change(reload_cv_dependend_selections);
$('[id^="order_orderitems"][id$="parts_id"]').change(set_item_values);
});
</script>