X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=137243877fcc6116fde8c2ea67963011a5412d11;hb=cb0eb91f7b04f728b1057d130f111ad465e8b16a;hp=306cf65259c66c8cff754cc3d9580a4f78db0595;hpb=9ecdc996e7a73cede3cb8fd0e5617154f0c95367;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 306cf6525..d8580bbda 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -24,50 +24,87 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1335, USA. #====================================================================== # # administration # #====================================================================== +use utf8; + +use List::MoreUtils qw(any); + +use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::AM; use SL::CA; use SL::Form; +use SL::Helper::Flash; use SL::User; +use SL::USTVA; +use SL::Iconv; +use SL::Locale::String qw(t8); +use SL::TODO; +use SL::DB::Printer; +use SL::DB::Tax; +use SL::DB::Language; +use SL::DB::Default; +use SL::DBUtils qw(selectall_array_query conv_dateq); +use CGI; -use Data::Dumper; +require "bin/mozilla/common.pl"; + +use strict; 1; # end of main -sub add { &{"add_$form->{type}"} } -sub edit { &{"edit_$form->{type}"} } -sub save { &{"save_$form->{type}"} } -sub delete { &{"delete_$form->{type}"} } +sub add { call_sub("add_$main::form->{type}"); } +sub delete { call_sub("delete_$main::form->{type}"); } +sub save { call_sub("save_$main::form->{type}"); } +sub edit { call_sub("edit_$main::form->{type}"); } +sub continue { call_sub($main::form->{"nextsub"}); } +sub save_as_new { call_sub("save_as_new_$main::form->{type}"); } sub add_account { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + + $main::auth->assert('config'); $form->{title} = "Add"; $form->{charttype} = "A"; AM->get_account(\%myconfig, \%$form); - $form->{callback} = - "$form->{script}?action=list_account&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; + $form->{callback} = "am.pl?action=list_account" unless $form->{callback}; &account_header; &form_footer; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub edit_account { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $defaults = SL::DB::Default->get; + + $main::auth->assert('config'); $form->{title} = "Edit"; + $form->{feature_balance} = $defaults->feature_balance; + $form->{feature_datev} = $defaults->feature_datev; + $form->{feature_erfolgsrechnung} = $defaults->feature_erfolgsrechnung; + $form->{feature_eurechnung} = $defaults->feature_eurechnung; + $form->{feature_ustva} = $defaults->feature_ustva; + AM->get_account(\%myconfig, \%$form); foreach my $item (split(/:/, $form->{link})) { @@ -75,495 +112,379 @@ sub edit_account { } &account_header; - &form_footer; - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub account_header { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; + + $main::auth->assert('config'); + + if ( $form->{action} eq 'edit_account') { + $form->{account_exists} = '1'; + } $form->{title} = $locale->text("$form->{title} Account"); - $checked{ $form->{charttype} } = "checked"; - $checked{"$form->{category}_"} = "checked"; - $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked"; + $form->{"$form->{charttype}_checked"} = "checked"; + $form->{"$form->{category}_checked"} = "checked"; + + $form->{select_tax} = ""; - $form->{description} =~ s/\"/"/g; + my @tax_report_pos = USTVA->report_variables({ + myconfig => \%myconfig, + form => $form, + type => '', + attribute => 'position', + calc => '', + }); if (@{ $form->{TAXKEY} }) { - $form->{selecttaxkey} = ""; + $form->{selectnewaccount} = qq||; } - foreach $item (@{ $form->{NEWACCOUNT} }) { + foreach my $item (@{ $form->{NEWACCOUNT} }) { if ($item->{id} == $form->{new_chart_id}) { $form->{selectnewaccount} .= - ""; + qq||; } elsif (!$form->{new_chart_valid}) { $form->{selectnewaccount} .= - ""; + qq||; } } } - $newaccount = qq| - - - - - - - - - -
| . $locale->text('Folgekonto') . qq|| . $locale->text('Gültig ab') . qq|
- - |; - - $form->{selectustva} = "\n|; + my %eur = %{ AM->get_eur_categories(\%myconfig, $form) }; + foreach my $item (sort({ $a <=> $b } keys(%eur))) { + my $text = H($::locale->{iconv_utf8}->convert($eur{$item})); + if ($item == $form->{pos_eur}) { + $select_eur .= qq|\n|; } else { - $form->{selectustva} .= "\n|; } } - $ustva = qq| - - | . $locale->text('Umsatzsteuervoranmeldung') . qq| - - - |; - - $form->{selecteur} = "\n|; + my %er = ( + 1 => "Ertrag", + 6 => "Aufwand"); + foreach my $item (sort({ $a <=> $b } keys(%er))) { + my $text = H($::locale->{iconv_utf8}->convert($er{$item})); + if ($item == $form->{pos_er}) { + $select_er .= qq|\n|; } else { - $form->{selecteur} .= "\n|; } } - $eur = qq| - - | . $locale->text('EUER') . qq| - - - |; - - $form->{selectbwa} = "\n|; + + my %bwapos = %{ AM->get_bwa_categories(\%myconfig, $form) }; + foreach my $item (sort({ $a <=> $b } keys %bwapos)) { + my $text = H($::locale->{iconv_utf8}->convert($bwapos{$item})); if ($item == $form->{pos_bwa}) { - $form->{selectbwa} .= "\n|; + foreach my $item ((1, 2, 3, 4)) { + if ($item == $form->{pos_bilanz}) { + $select_bilanz .= qq|\n|; + + my %category = ( + 'A' => $locale->text('Asset'), + 'L' => $locale->text('Liability'), + 'Q' => $locale->text('Equity'), + 'I' => $locale->text('Revenue'), + 'E' => $locale->text('Expense'), + 'C' => $locale->text('Costs'), + ); + foreach my $item ( sort({ $a <=> $b } keys %category) ) { + if ($item eq $form->{category}) { + $select_category .= qq|