X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAM.pm;h=b5a283abbfc87b19329fcd28abbafaa87f480312;hb=fdfa491825c63dfd18be378083206c3806b2a02d;hp=7616edbe592e6d92860318d71068e6b3f03e1e17;hpb=5570a18e7da5c73191f82c5f71c08eeb7ec6dccb;p=kivitendo-erp.git diff --git a/SL/AM.pm b/SL/AM.pm index 7616edbe5..b5a283abb 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -47,8 +47,13 @@ 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; +use SL::Helper::UserPreferences::PositionsScrollbar; +use SL::Helper::UserPreferences::PartPickerSearch; use strict; @@ -114,7 +119,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 +512,35 @@ 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 positions_scrollbar_height { + SL::Helper::UserPreferences::PositionsScrollbar->new()->get_height(); +} + +sub purchase_search_makemodel { + SL::Helper::UserPreferences::PartPickerSearch->new()->get_purchase_search_makemodel(); +} + +sub sales_search_customer_partnumber { + SL::Helper::UserPreferences::PartPickerSearch->new()->get_sales_search_customer_partnumber(); +} + sub save_preferences { $main::lxdebug->enter_sub(); @@ -522,6 +556,26 @@ 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}); + } + } + + if (exists $form->{positions_scrollbar_height}) { + SL::Helper::UserPreferences::PositionsScrollbar->new()->store_height($form->{positions_scrollbar_height}) + } + if (exists $form->{purchase_search_makemodel}) { + SL::Helper::UserPreferences::PartPickerSearch->new()->store_purchase_search_makemodel($form->{purchase_search_makemodel}) + } + if (exists $form->{sales_search_customer_partnumber}) { + SL::Helper::UserPreferences::PartPickerSearch->new()->store_sales_search_customer_partnumber($form->{sales_search_customer_partnumber}) + } + $main::lxdebug->leave_sub(); return 1; @@ -970,13 +1024,16 @@ sub taxes { t.taxkey, t.taxdescription, round(t.rate * 100, 2) AS rate, - (SELECT accno FROM chart WHERE id = chart_id) AS taxnumber, - (SELECT description FROM chart WHERE id = chart_id) AS account_description, - (SELECT accno FROM chart WHERE id = skonto_sales_chart_id) AS skonto_chart_accno, - (SELECT description FROM chart WHERE id = skonto_sales_chart_id) AS skonto_chart_description, - (SELECT accno FROM chart WHERE id = skonto_purchase_chart_id) AS skonto_chart_purchase_accno, - (SELECT description FROM chart WHERE id = skonto_purchase_chart_id) AS skonto_chart_purchase_description + tc.accno AS taxnumber, + tc.description AS account_description, + ssc.accno AS skonto_chart_accno, + ssc.description AS skonto_chart_description, + spc.accno AS skonto_chart_purchase_accno, + spc.description AS skonto_chart_purchase_description FROM tax t + LEFT JOIN chart tc ON (tc.id = t.chart_id) + LEFT JOIN chart ssc ON (ssc.id = t.skonto_sales_chart_id) + LEFT JOIN chart spc ON (spc.id = t.skonto_purchase_chart_id) ORDER BY taxkey, rate|; my $sth = $dbh->prepare($query); @@ -1124,7 +1181,6 @@ sub _save_tax { taxdescription = ?, rate = ?, chart_id = ?, - taxnumber = (SELECT accno FROM chart WHERE id = ? ), skonto_sales_chart_id = ?, skonto_purchase_chart_id = ?, chart_categories = ? @@ -1138,7 +1194,6 @@ sub _save_tax { taxdescription, rate, chart_id, - taxnumber, skonto_sales_chart_id, skonto_purchase_chart_id, chart_categories, @@ -1305,12 +1360,14 @@ sub get_warehouse { map { $form->{$_} = $ref->{$_} } keys %{ $ref }; $query = <{BINS} = selectall_hashref_query($form, $dbh, $query, conv_i($form->{id}));