X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/68be1335e2f0896f2d81939a896ad2e08343abda..b3ba396b54121922f650c16d07ce8509efaa0e45:/SL/Controller/Order.pm diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index eff55ca07..79ff2934f 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -89,7 +89,7 @@ sub action_save { return $self->js->render($self); } - flash_later('info', 'The order has been saved'); + flash_later('info', $::locale->text('The order has been saved')); my @redirect_params = ( action => 'edit', type => $self->type, @@ -125,7 +125,7 @@ sub action_customer_vendor_changed { ->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_' . $self->cv . ' _id') + ->focus('#order_' . $self->cv . '_id') ->render($self); } @@ -136,11 +136,12 @@ sub action_add_item { return unless $form_attr->{parts_id}; - my $item = SL::DB::OrderItem->new; + my $item = SL::DB::OrderItem->new; $item->assign_attributes(%$form_attr); my $part = SL::DB::Part->new(id => $form_attr->{parts_id})->load; - my $cv_discount = $self->order->customer? $self->order->customer->discount : 0.0; + my $cv_method = $self->cv; + my $cv_discount = $self->order->$cv_method? $self->order->$cv_method->discount : 0.0; my %new_attr; $new_attr{part} = $part; @@ -151,16 +152,16 @@ sub action_add_item { $new_attr{discount} = $cv_discount if ! $item->discount; $item->assign_attributes(%new_attr); - $item->id(join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000)) if !$item->id; $self->order->add_items($item); $self->_recalc(); - my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item); + my $item_id = join('_', 'new', Time::HiRes::gettimeofday(), int rand 1000000000000); + my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item, ID => $item_id); $self->js - ->append('#row_table_id tbody', $row_as_html) + ->append('#row_table_id', $row_as_html) ->val('#add_item_parts_id', '') ->val('#add_item_parts_id_name', '') ->val('#add_item_description', '') @@ -168,6 +169,7 @@ sub action_add_item { ->val('#add_item_sellprice_as_number', '') ->val('#add_item_discount_as_percent', '') ->run('row_table_scroll_down') + ->run('row_set_keyboard_events_by_id', $item_id) ->focus('#add_item_parts_id_name'); $self->_js_redisplay_amounts_and_taxes;