]> wagnertech.de Git - mfinanz.git/blobdiff - SL/Controller/Part.pm
WH: Employee::current statt manuell
[mfinanz.git] / SL / Controller / Part.pm
index 14be0ed02a7ae3566d3db37df9843bc3a30dd97f..757f1abcd27c82e1a576c35e296ad6f860f7d370 100644 (file)
@@ -41,6 +41,9 @@ use Rose::Object::MakeMethods::Generic (
 __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
@@ -157,6 +160,14 @@ sub action_save {
   }
 }
 
+sub action_abort {
+  my ($self) = @_;
+
+  if ( $::form->{callback} ) {
+    $self->redirect_to($::form->unescape($::form->{callback}));
+  }
+}
+
 sub action_delete {
   my ($self) = @_;
 
@@ -1089,7 +1100,7 @@ sub init_all_price_factors {
 }
 
 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
@@ -1334,6 +1345,12 @@ sub _setup_form_action_bar {
         ],
       ], # end of combobox "Save"
 
+      action => [
+        t8('Abort'),
+        submit   => [ '#ic', { action => "Part/abort" } ],
+        only_if  => !!$::form->{show_abort},
+      ],
+
       action => [
         t8('Delete'),
         call     => [ 'kivi.Part.delete' ],