Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / Controller / FinancialControllingReport.pm
index 125a8a8..f4f09ff 100644 (file)
@@ -37,6 +37,7 @@ sub action_list {
 
   $self->calculate_data;
 
+  $self->setup_list_action_bar;
   $self->list_objects;
 }
 
@@ -243,6 +244,7 @@ sub init_models {
     query => [
       SL::DB::Manager::Order->type_filter('sales_order'),
       '!closed' => 1,
+      (salesman_id => SL::DB::Manager::Employee->current->id) x !$::auth->assert('sales_all_edit', 1),
       or        => [
         globalproject_id => undef,
         and              => [
@@ -276,7 +278,11 @@ sub link_to {
     my $type = $object->type;
     my $id   = $object->id;
 
-    return "oe.pl?action=$action&type=$type&vc=customer&id=$id";
+    if ($::instance_conf->get_feature_experimental_order) {
+      return "controller.pl?action=Order/$action&type=$type&id=$id";
+    } else {
+      return "oe.pl?action=$action&type=$type&vc=customer&id=$id";
+    }
   }
   if ($object->isa('SL::DB::Customer')) {
     my $id     = $object->id;
@@ -288,4 +294,18 @@ sub link_to {
   }
 }
 
+sub setup_list_action_bar {
+  my ($self, %params) = @_;
+
+  for my $bar ($::request->layout->get('actionbar')) {
+    $bar->add(
+      action => [
+        t8('Update'),
+        submit    => [ '#filter_form', { action => 'FinancialControllingReport/list' } ],
+        accesskey => 'enter',
+      ],
+    );
+  }
+}
+
 1;