]> wagnertech.de Git - mfinanz.git/blobdiff - SL/AM.pm
kivitendo 3.9.2-0.2
[mfinanz.git] / SL / AM.pm
index 2d8ed4cff168c52942304db708cd37b65c80a599..56faba3b2969168278f6854c1ef8aa32ddb0fec8 100644 (file)
--- a/SL/AM.pm
+++ b/SL/AM.pm
@@ -57,6 +57,7 @@ use SL::Helper::UserPreferences::PositionsScrollbar;
 use SL::Helper::UserPreferences::PartPickerSearch;
 use SL::Helper::UserPreferences::TimeRecording;
 use SL::Helper::UserPreferences::UpdatePositions;
+use SL::Helper::UserPreferences::ItemInputPosition;
 
 use strict;
 
@@ -90,14 +91,17 @@ sub get_account {
     my $chart_obj = SL::DB::Manager::Chart->find_by(id => $form->{id}) || die "Can't open chart";
 
     my @chart_fields = qw(accno description charttype category link pos_bilanz
-                          pos_eur pos_er new_chart_id valid_from pos_bwa datevautomatik);
+                          pos_eur pos_er new_chart_id valid_from pos_bwa datevautomatik
+                          invalid);
     foreach my $cf ( @chart_fields ) {
       $form->{"$cf"} = $chart_obj->$cf;
     }
 
     my $active_taxkey = $chart_obj->get_active_taxkey;
-    $form->{$_}  = $active_taxkey->$_ foreach qw(taxkey_id pos_ustva tax_id startdate);
-    $form->{tax} = $active_taxkey->tax_id . '--' . $active_taxkey->taxkey_id;
+    if ($active_taxkey) {
+      $form->{$_}  = $active_taxkey->$_ foreach qw(taxkey_id pos_ustva tax_id startdate);
+      $form->{tax} = $active_taxkey->tax_id . '--' . $active_taxkey->taxkey_id;
+    }
 
     # check if there are any transactions for this chart
     $form->{orphaned} = $chart_obj->has_transaction ? 0 : 1;
@@ -232,7 +236,8 @@ sub _save_account {
                   pos_er = ?,
                   new_chart_id = ?,
                   valid_from = ?,
-                  datevautomatik = ?
+                  datevautomatik = ?,
+                  invalid = ?
                 WHERE id = ?|;
 
     @values = (
@@ -248,6 +253,7 @@ sub _save_account {
                   conv_i($form->{new_chart_id}),
                   conv_date($form->{valid_from}),
                   ($form->{datevautomatik} eq 'T') ? 'true':'false',
+                  $form->{invalid} ? 'true' : 'false',
                 $form->{id},
     );
 
@@ -556,6 +562,18 @@ sub longdescription_dialog_size_percentage {
   SL::Helper::UserPreferences::DisplayPreferences->new()->get_longdescription_dialog_size_percentage();
 }
 
+sub layout_style {
+  SL::Helper::UserPreferences::DisplayPreferences->new()->get_layout_style();
+}
+
+sub part_picker_search_all_as_list_default {
+  SL::Helper::UserPreferences::PartPickerSearch->new()->get_all_as_list_default();
+}
+
+sub order_item_input_position {
+  SL::Helper::UserPreferences::ItemInputPosition->new()->get_order_item_input_position();
+}
+
 sub save_preferences {
   $main::lxdebug->enter_sub();
 
@@ -599,6 +617,15 @@ sub save_preferences {
   if (exists $form->{longdescription_dialog_size_percentage}) {
     SL::Helper::UserPreferences::DisplayPreferences->new()->store_longdescription_dialog_size_percentage($form->{longdescription_dialog_size_percentage})
   }
+  if (exists $form->{layout_style}) {
+    SL::Helper::UserPreferences::DisplayPreferences->new()->store_layout_style($form->{layout_style})
+  }
+  if (exists $form->{part_picker_search_all_as_list_default}) {
+    SL::Helper::UserPreferences::PartPickerSearch->new()->store_all_as_list_default($form->{part_picker_search_all_as_list_default})
+  }
+  if (exists $form->{order_item_input_position}) {
+    SL::Helper::UserPreferences::ItemInputPosition->new()->store_order_item_input_position($form->{order_item_input_position})
+  }
 
   $main::lxdebug->leave_sub();
 
@@ -1393,7 +1420,8 @@ sub get_warehouse {
        UNION
        SELECT DISTINCT bin_id, TRUE AS in_use FROM parts
      ) use ON use.bin_id = b.id
-     WHERE b.warehouse_id = ?;
+     WHERE b.warehouse_id = ?
+     ORDER by description;
 SQL
 
   $form->{BINS} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id}));