X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fam.pl;h=ee2b0e6486526a2d9ae137b180d8af58c573fc6c;hb=eb8d3de878876804b0465ec7cde9adfff436a5a0;hp=c28656795682d5ac501c385dbf4e8fd8b46d66ca;hpb=44e1ec6fcc2422cb75d36578245e16a33acef2d8;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index c28656795..ee2b0e648 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -31,12 +31,14 @@
#
#======================================================================
+use SL::Auth;
use SL::AM;
use SL::CA;
use SL::Form;
use SL::User;
use SL::USTVA;
use SL::Iconv;
+use SL::TODO;
use CGI::Ajax;
use CGI;
@@ -57,13 +59,13 @@ sub continue { call_sub($form->{"nextsub"}); }
sub add_account {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = "Add";
$form->{charttype} = "A";
AM->get_account(\%myconfig, \%$form);
- $form->{callback} =
- "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
+ $form->{callback} = "am.pl?action=list_account" unless $form->{callback};
&account_header;
&form_footer;
@@ -74,6 +76,8 @@ sub add_account {
sub edit_account {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = "Edit";
AM->get_account(\%myconfig, \%$form);
@@ -90,6 +94,8 @@ sub edit_account {
sub account_header {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
if ( $form->{action} eq 'edit_account') {
$form->{account_exists} = '1';
}
@@ -348,12 +354,11 @@ sub account_header {
sub form_footer {
$lxdebug->enter_sub();
- print qq|
+ $auth->assert('config');
-
+ print qq|
-{login}>
-{password}>
+
|;
if ((!$form->{id}) || ($form->{id} && $form->{orphaned}) || (($form->{type} eq "account") && (!$form->{new_chart_valid}))) {
@@ -381,6 +386,8 @@ sub form_footer {
sub save_account {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->isblank("accno", $locale->text('Account Number missing!'));
$form->isblank("description", $locale->text('Account Description missing!'));
@@ -398,18 +405,12 @@ sub save_account {
sub list_account {
$lxdebug->enter_sub();
- CA->all_accounts(\%myconfig, \%$form);
-
- $form->{title} = $locale->text('Chart of Accounts');
+ $auth->assert('config');
- # construct callback
- $callback =
- "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
+ $form->{callback} = build_std_url('action=list_account');
+ my $link_edit_account = build_std_url('action=edit_account', 'callback');
-
-
- # escape callback
- $callback = $form->escape($callback);
+ CA->all_accounts(\%myconfig, \%$form);
foreach $ca (@{ $form->{CA} }) {
@@ -423,19 +424,11 @@ sub list_account {
$ca->{debit} = $form->format_amount(\%myconfig, -1 * $ca->{amount}, 2);
}
$ca->{heading} = ( $ca->{charttype} eq 'H' ) ? 1:'';
- $ca->{link_edit_account} =
- qq|$form->{script}?action=edit_account&id=$ca->{id}|
- .qq|&login=$form->{login}|
- .qq|&password=$form->{password}&callback=$callback|;
+ $ca->{link_edit_account} = $link_edit_account . '&id=' . E($ca->{id});
}
# Ajax
- my $list_account_details_url =
- "$form->{script}?login=$form->{login}"
- ."&password=$form->{password}&action=list_account_details&";
-
-
- my $pjx = new CGI::Ajax('list_account_details' => $list_account_details_url);
+ my $pjx = new CGI::Ajax('list_account_details' => build_std_url('action=list_account_details'));
# Eneable AJAX debuging
#$pjx->DEBUG(1);
@@ -444,6 +437,7 @@ sub list_account {
push(@ { $form->{AJAX} }, $pjx);
$form->{stylesheets} = "list_accounts.css";
+ $form->{title} = $locale->text('Chart of Accounts');
$form->header;
@@ -453,7 +447,7 @@ sub list_account {
};
# Ausgabe des Templates
- print($form->parse_html_template2('am/list_accounts', $parameters_ref));
+ print($form->parse_html_template('am/list_accounts', $parameters_ref));
$lxdebug->leave_sub();
@@ -461,23 +455,14 @@ sub list_account {
sub list_account_details {
-# Ajax Funktion aus list_account_details
+# Ajax Funktion aus list_account_details
$lxdebug->enter_sub();
- my $chart_id = $form->{args};
-
- CA->all_accounts(\%myconfig, \%$form, $chart_id);
-
- $form->{title} = $locale->text('Chart of Accounts');
+ $auth->assert('config');
- # construct callback
- $callback =
- "$form->{script}?action=list_account&login=$form->{login}&password=$form->{password}";
-
- $form->header;
+ my $chart_id = $form->{args};
- # escape callback
- $callback = $form->escape($callback);
+ CA->all_accounts(\%myconfig, \%$form, $chart_id);
foreach $ca (@{ $form->{CA} }) {
@@ -494,11 +479,11 @@ sub list_account_details {
}
my @links = split( q{:}, $ca->{link});
-
+
$ca->{link} = q{};
-
+
foreach my $link (@links){
- $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
+ $link = ( $link eq 'AR') ? $locale->text('Account Link AR')
: ( $link eq 'AP') ? $locale->text('Account Link AP')
: ( $link eq 'IC') ? $locale->text('Account Link IC')
: ( $link eq 'AR_amount' ) ? $locale->text('Account Link AR_amount')
@@ -515,16 +500,8 @@ sub list_account_details {
: ( $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] ":'';
}
-
- $ca->{startdate} =~ s/,/
/og;
- $ca->{tk_ustva} =~ s/,/
/og;
- $ca->{taxkey} =~ s/,/
/og;
- $ca->{taxaccount} =~ s/,/
/og;
- $ca->{taxdescription} =~ s/,/
/og;
- $ca->{datevautomatik} = ($ca->{datevautomatik}) ? $locale->text('On'):$locale->text('Off');
$ca->{category} = ($ca->{category} eq 'A') ? $locale->text('Account Category A')
: ($ca->{category} eq 'E') ? $locale->text('Account Category E')
@@ -534,29 +511,13 @@ sub list_account_details {
: ($ca->{category} eq 'C') ? $locale->text('Account Category C')
: ($ca->{category} eq 'G') ? $locale->text('Account Category G')
: $locale->text('Unknown Category') . ': ' . $ca->{category};
-
- $ca->{link_edit_account} =
- qq|$form->{script}?action=edit_account&id=$ca->{id}|
- .qq|&login=$form->{login}|
- .qq|&password=$form->{password}&callback=$callback|;
}
+ $form->{title} = $locale->text('Chart of Accounts');
+ $form->header();
+ print $form->parse_html_template('am/list_account_details');
-
- my $parameters_ref = {
-
-
- # hidden_variables => $_hidden_variables_ref,
- };
-
- # Ausgabe des Templates
- #my $q = CGI->new();
- my $result = $form->parse_html_template('am/list_account_details', $parameters_ref);
-
- print $result;
-# print "chart_id:$chart_id, form->chartid:$form->{chart_id}, rest=$rest";
-
$lxdebug->leave_sub();
}
@@ -564,6 +525,8 @@ sub list_account_details {
sub delete_account {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = $locale->text('Delete Account');
foreach $id (
@@ -584,12 +547,12 @@ sub delete_account {
sub add_department {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = "Add";
$form->{role} = "P";
- $form->{callback} =
- "$form->{script}?action=add_department&login=$form->{login}&password=$form->{password}"
- unless $form->{callback};
+ $form->{callback} = "am.pl?action=add_department" unless $form->{callback};
&department_header;
&form_footer;
@@ -600,6 +563,8 @@ sub add_department {
sub edit_department {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
$form->{title} = "Edit";
AM->get_department(\%myconfig, \%$form);
@@ -613,10 +578,11 @@ sub edit_department {
sub list_department {
$lxdebug->enter_sub();
+ $auth->assert('config');
+
AM->departments(\%myconfig, \%$form);
- $form->{callback} =
- "$form->{script}?action=list_department&login=$form->{login}&password=$form->{password}";
+ $form->{callback} = "am.pl?action=list_department";
$callback = $form->escape($form->{callback});
@@ -672,7 +638,7 @@ sub list_department {
$profitcenter = ($ref->{role} eq "P") ? "X" : "";
$column_data{description} =
- qq|