__PACKAGE__->run_before(sub { $::auth->assert('part_service_assembly_edit') },
except => [ qw(ajax_autocomplete part_picker_search part_picker_result) ]);
+__PACKAGE__->run_before(sub { $::auth->assert('developer') },
+ only => [ qw(test_page) ]);
+
__PACKAGE__->run_before('check_part_id', only => [ qw(edit delete) ]);
# actions for editing parts
# $self->part has been loaded, parsed and validated without errors and is ready to be saved
$self->part->db->with_transaction(sub {
- if ( $params{save_as_new} ) {
- $self->part( $self->part->clone_and_reset_deep );
- $self->part->partnumber(undef); # will be assigned by _before_save_set_partnumber
- };
-
$self->part->save(cascade => 1);
SL::DB::History->new(
}
}
-sub action_save_as_new {
+sub action_abort {
my ($self) = @_;
- $self->action_save(save_as_new=>1);
+
+ if ( $::form->{callback} ) {
+ $self->redirect_to($::form->unescape($::form->{callback}));
+ }
}
sub action_delete {
}
sub init_all_pricegroups {
- SL::DB::Manager::Pricegroup->get_all_sorted;
+ SL::DB::Manager::Pricegroup->get_all_sorted(query => [ obsolete => 0 ]);
}
# model used to filter/display the parts in the multi-items dialog
],
], # end of combobox "Save"
+ action => [
+ t8('Abort'),
+ submit => [ '#ic', { action => "Part/abort" } ],
+ only_if => !!$::form->{show_abort},
+ ],
+
action => [
t8('Delete'),
call => [ 'kivi.Part.delete' ],