ActionBar: Verwendung bei »Konto erfassen/bearbeiten«
[kivitendo-erp.git] / bin / mozilla / am.pl
index ec27fbb..a62fa15 100644 (file)
@@ -109,7 +109,6 @@ sub edit_account {
   }
 
   &account_header;
-  &form_footer;
 
   $main::lxdebug->leave_sub();
 }
@@ -372,6 +371,8 @@ sub account_header {
   my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":"";
   my $AccountIsPosted = ($form->{orphaned} ) ? "":"1";
 
+  setup_am_edit_account_action_bar();
+
   $form->header();
 
   my $parameters_ref = {
@@ -1394,3 +1395,36 @@ sub setup_am_config_action_bar {
     );
   }
 }
+
+sub setup_am_edit_account_action_bar {
+  my %params = @_;
+
+  for my $bar ($::request->layout->get('actionbar')) {
+    $bar->add(
+      combobox => [
+        action => [
+          t8('Save'),
+          submit    => [ '#form', { action => "save_account" } ],
+          disabled  => $::form->{id} && !$::form->{orphaned} ? t8('The object is in use and cannot be changed.')
+                     :                                         undef,
+          accesskey => 'enter',
+        ],
+
+        action => [
+          t8('Save as new'),
+          submit   => [ '#form', { action => "save_as_new_account" } ],
+          disabled => !$::form->{id} ? t8('The object has not been saved yet.') : undef,
+        ],
+      ],
+
+      action => [
+        t8('Delete'),
+        submit   => [ '#form', { action => "delete_account" } ],
+        disabled => !$::form->{id}                         ? t8('The object has not been saved yet.')
+                  :  $::form->{id} && !$::form->{orphaned} ? t8('The object is in use and cannot be deleted.')
+                  :                                          undef,
+        confirm  => t8('Do you really want to delete this object?'),
+      ],
+    );
+  }
+}