X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/5570a18e7da5c73191f82c5f71c08eeb7ec6dccb..90a1b6fad6aeeab84fc96d6511fdf42fff315df5:/SL/AM.pm diff --git a/SL/AM.pm b/SL/AM.pm index 7616edbe5..5db3f71ca 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -47,6 +47,9 @@ use SL::DB::AuthUser; use SL::DB::Default; use SL::DB::Employee; use SL::DB::Chart; +use SL::DB::Customer; +use SL::DB::Part; +use SL::DB::Vendor; use SL::DB; use SL::GenericTranslations; @@ -114,7 +117,7 @@ sub get_account { } # get new accounts (Folgekonto). Find all charts with the same link - $form->{NEWACCOUNT} = $chart_obj->db->dbh->selectall_arrayref('select id, accno,description from chart where link = ? order by accno', {Slice => {}}, $chart_obj->link); + $form->{NEWACCOUNT} = $chart_obj->db->dbh->selectall_arrayref('select id, accno,description from chart where link = ? and id != ? order by accno', {Slice => {}}, $chart_obj->link, $form->{id}); } else { # set to orphaned for new charts, so chart_type can be changed (needed by $AccountIsPosted) $form->{orphaned} = 1; @@ -507,6 +510,23 @@ sub save_template { return $error; } +sub displayable_name_specs_by_module { + +{ + 'SL::DB::Customer' => { + specs => SL::DB::Customer->displayable_name_specs, + prefs => SL::DB::Customer->displayable_name_prefs, + }, + 'SL::DB::Vendor' => { + specs => SL::DB::Vendor->displayable_name_specs, + prefs => SL::DB::Vendor->displayable_name_prefs, + }, + 'SL::DB::Part' => { + specs => SL::DB::Part->displayable_name_specs, + prefs => SL::DB::Part->displayable_name_prefs, + }, + }; +} + sub save_preferences { $main::lxdebug->enter_sub(); @@ -522,6 +542,16 @@ sub save_preferences { map { ($_ => $form->{$_}) } SL::DB::AuthUser::CONFIG_VARS(), }); + # Displayable name preferences + my $displayable_name_specs_by_module = displayable_name_specs_by_module(); + foreach my $specs (@{ $form->{displayable_name_specs} }) { + if (!$specs->{value} || $specs->{value} eq $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->get_default()) { + $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->delete($specs->{value}); + } else { + $displayable_name_specs_by_module->{$specs->{module}}->{prefs}->store_value($specs->{value}); + } + } + $main::lxdebug->leave_sub(); return 1; @@ -1305,12 +1335,14 @@ sub get_warehouse { map { $form->{$_} = $ref->{$_} } keys %{ $ref }; $query = <{BINS} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id}));