X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=bin%2Fmozilla%2Fam.pl;h=997fd2c284006041dfa1049e787ee6d553dc0556;hb=eaf5d78bfb9a14f47e014160422bac92861a3b4d;hp=e96c604a189e9d4d1658dfdc068a647ebff8c665;hpb=4791db863d4fa954318024ea1d79e62572ae2eb1;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e96c604a1..997fd2c28 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -43,11 +43,8 @@ use SL::USTVA; use SL::Iconv; use SL::TODO; use SL::Printer; -use CGI::Ajax; use CGI; -use Data::Dumper; - require "bin/mozilla/common.pl"; use strict; @@ -348,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, @@ -495,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; @@ -570,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] ":''; } @@ -586,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(); @@ -620,7 +616,7 @@ sub delete_account { $main::lxdebug->leave_sub(); } -sub add_department { +sub add_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -628,17 +624,16 @@ sub add_department { $main::auth->assert('config'); $form->{title} = "Add"; - $form->{role} = "P"; - $form->{callback} = "am.pl?action=add_department" unless $form->{callback}; + $form->{callback} = "am.pl?action=add_lead" unless $form->{callback}; - &department_header; + &lead_header; &form_footer; $main::lxdebug->leave_sub(); } -sub edit_department { +sub edit_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -648,15 +643,17 @@ sub edit_department { $form->{title} = "Edit"; - AM->get_department(\%myconfig, \%$form); + AM->get_lead(\%myconfig, \%$form); + + &lead_header; - &department_header; + $form->{orphaned} = 1; &form_footer; $main::lxdebug->leave_sub(); } -sub list_department { +sub list_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -665,28 +662,20 @@ sub list_department { $main::auth->assert('config'); - AM->departments(\%myconfig, \%$form); + AM->lead(\%myconfig, \%$form); - $form->{callback} = "am.pl?action=list_department"; + $form->{callback} = "am.pl?action=list_lead"; my $callback = $form->escape($form->{callback}); - $form->{title} = $locale->text('Departments'); + $form->{title} = $locale->text('Lead'); my @column_index = qw(description cost profit); my %column_header; $column_header{description} = - qq|
$ref->{description} | |; - $column_data{cost} = qq|$costcenter | |; - $column_data{profit} = qq|$profitcenter | |; + $column_data{description} = qq|$ref->{lead} | |; map { print "$column_data{$_}\n" } @column_index; print qq| -