X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fam.pl;h=997fd2c284006041dfa1049e787ee6d553dc0556;hb=eaf5d78bfb9a14f47e014160422bac92861a3b4d;hp=27b18e400fc77f1111e30112c5679d57d4fc7e6c;hpb=57bf9c89a037036fcf433de39643778854defe51;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index 27b18e400..997fd2c28 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -31,7 +31,10 @@
#
#======================================================================
+use utf8;
+
use SL::Auth;
+use SL::Auth::PasswordPolicy;
use SL::AM;
use SL::CA;
use SL::Form;
@@ -39,11 +42,9 @@ use SL::User;
use SL::USTVA;
use SL::Iconv;
use SL::TODO;
-use CGI::Ajax;
+use SL::Printer;
use CGI;
-use Data::Dumper;
-
require "bin/mozilla/common.pl";
use strict;
@@ -212,29 +213,29 @@ sub account_header {
my $select_eur = q|\n|;
my %eur = (
- 1 => "Umsatzerlöse",
- 2 => "sonstige Erlöse",
+ 1 => "Umsatzerlöse",
+ 2 => "sonstige Erlöse",
3 => "Privatanteile",
- 4 => "Zinserträge",
- 5 => "Ausserordentliche Erträge",
+ 4 => "Zinserträge",
+ 5 => "Ausserordentliche Erträge",
6 => "Vereinnahmte Umsatzst.",
7 => "Umsatzsteuererstattungen",
- 8 => "Wareneingänge",
- 9 => "Löhne und Gehälter",
+ 8 => "Wareneingänge",
+ 9 => "Löhne und Gehälter",
10 => "Gesetzl. sozialer Aufw.",
11 => "Mieten",
12 => "Gas, Strom, Wasser",
13 => "Instandhaltung",
- 14 => "Steuern, Versich., Beiträge",
+ 14 => "Steuern, Versich., Beiträge",
15 => "Kfz-Steuern",
16 => "Kfz-Versicherungen",
17 => "Sonst. Fahrzeugkosten",
18 => "Werbe- und Reisekosten",
19 => "Instandhaltung u. Werkzeuge",
- 20 => "Fachzeitschriften, Bücher",
- 21 => "Miete für Einrichtungen",
+ 20 => "Fachzeitschriften, Bücher",
+ 21 => "Miete für Einrichtungen",
22 => "Rechts- und Beratungskosten",
- 23 => "Bürobedarf, Porto, Telefon",
+ 23 => "Bürobedarf, Porto, Telefon",
24 => "Sonstige Aufwendungen",
25 => "Abschreibungen auf Anlagever.",
26 => "Abschreibungen auf GWG",
@@ -244,7 +245,7 @@ sub account_header {
30 => "Ausserordentlicher Aufwand",
31 => "Betriebliche Steuern");
foreach my $item (sort({ $a <=> $b } keys(%eur))) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $eur{$item}));
+ my $text = H($::locale->{iconv_utf8}->convert($eur{$item}));
if ($item == $form->{pos_eur}) {
$select_eur .= qq|\n|;
} else {
@@ -256,30 +257,30 @@ sub account_header {
my $select_bwa = q|\n|;
my %bwapos = (
- 1 => 'Umsatzerlöse',
+ 1 => 'Umsatzerlöse',
2 => 'Best.Verdg.FE/UE',
3 => 'Aktiv.Eigenleistung',
4 => 'Mat./Wareneinkauf',
- 5 => 'So.betr.Erlöse',
+ 5 => 'So.betr.Erlöse',
10 => 'Personalkosten',
11 => 'Raumkosten',
12 => 'Betriebl.Steuern',
- 13 => 'Vers./Beiträge',
+ 13 => 'Vers./Beiträge',
14 => 'Kfz.Kosten o.St.',
15 => 'Werbe-Reisek.',
16 => 'Kosten Warenabgabe',
17 => 'Abschreibungen',
18 => 'Rep./instandhlt.',
- 19 => 'Übrige Steuern',
+ 19 => 'Ãbrige Steuern',
20 => 'Sonst.Kosten',
30 => 'Zinsauwand',
31 => 'Sonst.neutr.Aufw.',
- 32 => 'Zinserträge',
+ 32 => 'Zinserträge',
33 => 'Sonst.neutr.Ertrag',
34 => 'Verr.kalk.Kosten',
35 => 'Steuern Eink.u.Ertr.');
foreach my $item (sort({ $a <=> $b } keys %bwapos)) {
- my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $bwapos{$item}));
+ my $text = H($::locale->{iconv_utf8}->convert($bwapos{$item}));
if ($item == $form->{pos_bwa}) {
$select_bwa .= qq|\n|;
foreach my $item ((1, 2, 3, 4)) {
if ($item == $form->{pos_bilanz}) {
@@ -331,7 +332,7 @@ sub account_header {
my %charttype = (
'A' => $locale->text('Account'),
- 'H' => $locale->text('Header'),
+ 'H' => $locale->text('Heading'),
);
foreach my $item ( sort({ $a <=> $b } keys %charttype) ) {
@@ -344,12 +345,22 @@ sub account_header {
}
+ # account where AR_tax or AP_tax is set are not orphaned if they are used as
+ # tax-o-matic account
+ if ( $form->{id} && !$form->{orphaned} && ($form->{link} =~ m/(AP_tax|AR_tax)/) ) {
+ if (SL::DB::Manager::Tax->find_by(chart_id => $form->{id})) {
+ $form->{orphaned} = 0;
+ }
+ }
+
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,
@@ -491,16 +502,7 @@ sub list_account {
$ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
- # Ajax
- my $pjx = new CGI::Ajax('list_account_details' => build_std_url('action=list_account_details'));
-
- # Eneable AJAX debuging
- #$pjx->DEBUG(1);
- #$pjx->JSDEBUG(1);
-
- push(@ { $form->{AJAX} }, $pjx);
-
- $form->{stylesheets} = "list_accounts.css";
+ $form->use_stylesheet("list_accounts.css");
$form->{title} = $locale->text('Chart of Accounts');
$form->header;
@@ -566,7 +568,6 @@ sub list_account_details {
: ( $link eq 'IC_income' ) ? $locale->text('Account Link IC_income')
: ( $link eq 'IC_expense' ) ? $locale->text('Account Link IC_expense')
: ( $link eq 'IC_taxservice' ) ? $locale->text('Account Link IC_taxservice')
-# : ( $link eq 'CT_tax' ) ? $locale->text('Account Link CT_tax')
: $locale->text('Unknown Link') . ': ' . $link;
$ca->{link} .= ($link ne '') ? "[$link] ":'';
}
@@ -582,9 +583,8 @@ sub list_account_details {
}
$form->{title} = $locale->text('Chart of Accounts');
- $form->header();
- print $form->parse_html_template('am/list_account_details');
+ print $form->ajax_response_header, $form->parse_html_template('am/list_account_details');
$main::lxdebug->leave_sub();
@@ -616,242 +616,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|$ref->{description} | |;
- $column_data{cost} = qq|$costcenter | |;
- $column_data{profit} = qq|$profitcenter | |;
-
- map { print "$column_data{$_}\n" } @column_index;
-
- print qq|
-
-|;
- }
-
- print qq|
-
- |
-
-
-
|
-
-
-
-
-
-
-
-