X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FPart.pm;h=1c8db0e5dbd319daa5a7065d3033e0a592bf1262;hb=eae5f8bdbca22f1f8c7ba4439dafbe3b89b6a143;hp=20f6752f1e113426a58281f36b78cf322f3eded1;hpb=c7e142ae1c2cc44f4ef5de1d9fabc43e5ed6244f;p=kivitendo-erp.git diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 20f6752f1..1c8db0e5d 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -40,6 +40,7 @@ __PACKAGE__->run_before('check_part_id', only => [ qw(edit delete) ]); sub action_add_part { my ($self, %params) = @_; + $::form->{callback} = $self->url_for(action => 'add_part') unless $::form->{callback}; $self->part( SL::DB::Part->new_part ); $self->add; }; @@ -47,6 +48,7 @@ sub action_add_part { sub action_add_service { my ($self, %params) = @_; + $::form->{callback} = $self->url_for(action => 'add_service') unless $::form->{callback}; $self->part( SL::DB::Part->new_service ); $self->add; }; @@ -54,6 +56,7 @@ sub action_add_service { sub action_add_assembly { my ($self, %params) = @_; + $::form->{callback} = $self->url_for(action => 'add_assembly') unless $::form->{callback}; $self->part( SL::DB::Part->new_assembly ); $self->add; }; @@ -61,6 +64,7 @@ sub action_add_assembly { sub action_add_assortment { my ($self, %params) = @_; + $::form->{callback} = $self->url_for(action => 'add_assortment') unless $::form->{callback}; $self->part( SL::DB::Part->new_assortment ); $self->add; }; @@ -130,8 +134,12 @@ sub action_save { flash_later('info', $is_new ? t8('The item has been created.') : t8('The item has been saved.')); - # reload item, this also resets last_modification! - $self->redirect_to(controller => 'Part', action => 'edit', 'part.id' => $self->part->id); + if ( $::form->{callback} ) { + $self->redirect_to($::form->unescape($::form->{callback})); + } else { + # default behaviour after save: reload item, this also resets last_modification! + $self->redirect_to(controller => 'Part', action => 'edit', 'part.id' => $self->part->id); + } } sub action_save_as_new { @@ -164,11 +172,15 @@ sub action_delete { }) or return $self->js->error(t8('The item couldn\'t be deleted!') . " " . $self->part->db->error)->render; flash_later('info', t8('The item has been deleted.')); - my @redirect_params = ( - controller => 'controller.pl', - action => 'LoginScreen/user_login' - ); - $self->redirect_to(@redirect_params); + if ( $::form->{callback} ) { + $self->redirect_to($::form->unescape($::form->{callback})); + } else { + my @redirect_params = ( + controller => 'controller.pl', + action => 'LoginScreen/user_login' + ); + $self->redirect_to(@redirect_params); + } } sub action_use_as_new {