X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/4dbb09950c9f5596646537c12d991c99086fe7c1..8f7fe4a4:/bin/mozilla/am.pl diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index b41b0ec99..8ef12063a 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -24,57 +24,85 @@ # 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 SL::Auth; +use SL::Auth::PasswordPolicy; use SL::AM; use SL::CA; use SL::Form; use SL::User; +use SL::USTVA; +use SL::Iconv; +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; +require "bin/mozilla/common.pl"; -1; -# end of main - +use strict; +1; -sub add { &{ "add_$form->{type}" } }; -sub edit { &{ "edit_$form->{type}" } }; -sub save { &{ "save_$form->{type}" } }; -sub delete { &{ "delete_$form->{type}" } }; +# end of main +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 { + $main::lxdebug->enter_sub(); + my $form = $main::form; + my %myconfig = %main::myconfig; -sub add_account { - $lxdebug->enter_sub(); + $main::auth->assert('config'); - - $form->{title} = "Add"; + $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})) { $form->{$item} = "checked"; } @@ -82,2013 +110,1270 @@ 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; - $form->{title} = $locale->text("$form->{title} Account"); - - $checked{$form->{charttype}} = "checked"; - $checked{"$form->{category}_"} = "checked"; - $checked{CT_tax} = ($form->{CT_tax}) ? "" : "checked"; - - $form->{description} =~ s/\"/"/g; - - if (@{ $form->{TAXKEY} }) { - $form->{selecttaxkey} = "\n|; + foreach my $item ((1, 2, 3, 4)) { + if ($item == $form->{pos_bilanz}) { + $select_bilanz .= qq|\n|; - foreach $id (qw(inventory_accno_id income_accno_id expense_accno_id fxgain_accno_id fxloss_accno_id)) { - if ($form->{id} == $form->{$id}) { - $form->error($locale->text('Cannot delete default account!')); + 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|