X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=b6996d169b1e34edda36daa47affa331d5e93f0c;hb=dfb76ebf04df9aed8ba63d7b51bc558d2928030e;hp=c6bb8e47c1ea6a6ca0bf4cfe6b30c7c4594adc0d;hpb=27ae86579fb8833067e9d6c02cf5429d98b28449;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index c6bb8e47c..b6996d169 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -46,8 +46,6 @@ use SL::Printer; use CGI::Ajax; use CGI; -use Data::Dumper; - require "bin/mozilla/common.pl"; use strict; @@ -349,11 +347,13 @@ sub account_header { } my $ChartTypeIsAccount = ($form->{charttype} eq "A") ? "1":""; + my $AccountIsPosted = ($form->{orphaned} ) ? "":"1"; $form->header(); my $parameters_ref = { ChartTypeIsAccount => $ChartTypeIsAccount, + AccountIsPosted => $AccountIsPosted, select_category => $select_category, select_charttype => $select_charttype, select_bwa => $select_bwa, @@ -620,242 +620,6 @@ sub delete_account { $main::lxdebug->leave_sub(); } -sub add_department { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - $form->{role} = "P"; - - $form->{callback} = "am.pl?action=add_department" unless $form->{callback}; - - &department_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_department { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_department(\%myconfig, \%$form); - - &department_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_department { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->departments(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_department"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Departments'); - - my @column_index = qw(description cost profit); - my %column_header; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{cost} = - qq|| - . $locale->text('Cost Center') - . qq||; - $column_header{profit} = - qq|| - . $locale->text('Profit Center') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - my $costcenter = ($ref->{role} eq "C") ? "X" : ""; - my $profitcenter = ($ref->{role} eq "P") ? "X" : ""; - - $column_data{description} = - qq||; - $column_data{cost} = qq||; - $column_data{profit} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$ref->{description}$costcenter$profitcenter
-

- -
-
- - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub department_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Department"); - - # $locale->text('Add Department') - # $locale->text('Edit Department') - - $form->{description} =~ s/\"/"/g; - - my ($rows, $description); - if (($rows = $form->numtextrows($form->{description}, 60)) > 1) { - $description = - qq||; - } else { - $description = - qq||; - } - - my $costcenter = "checked" if $form->{role} eq "C"; - my $profitcenter = "checked" if $form->{role} eq "P"; - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Description') . qq|$description
| - . $locale->text('Cost Center') . qq| - | - . $locale->text('Profit Center') . qq| -

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_department { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - AM->save_department(\%myconfig, \%$form); - $form->redirect($locale->text('Department saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_department { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_department(\%myconfig, \%$form); - $form->redirect($locale->text('Department deleted!')); - - $main::lxdebug->leave_sub(); -} - sub add_lead { $main::lxdebug->enter_sub(); @@ -1058,251 +822,6 @@ sub delete_lead { $main::lxdebug->leave_sub(); } -sub add_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_business" unless $form->{callback}; - - &business_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $form->{title} = "Edit"; - - AM->get_business(\%myconfig, \%$form); - - &business_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->business(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_business"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Type of Business'); - - my @column_index = qw(description discount customernumberinit); - push @column_index, 'salesman' if $::lx_office_conf{features}->{vertreter}; - my %column_header; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{discount} = - qq|| - . $locale->text('Discount') - . qq| %|; - $column_header{customernumberinit} = - qq|| - . $locale->text('Customernumberinit') - . qq||; - $column_header{salesman} = - qq|| - . $locale->text('Representative') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - my $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100); - my $description = $ref->{description}; - $column_data{description} = qq||; - $column_data{discount} = qq||; - $column_data{customernumberinit} = - qq||; - $column_data{salesman} = ''; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$description$discount$ref->{customernumberinit}' . ($ref->{salesman} ? $::locale->text('Yes') : $::locale->text('No')) . '
-

- -
- - - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub business_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Business"); - - # $locale->text('Add Business') - # $locale->text('Edit Business') - - $form->{description} =~ s/\"/"/g; - $form->{discount} = - $form->format_amount(\%myconfig, $form->{discount} * 100); - - my $salesman_code; - if ($::lx_office_conf{features}->{vertreter}) { - $salesman_code = qq| - - | . $locale->text('Representative') . qq| - | . $::cgi->checkbox(-name => "salesman", -value => 1, -label => '', 'checked' => $form->{salesman} ? 1 : 0) . qq| - -|; - } else { - $salesman_code = $::cgi->hidden(-name => 'salesman', -value => $form->{salesman} ? 1 : 0); - } - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - -$salesman_code - - -
$form->{title}
| . $locale->text('Type of Business') . qq|
| . $locale->text('Discount') . qq| %{discount}>
| . $locale->text('Customernumberinit') . qq|{customernumberinit}>

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100; - AM->save_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business deleted!')); - - $main::lxdebug->leave_sub(); -} - sub add_language { $main::lxdebug->enter_sub(); @@ -1873,17 +1392,18 @@ sub buchungsgruppe_header { } my $linkaccounts; - if (!$::lx_office_conf{system}->{eur}) { + if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) { $linkaccounts = qq| | . $locale->text('Inventory') . qq| |; - } else { + } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) { + # don't allow choice of inventory accno and don't show that line $linkaccounts = qq| {inventory_accno_id}>|; - } + }; $linkaccounts .= qq| @@ -2031,6 +1551,11 @@ sub edit_defaults { map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; + # default language + my $all_languages = SL::DB::Manager::Language->get_all; + +# EÜR = cash, Bilanzierung = accrual + foreach my $key (keys %{ $form->{IC} }) { foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { my $array = "ACCNOS_" . uc($key); @@ -2048,7 +1573,8 @@ sub edit_defaults { $form->{title} = $locale->text('Ranges of numbers and default accounts'); $form->header(); - print $form->parse_html_template('am/edit_defaults'); + print $form->parse_html_template('am/edit_defaults', + { ALL_LANGUAGES => $all_languages, }); $main::lxdebug->leave_sub(); } @@ -2136,14 +1662,7 @@ sub config { { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, }, ]; - $form->{PRINTERS} = []; - foreach my $printer (SL::Printer->all_printers(%::myconfig)) { - push @{ $form->{PRINTERS} }, { - 'name' => $printer->{printer_description}, - 'value' => $printer->{id}, - 'selected' => $printer->{id} == $myconfig{default_printer_id}, - }; - } + $form->{PRINTERS} = [ SL::Printer->all_printers(%::myconfig) ]; my %countrycodes = User->country_codes; @@ -2532,7 +2051,8 @@ sub show_am_history { my $dbh = $form->dbconnect(\%myconfig); - my $restriction = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen}; + my $restriction; + $restriction = qq| AND (| . join(' OR ', map { " addition = " . $dbh->quote($_) } split(m/\,/, $form->{einschraenkungen})) . qq|)| if $form->{einschraenkungen}; $restriction .= qq| AND h.itime::date >= | . conv_dateq($form->{fromdate}) if $form->{fromdate}; $restriction .= qq| AND h.itime::date <= | . conv_dateq($form->{todate}) if $form->{todate}; if ($form->{mitarbeiter} =~ m/^\d+$/) {