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;
}
# 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;
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();
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;