X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=e12c1ea51b9b18e77913b2018c81d586943dfae0;hb=bc5c9dac50b13fd17e7ec567179c4dfb6acf3a02;hp=e5be21ecc0585a1f790a9e8c1ccca2f97c5b3db5;hpb=c904f865b0f9d1da094f2ca5198796829277d8e4;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e5be21ecc..e12c1ea51 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -43,6 +43,8 @@ use SL::USTVA; use SL::Iconv; use SL::TODO; use SL::DB::Printer; +use SL::DB::Tax; +use SL::DB::Language; use CGI; require "bin/mozilla/common.pl"; @@ -935,60 +937,6 @@ sub swap_buchungsgruppen { $main::lxdebug->leave_sub(); } -sub edit_defaults { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - # get defaults for account numbers and last numbers - AM->defaultaccounts(\%myconfig, \%$form); - $form->{ALL_UNITS} = AM->convertible_units(AM->retrieve_all_units(), 'g'); - - map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; - - # default language - my $all_languages = SL::DB::Manager::Language->get_all; - -# cash = IST-Versteuerung, accrual = SOLL-Versteuerung - - foreach my $key (keys %{ $form->{IC} }) { - foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { - my $array = "ACCNOS_" . uc($key); - $form->{$array} ||= []; - - my $value = "${accno}--" . $form->{IC}->{$key}->{$accno}->{description}; - push @{ $form->{$array} }, { - 'name' => $value, - 'value' => $value, - 'selected' => $form->{IC}->{$key}->{$accno}->{id} == $form->{defaults}->{$key}, - }; - } - } - - $form->{title} = $locale->text('Ranges of numbers and default accounts'); - - $form->header(); - print $form->parse_html_template('am/edit_defaults', - { ALL_LANGUAGES => $all_languages, }); - - $main::lxdebug->leave_sub(); -} - -sub save_defaults { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - AM->save_defaults(); - - $form->redirect($locale->text('Defaults saved.')); - - $main::lxdebug->leave_sub(); -} - sub _build_cfg_options { my $form = $main::form; my %myconfig = %main::myconfig; @@ -1014,6 +962,7 @@ sub config { my $locale = $main::locale; _build_cfg_options('dateformat', qw(mm/dd/yy dd/mm/yy dd.mm.yy yyyy-mm-dd)); + _build_cfg_options('timeformat', qw(hh:mm hh:mm:ss)); _build_cfg_options('numberformat', ('1,000.00', '1000.00', '1.000,00', '1000,00')); my @formats = (); @@ -1104,7 +1053,7 @@ sub save_preferences { TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } }); - if (AM->save_preferences(\%myconfig, $form)) { + if (AM->save_preferences($form)) { if ($::auth->can_change_password() && defined $form->{new_password} && ($form->{new_password} ne '********')) { @@ -1116,10 +1065,6 @@ sub save_preferences { } $::auth->change_password($form->{login}, $form->{new_password}); - - $form->{password} = $form->{new_password}; - $::auth->set_session_value('password', $form->{password}); - $::auth->create_or_refresh_session(); } $form->redirect($locale->text('Preferences saved!')); @@ -1472,6 +1417,7 @@ sub add_tax { my $parameters_ref = { # ChartTypeIsAccount => $ChartTypeIsAccount, + LANGUAGES => SL::DB::Manager::Language->get_all_sorted, }; # Ausgabe des Templates @@ -1507,6 +1453,8 @@ sub edit_tax { $form->header(); my $parameters_ref = { + LANGUAGES => SL::DB::Manager::Language->get_all_sorted, + TAX => SL::DB::Manager::Tax->find_by(id => $form->{id}), }; # Ausgabe des Templates @@ -1585,6 +1533,9 @@ sub save_tax { $form->error($locale->text('Tax Percent is a number between 0 and 100')); } + my @translation_keys = grep { $_ =~ '^translation_\d+' } keys %$form; + $form->{translations} = { map { $_ =~ '^translation_(\d+)'; $1 => $form->{$_} } @translation_keys }; + AM->save_tax(\%myconfig, \%$form); $form->redirect($locale->text('Tax saved!')); @@ -1616,7 +1567,6 @@ sub add_price_factor { $form->{title} = $locale->text('Add Price Factor'); $form->{callback} ||= build_std_url('action=add_price_factor'); - $::request->{layout}->focus('#description'); $form->header(); print $form->parse_html_template('am/edit_price_factor'); @@ -1635,7 +1585,6 @@ sub edit_price_factor { $form->{title} = $locale->text('Edit Price Factor'); $form->{callback} ||= build_std_url('action=add_price_factor'); - $::request->{layout}->focus('#description'); AM->get_price_factor(\%myconfig, $form); @@ -1723,7 +1672,6 @@ sub add_warehouse { $form->{title} = $locale->text('Add Warehouse'); $form->{callback} ||= build_std_url('action=add_warehouse'); - $::request->{layout}->focus('#description'); $form->header(); print $form->parse_html_template('am/edit_warehouse'); @@ -1746,7 +1694,6 @@ sub edit_warehouse { $form->{title} = $locale->text('Edit Warehouse'); $form->{callback} ||= build_std_url('action=list_warehouses'); - $::request->{layout}->focus('#description'); $form->header(); print $form->parse_html_template('am/edit_warehouse');