X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=d0415618717701f7910e3d82d7067b12620eeaa7;hb=249c0c6f38350cc67eb2304538aa4ef7f329eb79;hp=b41b0ec9927034a13f40834c928a2aa1bbf8b69b;hpb=4dbb09950c9f5596646537c12d991c99086fe7c1;p=kivitendo-erp.git
diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl
index b41b0ec99..d04156187 100644
--- a/bin/mozilla/am.pl
+++ b/bin/mozilla/am.pl
@@ -24,2071 +24,1600 @@
# 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::Helper::UserPreferences;
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;
+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";
}
&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->{description} =~ s/\"/"/g;
-
+
+ $form->{"$form->{charttype}_checked"} = "checked";
+ $form->{"$form->{category}_checked"} = "checked";
+
+ $form->{select_tax} = "";
+
+ my @tax_report_pos = USTVA->report_variables({
+ myconfig => \%myconfig,
+ form => $form,
+ type => '',
+ attribute => 'position',
+ calc => '',
+ });
+
if (@{ $form->{TAXKEY} }) {
- $form->{selecttaxkey} = "|;
+ }
+ foreach my $item (@{ $form->{NEWACCOUNT} }) {
+ if ($item->{id} == $form->{new_chart_id}) {
+ $form->{selectnewaccount} .=
+ qq||;
+ } elsif (!$form->{new_chart_valid}) {
+ $form->{selectnewaccount} .=
+ qq||;
+ }
+ }
}
-
-
- $eur = qq|
-
- |.$locale->text('EÜR').qq| |
- |
-
-
|;
-
- $form->{selectbwa} = "\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->{selectbwa} .= "\n|;
}
-
}
-
-
- $bwa = qq|
-
- |.$locale->text('BWA').qq| |
- |
-
-
|;
-
- $form->{selectbilanz} = "\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->{selectbilanz} .= "\n|;
}
-
}
-
-
- $bilanz = qq|
-
- |.$locale->text('Bilanz').qq| |
- |
-
-
|;
-# this is for our parser only!
-# type=submit $locale->text('Add Account')
-# type=submit $locale->text('Edit Account')
-
- $form->header;
- print qq|
-
-
-
-
-