X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/95278e0ace83c7d82633799ac638582184df552e..862bc8ce30cd40b67d2856ac7f1d11d5e4322f09:/SL/Controller/Order.pm?ds=sidebyside diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 508fdfef6..631ab16dd 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -93,7 +93,7 @@ sub action_delete { flash_later('info', $::locale->text('The order has been deleted')); my @redirect_params = ( - action => 'edit', + action => 'add', type => $self->type, ); @@ -783,6 +783,8 @@ sub _make_item { $item->assign_attributes(%$attr); $item->longdescription($item->part->notes) if $is_new && !defined $attr->{longdescription}; + # item fields that currently can't be set in in row but are needed: + $item->lastcost($item->part->lastcost) if $is_new; return $item; } @@ -847,7 +849,7 @@ sub _new_item { # recalculate prices and taxes # -# Using the PriceTaxCalclulator. Store linetotals in the item objects. +# Using the PriceTaxCalculator. Store linetotals in the item objects. sub _recalc { my ($self) = @_; @@ -891,9 +893,9 @@ sub _delete { my ($self) = @_; my $errors = []; - my $db = $self->order->db; + my $db = $self->order->db; - $db->do_transaction( + $db->with_transaction( sub { my @spoolfiles = grep { $_ } map { $_->spoolfile } @{ SL::DB::Manager::Status->get_all(where => [ trans_id => $self->order->id ]) }; $self->order->delete; @@ -913,12 +915,11 @@ sub _save { my ($self) = @_; my $errors = []; - my $db = $self->order->db; + my $db = $self->order->db; - $db->do_transaction( - sub { - SL::DB::OrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete}; - $self->order->save(cascade => 1); + $db->with_transaction(sub { + SL::DB::OrderItem->new(id => $_)->delete for @{$self->item_ids_to_delete}; + $self->order->save(cascade => 1); }) || push(@{$errors}, $db->error); return $errors; @@ -1058,36 +1059,44 @@ The aim is to provide the user a better expirience and a faster flow of work. Also the code should be more readable, more reliable and better to maintain. -=head2 key features +=head2 Key Features -=over 2 +=over 4 =item * + One input row, so that input happens every time at the same place. =item * + Use of pickers where possible. =item * + Possibility to enter more than one item at once. =item * + Save order only on "save" (and "save and delivery order"-workflow). No -hidden save on "print" or "email". +hidden save on "print" or "email". =item * + Item list in a scrollable area, so that the workflow buttons stay at the bottom. =item * + Reordering item rows with drag and drop is possible. Sorting item rows is possible (by partnumber, description, qty, sellprice and discount for now). =item * -No "update" is necessary. All entries and calculations are managed -with ajax-calls and the page does only reload on "save". + +No C is necessary. All entries and calculations are managed +with ajax-calls and the page does only reload on C. =item * + User can see changes immediately, because of the use of java script and ajax. @@ -1095,128 +1104,151 @@ and ajax. =head1 CODE -=head2 layout +=head2 Layout -=over 2 +=over 4 -=item * -SL/Controller/Order.pm: the controller +=item * C -=item * -template/webpages/order/form.html: main form +the controller -=item * -template/webpages/order/tabs/basic_data.html: main tab for basic_data +=item * C