X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=368a627161bddaa0d5491dfa512db952e2dd7b74;hb=bd1ece25ff151772844eb6318f02ade2470602db;hp=3cb5ac3d819a28b752c940ff6fa1abc0ce51f4fe;hpb=b65a230d60e86d2c18a3ab7222379905aea5ecd7;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index 3cb5ac3d8..368a62716 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -31,7 +31,10 @@ # #====================================================================== +use utf8; + use SL::Auth; +use SL::Auth::PasswordPolicy; use SL::AM; use SL::CA; use SL::Form; @@ -39,11 +42,10 @@ use SL::User; 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; @@ -212,29 +214,29 @@ sub account_header { my $select_eur = q|\n|; my %eur = ( - 1 => "Umsatzerlöse", - 2 => "sonstige Erlöse", + 1 => "Umsatzerlöse", + 2 => "sonstige Erlöse", 3 => "Privatanteile", - 4 => "Zinserträge", - 5 => "Ausserordentliche Erträge", + 4 => "Zinserträge", + 5 => "Ausserordentliche Erträge", 6 => "Vereinnahmte Umsatzst.", 7 => "Umsatzsteuererstattungen", - 8 => "Wareneingänge", - 9 => "Löhne und Gehälter", + 8 => "Wareneingänge", + 9 => "Löhne und Gehälter", 10 => "Gesetzl. sozialer Aufw.", 11 => "Mieten", 12 => "Gas, Strom, Wasser", 13 => "Instandhaltung", - 14 => "Steuern, Versich., Beiträge", + 14 => "Steuern, Versich., Beiträge", 15 => "Kfz-Steuern", 16 => "Kfz-Versicherungen", 17 => "Sonst. Fahrzeugkosten", 18 => "Werbe- und Reisekosten", 19 => "Instandhaltung u. Werkzeuge", - 20 => "Fachzeitschriften, Bücher", - 21 => "Miete für Einrichtungen", + 20 => "Fachzeitschriften, Bücher", + 21 => "Miete für Einrichtungen", 22 => "Rechts- und Beratungskosten", - 23 => "Bürobedarf, Porto, Telefon", + 23 => "Bürobedarf, Porto, Telefon", 24 => "Sonstige Aufwendungen", 25 => "Abschreibungen auf Anlagever.", 26 => "Abschreibungen auf GWG", @@ -244,7 +246,7 @@ sub account_header { 30 => "Ausserordentlicher Aufwand", 31 => "Betriebliche Steuern"); foreach my $item (sort({ $a <=> $b } keys(%eur))) { - my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $eur{$item})); + my $text = H($::locale->{iconv_utf8}->convert($eur{$item})); if ($item == $form->{pos_eur}) { $select_eur .= qq|\n|; } else { @@ -256,30 +258,30 @@ sub account_header { my $select_bwa = q|\n|; my %bwapos = ( - 1 => 'Umsatzerlöse', + 1 => 'Umsatzerlöse', 2 => 'Best.Verdg.FE/UE', 3 => 'Aktiv.Eigenleistung', 4 => 'Mat./Wareneinkauf', - 5 => 'So.betr.Erlöse', + 5 => 'So.betr.Erlöse', 10 => 'Personalkosten', 11 => 'Raumkosten', 12 => 'Betriebl.Steuern', - 13 => 'Vers./Beiträge', + 13 => 'Vers./Beiträge', 14 => 'Kfz.Kosten o.St.', 15 => 'Werbe-Reisek.', 16 => 'Kosten Warenabgabe', 17 => 'Abschreibungen', 18 => 'Rep./instandhlt.', - 19 => 'Übrige Steuern', + 19 => 'Übrige Steuern', 20 => 'Sonst.Kosten', 30 => 'Zinsauwand', 31 => 'Sonst.neutr.Aufw.', - 32 => 'Zinserträge', + 32 => 'Zinserträge', 33 => 'Sonst.neutr.Ertrag', 34 => 'Verr.kalk.Kosten', 35 => 'Steuern Eink.u.Ertr.'); foreach my $item (sort({ $a <=> $b } keys %bwapos)) { - my $text = H(SL::Iconv::convert("ISO-8859-15", $main::dbcharset, $bwapos{$item})); + my $text = H($::locale->{iconv_utf8}->convert($bwapos{$item})); if ($item == $form->{pos_bwa}) { $select_bwa .= qq|\n|; foreach my $item ((1, 2, 3, 4)) { if ($item == $form->{pos_bilanz}) { @@ -331,7 +333,7 @@ sub account_header { my %charttype = ( 'A' => $locale->text('Account'), - 'H' => $locale->text('Header'), + 'H' => $locale->text('Heading'), ); foreach my $item ( sort({ $a <=> $b } keys %charttype) ) { @@ -500,7 +502,7 @@ sub list_account { push(@ { $form->{AJAX} }, $pjx); - $form->{stylesheets} = "list_accounts.css"; + $form->use_stylesheet("list_accounts.css"); $form->{title} = $locale->text('Chart of Accounts'); $form->header; @@ -616,7 +618,7 @@ sub delete_account { $main::lxdebug->leave_sub(); } -sub add_department { +sub add_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -624,17 +626,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; @@ -644,15 +645,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; @@ -661,28 +664,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|| + qq|| . $locale->text('Description') . qq||; - $column_header{cost} = - qq|| - . $locale->text('Cost Center') - . qq||; - $column_header{profit} = - qq|| - . $locale->text('Profit Center') - . qq||; $form->header; @@ -694,16 +689,13 @@ sub list_department { $form->{title} - - - - + |; map { print "$column_header{$_}\n" } @column_index; print qq| - + |; my ($i, %column_data); @@ -713,28 +705,21 @@ sub list_department { $i %= 2; print qq| - + |; - my $costcenter = ($ref->{role} eq "C") ? "X" : ""; - my $profitcenter = ($ref->{role} eq "P") ? "X" : ""; +# $lead = $ref->{lead}; - $column_data{description} = - qq||; - $column_data{cost} = qq||; - $column_data{profit} = qq||; + $column_data{description} = qq||; map { print "$column_data{$_}\n" } @column_index; print qq| - + |; } print qq| -
$ref->{description}$costcenter$profitcenter$ref->{lead}
- -
@@ -745,7 +730,7 @@ sub list_department { - + @@ -759,7 +744,7 @@ sub list_department { $main::lxdebug->leave_sub(); } -sub department_header { +sub lead_header { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -767,24 +752,15 @@ sub department_header { $main::auth->assert('config'); - $form->{title} = $locale->text("$form->{title} Department"); + $form->{title} = $locale->text("$form->{title} Lead"); - # $locale->text('Add Department') - # $locale->text('Edit Department') + # $locale->text('Add Lead') + # $locale->text('Edit Lead') $form->{description} =~ s/\"/"/g; - my ($rows, $description); - if (($rows = $form->numtextrows($form->{description}, 60)) > 1) { - $description = - qq||; - } else { - $description = - qq||; - } - - my $costcenter = "checked" if $form->{role} eq "C"; - my $profitcenter = "checked" if $form->{role} eq "P"; + my $description = + qq||; $form->header; @@ -794,7 +770,7 @@ sub department_header {
{id}> - + @@ -805,14 +781,6 @@ sub department_header { - - - -
| . $locale->text('Description') . qq| $description
| - . $locale->text('Cost Center') . qq| - | - . $locale->text('Profit Center') . qq| -

@@ -821,7 +789,7 @@ sub department_header { $main::lxdebug->leave_sub(); } -sub save_department { +sub save_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -831,13 +799,13 @@ sub save_department { $main::auth->assert('config'); $form->isblank("description", $locale->text('Description missing!')); - AM->save_department(\%myconfig, \%$form); - $form->redirect($locale->text('Department saved!')); + AM->save_lead(\%myconfig, \%$form); + $form->redirect($locale->text('lead saved!')); $main::lxdebug->leave_sub(); } -sub delete_department { +sub delete_lead { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -846,13 +814,13 @@ sub delete_department { $main::auth->assert('config'); - AM->delete_department(\%myconfig, \%$form); - $form->redirect($locale->text('Department deleted!')); + AM->delete_lead(\%myconfig, \%$form); + $form->redirect($locale->text('lead deleted!')); $main::lxdebug->leave_sub(); } -sub add_lead { +sub add_language { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -861,15 +829,15 @@ sub add_lead { $form->{title} = "Add"; - $form->{callback} = "am.pl?action=add_lead" unless $form->{callback}; + $form->{callback} = "am.pl?action=add_language" unless $form->{callback}; - &lead_header; + &language_header; &form_footer; $main::lxdebug->leave_sub(); } -sub edit_lead { +sub edit_language { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -879,9 +847,9 @@ sub edit_lead { $form->{title} = "Edit"; - AM->get_lead(\%myconfig, \%$form); + AM->get_language(\%myconfig, \%$form); - &lead_header; + &language_header; $form->{orphaned} = 1; &form_footer; @@ -889,7 +857,7 @@ sub edit_lead { $main::lxdebug->leave_sub(); } -sub list_lead { +sub list_language { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -898,20 +866,40 @@ sub list_lead { $main::auth->assert('config'); - AM->lead(\%myconfig, \%$form); + AM->language(\%myconfig, \%$form); - $form->{callback} = "am.pl?action=list_lead"; + $form->{callback} = "am.pl?action=list_language"; my $callback = $form->escape($form->{callback}); - $form->{title} = $locale->text('Lead'); + $form->{title} = $locale->text('Languages'); - my @column_index = qw(description cost profit); + my @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates); my %column_header; $column_header{description} = - qq|| + qq|| . $locale->text('Description') . qq||; + $column_header{template_code} = + qq|| + . $locale->text('Template Code') + . qq||; + $column_header{article_code} = + qq|| + . $locale->text('Article Code') + . qq||; + $column_header{output_numberformat} = + qq|| + . $locale->text('Number Format') + . qq||; + $column_header{output_dateformat} = + qq|| + . $locale->text('Date Format') + . qq||; + $column_header{output_longdates} = + qq|| + . $locale->text('Long Dates') + . qq||; $form->header; @@ -923,13 +911,16 @@ sub list_lead { $form->{title} - + + + + |; map { print "$column_header{$_}\n" } @column_index; print qq| - + |; my ($i, %column_data); @@ -939,21 +930,41 @@ sub list_lead { $i %= 2; print qq| - + |; -# $lead = $ref->{lead}; - $column_data{description} = qq||; + $column_data{description} = + qq||; + $column_data{template_code} = qq||; + $column_data{article_code} = + qq||; + $column_data{output_numberformat} = + ""; + $column_data{output_dateformat} = + ""; + $column_data{output_longdates} = + ""; map { print "$column_data{$_}\n" } @column_index; print qq| - + |; } print qq| +
$ref->{lead}$ref->{description}$ref->{template_code}$ref->{article_code}" . + ($ref->{output_numberformat} ? $ref->{output_numberformat} : + $locale->text("use program settings")) . + "" . + ($ref->{output_dateformat} ? $ref->{output_dateformat} : + $locale->text("use program settings")) . + "" . + ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) . + "
+ +
@@ -964,7 +975,7 @@ sub list_lead { - + @@ -978,7 +989,7 @@ sub list_lead { $main::lxdebug->leave_sub(); } -sub lead_header { +sub language_header { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -986,25 +997,47 @@ sub lead_header { $main::auth->assert('config'); - $form->{title} = $locale->text("$form->{title} Lead"); + $form->{title} = $locale->text("$form->{title} Language"); - # $locale->text('Add Lead') - # $locale->text('Edit Lead') + # $locale->text('Add Language') + # $locale->text('Edit Language') $form->{description} =~ s/\"/"/g; + $form->{template_code} =~ s/\"/"/g; + $form->{article_code} =~ s/\"/"/g; - my $description = - qq||; $form->header; + my $numberformat = + qq||; + foreach my $item (('1,000.00', '1000.00', '1.000,00', '1000,00')) { + $numberformat .= + ($item eq $form->{output_numberformat}) + ? ""; + } + + my $dateformat = + qq||; + foreach my $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { + $dateformat .= + ($item eq $form->{output_dateformat}) + ? ""; + } + print qq| {id}> - + @@ -1012,10 +1045,36 @@ sub lead_header { - - + + + + + + - + + + + + + + + + + + + + + + + +
| . $locale->text('Description') . qq|$description| . $locale->text('Language') . qq|
| . $locale->text('Template Code') . qq|

| . $locale->text('Article Code') . qq|
| . $locale->text('Number Format') . qq|
| . $locale->text('Date Format') . qq|
| . $locale->text('Long Dates') . qq|{output_longdates} ? " checked" : "") . + qq|>| . $locale->text("Yes") . + qq|{output_longdates} ? "" : " checked") . + qq|>| . $locale->text("No") . + qq|

|; @@ -1023,7 +1082,7 @@ sub lead_header { $main::lxdebug->leave_sub(); } -sub save_lead { +sub save_language { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -1032,14 +1091,16 @@ sub save_lead { $main::auth->assert('config'); - $form->isblank("description", $locale->text('Description missing!')); - AM->save_lead(\%myconfig, \%$form); - $form->redirect($locale->text('lead saved!')); + $form->isblank("description", $locale->text('Language missing!')); + $form->isblank("template_code", $locale->text('Template Code missing!')); + $form->isblank("article_code", $locale->text('Article Code missing!')); + AM->save_language(\%myconfig, \%$form); + $form->redirect($locale->text('Language saved!')); $main::lxdebug->leave_sub(); } -sub delete_lead { +sub delete_language { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -1048,48 +1109,61 @@ sub delete_lead { $main::auth->assert('config'); - AM->delete_lead(\%myconfig, \%$form); - $form->redirect($locale->text('lead deleted!')); + AM->delete_language(\%myconfig, \%$form); + $form->redirect($locale->text('Language deleted!')); $main::lxdebug->leave_sub(); } -sub add_business { + +sub add_buchungsgruppe { $main::lxdebug->enter_sub(); my $form = $main::form; + my %myconfig = %main::myconfig; + my $locale = $main::locale; $main::auth->assert('config'); + # $locale->text("Add Buchungsgruppe") + # $locale->text("Edit Buchungsgruppe") $form->{title} = "Add"; - $form->{callback} = "am.pl?action=add_business" unless $form->{callback}; + $form->{callback} = "am.pl?action=add_buchungsgruppe" unless $form->{callback}; + + AM->get_buchungsgruppe(\%myconfig, \%$form); + $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; + for (my $i = 0; 4 > $i; $i++) { + map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; } + qw(income expense)); + } - &business_header; + &buchungsgruppe_header; &form_footer; $main::lxdebug->leave_sub(); } -sub edit_business { +sub edit_buchungsgruppe { $main::lxdebug->enter_sub(); my $form = $main::form; my %myconfig = %main::myconfig; + $main::auth->assert('config'); + $form->{title} = "Edit"; - AM->get_business(\%myconfig, \%$form); + AM->get_buchungsgruppe(\%myconfig, \%$form); - &business_header; + &buchungsgruppe_header; - $form->{orphaned} = 1; &form_footer; $main::lxdebug->leave_sub(); } -sub list_business { +sub list_buchungsgruppe { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -1098,1227 +1172,68 @@ sub list_business { $main::auth->assert('config'); - AM->business(\%myconfig, \%$form); + AM->buchungsgruppe(\%myconfig, \%$form); - $form->{callback} = "am.pl?action=list_business"; + $form->{callback} = "am.pl?action=list_buchungsgruppe"; my $callback = $form->escape($form->{callback}); - $form->{title} = $locale->text('Type of Business'); - - my @column_index = qw(description discount customernumberinit); - my %column_header; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{discount} = - qq|| - . $locale->text('Discount') - . qq| %|; - $column_header{customernumberinit} = - qq|| - . $locale->text('Customernumberinit') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - my $discount = $form->format_amount(\%myconfig, $ref->{discount} * 100); - my $description = $ref->{description}; - $column_data{description} = qq||; - $column_data{discount} = qq||; - $column_data{customernumberinit} = - qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$description$discount$ref->{customernumberinit}
-

- -
- - - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub business_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Business"); - - # $locale->text('Add Business') - # $locale->text('Edit Business') - - $form->{description} =~ s/\"/"/g; - $form->{discount} = - $form->format_amount(\%myconfig, $form->{discount} * 100); - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Type of Business') . qq|
| . $locale->text('Discount') . qq| %{discount}>
| . $locale->text('Customernumberinit') . qq|{customernumberinit}>

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - $form->{discount} = $form->parse_amount(\%myconfig, $form->{discount}) / 100; - AM->save_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_business { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_business(\%myconfig, \%$form); - $form->redirect($locale->text('Business deleted!')); - - $main::lxdebug->leave_sub(); -} - -sub add_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_language" unless $form->{callback}; - - &language_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_language(\%myconfig, \%$form); - - &language_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->language(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_language"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Languages'); - - my @column_index = qw(description template_code article_code output_numberformat output_dateformat output_longdates); - my %column_header; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{template_code} = - qq|| - . $locale->text('Template Code') - . qq||; - $column_header{article_code} = - qq|| - . $locale->text('Article Code') - . qq||; - $column_header{output_numberformat} = - qq|| - . $locale->text('Number Format') - . qq||; - $column_header{output_dateformat} = - qq|| - . $locale->text('Date Format') - . qq||; - $column_header{output_longdates} = - qq|| - . $locale->text('Long Dates') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{description} = - qq||; - $column_data{template_code} = qq||; - $column_data{article_code} = - qq||; - $column_data{output_numberformat} = - ""; - $column_data{output_dateformat} = - ""; - $column_data{output_longdates} = - ""; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$ref->{description}$ref->{template_code}$ref->{article_code}" . - ($ref->{output_numberformat} ? $ref->{output_numberformat} : - $locale->text("use program settings")) . - "" . - ($ref->{output_dateformat} ? $ref->{output_dateformat} : - $locale->text("use program settings")) . - "" . - ($ref->{output_longdates} ? $locale->text("Yes") : $locale->text("No")) . - "
-

- -
- - - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub language_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Language"); - - # $locale->text('Add Language') - # $locale->text('Edit Language') - - $form->{description} =~ s/\"/"/g; - $form->{template_code} =~ s/\"/"/g; - $form->{article_code} =~ s/\"/"/g; - - - $form->header; - - my $numberformat = - qq||; - foreach my $item (('1,000.00', '1000.00', '1.000,00', '1000,00')) { - $numberformat .= - ($item eq $form->{output_numberformat}) - ? ""; - } - - my $dateformat = - qq||; - foreach my $item (qw(mm-dd-yy mm/dd/yy dd-mm-yy dd/mm/yy dd.mm.yy yyyy-mm-dd)) { - $dateformat .= - ($item eq $form->{output_dateformat}) - ? ""; - } - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Language') . qq|
| . $locale->text('Template Code') . qq|
| . $locale->text('Article Code') . qq|
| . $locale->text('Number Format') . qq|
| . $locale->text('Date Format') . qq|
| . $locale->text('Long Dates') . qq|{output_longdates} ? " checked" : "") . - qq|>| . $locale->text("Yes") . - qq|{output_longdates} ? "" : " checked") . - qq|>| . $locale->text("No") . - qq|

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Language missing!')); - $form->isblank("template_code", $locale->text('Template Code missing!')); - $form->isblank("article_code", $locale->text('Article Code missing!')); - AM->save_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_language { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_language(\%myconfig, \%$form); - $form->redirect($locale->text('Language deleted!')); - - $main::lxdebug->leave_sub(); -} - - -sub add_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - # $locale->text("Add Buchungsgruppe") - # $locale->text("Edit Buchungsgruppe") - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_buchungsgruppe" unless $form->{callback}; - - AM->get_buchungsgruppe(\%myconfig, \%$form); - $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; - for (my $i = 0; 4 > $i; $i++) { - map({ $form->{"${_}_accno_id_$i"} = $form->{"std_${_}_accno_id"}; } - qw(income expense)); - } - - &buchungsgruppe_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_buchungsgruppe(\%myconfig, \%$form); - - &buchungsgruppe_header; - - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->buchungsgruppe(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_buchungsgruppe"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Buchungsgruppen'); - - my @column_index = qw(up down description inventory_accno - income_accno_0 expense_accno_0 - income_accno_1 expense_accno_1 - income_accno_2 expense_accno_2 - income_accno_3 expense_accno_3 ); - my %column_header; - $column_header{up} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{down} = - qq|| - . qq|| . $locale->text(| - . qq||; - $column_header{description} = - qq|| - . $locale->text('Description') - . qq||; - $column_header{inventory_accno} = - qq|| - . $locale->text('Bestandskonto') - . qq||; - $column_header{income_accno_0} = - qq|| - . $locale->text('National Revenues') - . qq||; - $column_header{expense_accno_0} = - qq|| - . $locale->text('National Expenses') - . qq||; - $column_header{income_accno_1} = - qq|| - . $locale->text('Revenues EU with UStId') - . qq||; - $column_header{expense_accno_1} = - qq|| - . $locale->text('Expenses EU with UStId') - . qq||; - $column_header{income_accno_2} = - qq|| - . $locale->text('Revenues EU without UStId') - . qq||; - $column_header{expense_accno_2} = - qq|| - . $locale->text('Expenses EU without UStId') - . qq||; - $column_header{income_accno_3} = - qq|| - . $locale->text('Foreign Revenues') - . qq||; - $column_header{expense_accno_3} = - qq|| - . $locale->text('Foreign Expenses') - . qq||; - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|; - - my $row = 0; - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - if ($row) { - my $pref = $form->{ALL}->[$row - 1]; - $column_data{up} = - qq||; - } else { - $column_data{up} = qq||; - } - - if ($row == (scalar(@{ $form->{ALL} }) - 1)) { - $column_data{down} = qq||; - } else { - my $nref = $form->{ALL}->[$row + 1]; - $column_data{down} = - qq||; - } - - $column_data{description} = qq||; - $column_data{inventory_accno} = qq||; - $column_data{income_accno_0} = - qq||; - $column_data{expense_accno_0} = qq||; - $column_data{income_accno_1} = - qq||; - $column_data{expense_accno_1} = qq||; - $column_data{income_accno_2} = - qq||; - $column_data{expense_accno_2} = qq||; - $column_data{income_accno_3} = - qq||; - $column_data{expense_accno_3} = qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - - $row++; - } - - print qq| -
| . - qq|| . - qq|| . $locale->text(| . - qq|  | . - qq|| . - qq|| . $locale->text(| . - qq|$ref->{description}$ref->{inventory_accno}$ref->{income_accno_0}$ref->{expense_accno_0}$ref->{income_accno_1}$ref->{expense_accno_1}$ref->{income_accno_2}$ref->{expense_accno_2}$ref->{income_accno_3}$ref->{expense_accno_3}
-

- -
- - - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub buchungsgruppe_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Buchungsgruppe"); - - # $locale->text('Add Accounting Group') - # $locale->text('Edit Accounting Group') - - my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); - my %acc_type_map = ( - "IC" => $acc_inventory, - "IC_income" => $acc_income, - "IC_sale" => $acc_income, - "IC_expense" => $acc_expense, - "IC_cogs" => $acc_expense, - ); - - foreach my $key (keys(%acc_type_map)) { - foreach my $ref (@{ $form->{IC_links}{$key} }) { - $acc_type_map{$key}->{$ref->{"id"}} = $ref; - } - } - - foreach my $type (qw(IC IC_income IC_expense)) { - $form->{"select$type"} = - join("", - map({ "" } - sort({ $a->{"accno"} cmp $b->{"accno"} } - values(%{$acc_type_map{$type}})))); - } - - if ($form->{id}) { - $form->{selectIC} =~ s/selected//g; - $form->{selectIC} =~ s/ value=\Q$form->{inventory_accno_id}\E/ value=$form->{inventory_accno_id} selected/; - $form->{selectIC_income} =~ s/selected//g; - $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_0}\E/ value=$form->{income_accno_id_0} selected/; - $form->{selectIC_expense} =~ s/selected//g; - $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/ value=$form->{expense_accno_id_0} selected/; - } - - my $linkaccounts; - if (!$main::eur) { - $linkaccounts = qq| - - | . $locale->text('Inventory') . qq| - - - |; - } else { - $linkaccounts = qq| - {inventory_accno_id}>|; - } - - - $linkaccounts .= qq| - - | . $locale->text('National Revenues') . qq| - - - - | . $locale->text('National Expenses') . qq| - - |; - if ($form->{id}) { - $form->{selectIC_income} =~ s/selected//g; - $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_1}\E/ value=$form->{income_accno_id_1} selected/; - $form->{selectIC_expense} =~ s/selected//g; - $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_1}\E/ value=$form->{expense_accno_id_1} selected/; - } - $linkaccounts .= qq| - | . $locale->text('Revenues EU with UStId') . qq| - - - - | . $locale->text('Expenses EU with UStId') . qq| - - |; - - if ($form->{id}) { - $form->{selectIC_income} =~ s/selected//g; - $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_2}\E/ value=$form->{income_accno_id_2} selected/; - $form->{selectIC_expense} =~ s/selected//g; - $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_2}\E/ value=$form->{expense_accno_id_2} selected/; - } - - $linkaccounts .= qq| - | . $locale->text('Revenues EU without UStId') . qq| - - - - | . $locale->text('Expenses EU without UStId') . qq| - - |; - - if ($form->{id}) { - $form->{selectIC_income} =~ s/selected//g; - $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_3}\E/ value=$form->{income_accno_id_3} selected/; - $form->{selectIC_expense} =~ s/selected//g; - $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_3}\E/ value=$form->{expense_accno_id_3} selected/; - } - - $linkaccounts .= qq| - | . $locale->text('Foreign Revenues') . qq| - - - - | . $locale->text('Foreign Expenses') . qq| - - -|; - - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - $linkaccounts - - -
$form->{title}
| . $locale->text('Buchungsgruppe') . qq|

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("description", $locale->text('Description missing!')); - - AM->save_buchungsgruppe(\%myconfig, \%$form); - $form->redirect($locale->text('Accounting Group saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_buchungsgruppe { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_buchungsgruppe(\%myconfig, \%$form); - $form->redirect($locale->text('Accounting Group deleted!')); - - $main::lxdebug->leave_sub(); -} - -sub swap_buchungsgruppen { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen"); - list_buchungsgruppe(); - - $main::lxdebug->leave_sub(); -} - - -sub add_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_printer" unless $form->{callback}; - - &printer_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_printer(\%myconfig, \%$form); - - &printer_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->printer(\%myconfig, \%$form); - - $form->{callback} = "am.pl?action=list_printer"; - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Printer'); - - my @column_index = qw(printer_description printer_command template_code); - my %column_header; - $column_header{printer_description} = - qq|| - . $locale->text('Printer Description') - . qq||; - $column_header{printer_command} = - qq|| - . $locale->text('Printer Command') - . qq||; - $column_header{template_code} = - qq|| - . $locale->text('Template Code') - . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - my ($i, %column_data); - foreach my $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - print qq| - -|; - - - $column_data{printer_description} = qq||; - $column_data{printer_command} = qq||; - $column_data{template_code} = - qq||; - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
$ref->{printer_description}$ref->{printer_command}$ref->{template_code}
-

- -
- - - - - - - - -
- - - -|; - - $main::lxdebug->leave_sub(); -} - -sub printer_header { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->{title} = $locale->text("$form->{title} Printer"); - - # $locale->text('Add Printer') - # $locale->text('Edit Printer') - - $form->{printer_description} =~ s/\"/"/g; - $form->{template_code} =~ s/\"/"/g; - $form->{printer_command} =~ s/\"/"/g; - - - $form->header; - - print qq| - - -
- -{id}> - - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Printer') . qq|
| . $locale->text('Printer Command') . qq|
| . $locale->text('Template Code') . qq|

-|; - - $main::lxdebug->leave_sub(); -} - -sub save_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - $form->isblank("printer_description", $locale->text('Description missing!')); - $form->isblank("printer_command", $locale->text('Printer Command missing!')); - AM->save_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer saved!')); - - $main::lxdebug->leave_sub(); -} - -sub delete_printer { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->delete_printer(\%myconfig, \%$form); - $form->redirect($locale->text('Printer deleted!')); - - $main::lxdebug->leave_sub(); -} - -sub add_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Add"; - - $form->{callback} = "am.pl?action=add_payment" unless $form->{callback}; - - $form->{terms_netto} = 0; - $form->{terms_skonto} = 0; - $form->{percent_skonto} = 0; - my @languages = AM->language(\%myconfig, $form, 1); - map({ $_->{"language"} = $_->{"description"}; - $_->{"language_id"} = $_->{"id"}; } @languages); - $form->{"TRANSLATION"} = \@languages; - &payment_header; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub edit_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - $form->{title} = "Edit"; - - AM->get_payment(\%myconfig, $form); - $form->{percent_skonto} = - $form->format_amount(\%myconfig, $form->{percent_skonto} * 100); - - &payment_header; - - $form->{orphaned} = 1; - &form_footer; - - $main::lxdebug->leave_sub(); -} - -sub list_payment { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; - - $main::auth->assert('config'); - - AM->payment(\%myconfig, \%$form); - - $form->{callback} = build_std_url("action=list_payment"); - - my $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Payment Terms'); + $form->{title} = $locale->text('Buchungsgruppen'); - my @column_index = qw(up down description description_long terms_netto - terms_skonto percent_skonto); + my @column_index = qw(up down description inventory_accno + income_accno_0 expense_accno_0 + income_accno_1 expense_accno_1 + income_accno_2 expense_accno_2 + income_accno_3 expense_accno_3 ); my %column_header; $column_header{up} = - qq|| + qq|| . qq|| . $locale->text(| . qq||; $column_header{down} = - qq|| + qq|| . qq|| . $locale->text(| . qq||; $column_header{description} = - qq|| + qq|| . $locale->text('Description') . qq||; - $column_header{description_long} = + $column_header{inventory_accno} = + qq|| + . $locale->text('Bestandskonto') + . qq||; + $column_header{income_accno_0} = + qq|| + . $locale->text('National Revenues') + . qq||; + $column_header{expense_accno_0} = + qq|| + . $locale->text('National Expenses') + . qq||; + $column_header{income_accno_1} = qq|| - . $locale->text('Long Description') + . $locale->text('Revenues EU with UStId') . qq||; - $column_header{terms_netto} = + $column_header{expense_accno_1} = qq|| - . $locale->text('Netto Terms') + . $locale->text('Expenses EU with UStId') . qq||; - $column_header{terms_skonto} = + $column_header{income_accno_2} = qq|| - . $locale->text('Skonto Terms') + . $locale->text('Revenues EU without UStId') . qq||; - $column_header{percent_skonto} = + $column_header{expense_accno_2} = qq|| - . $locale->text('Skonto') - . qq| %|; - + . $locale->text('Expenses EU without UStId') + . qq||; + $column_header{income_accno_3} = + qq|| + . $locale->text('Foreign Revenues') + . qq||; + $column_header{expense_accno_3} = + qq|| + . $locale->text('Foreign Expenses') + . qq||; $form->header; print qq| @@ -2341,7 +1256,7 @@ sub list_payment { |; - my $swap_link = build_std_url("action=swap_payment_terms"); + my $swap_link = qq|am.pl?action=swap_buchungsgruppen&|; my $row = 0; my ($i, %column_data); @@ -2358,7 +1273,7 @@ sub list_payment { my $pref = $form->{ALL}->[$row - 1]; $column_data{up} = qq|| . - qq|| . + qq|| . qq|| . $locale->text(| . qq||; } else { @@ -2371,30 +1286,32 @@ sub list_payment { my $nref = $form->{ALL}->[$row + 1]; $column_data{down} = qq|| . - qq|| . + qq|| . qq|| . $locale->text(| . qq||; } - $column_data{description} = - qq|{id}", "callback=$callback") . - qq|">| . H($ref->{description}) . qq||; - $column_data{description_long} = - qq|| . H($ref->{description_long}) . qq||; - $column_data{terms_netto} = - qq|$ref->{terms_netto}|; - $column_data{terms_skonto} = - qq|$ref->{terms_skonto}|; - $column_data{percent_skonto} = - qq|| . - $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) . - qq|%|; + $column_data{description} = qq|$ref->{description}|; + $column_data{inventory_accno} = qq|$ref->{inventory_accno}|; + $column_data{income_accno_0} = + qq|$ref->{income_accno_0}|; + $column_data{expense_accno_0} = qq|$ref->{expense_accno_0}|; + $column_data{income_accno_1} = + qq|$ref->{income_accno_1}|; + $column_data{expense_accno_1} = qq|$ref->{expense_accno_1}|; + $column_data{income_accno_2} = + qq|$ref->{income_accno_2}|; + $column_data{expense_accno_2} = qq|$ref->{expense_accno_2}|; + $column_data{income_accno_3} = + qq|$ref->{income_accno_3}|; + $column_data{expense_accno_3} = qq|$ref->{expense_accno_3}|; + map { print "$column_data{$_}\n" } @column_index; print qq| - + |; + $row++; } @@ -2412,7 +1329,7 @@ sub list_payment { - + @@ -2426,7 +1343,7 @@ sub list_payment { $main::lxdebug->leave_sub(); } -sub payment_header { +sub buchungsgruppe_header { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -2434,13 +1351,115 @@ sub payment_header { $main::auth->assert('config'); - $form->{title} = $locale->text("$form->{title} Payment Terms"); + $form->{title} = $locale->text("$form->{title} Buchungsgruppe"); + + # $locale->text('Add Accounting Group') + # $locale->text('Edit Accounting Group') - # $locale->text('Add Payment Terms') - # $locale->text('Edit Payment Terms') + my ($acc_inventory, $acc_income, $acc_expense) = ({}, {}, {}); + my %acc_type_map = ( + "IC" => $acc_inventory, + "IC_income" => $acc_income, + "IC_sale" => $acc_income, + "IC_expense" => $acc_expense, + "IC_cogs" => $acc_expense, + ); - $form->{description} =~ s/\"/"/g; + foreach my $key (keys(%acc_type_map)) { + foreach my $ref (@{ $form->{IC_links}{$key} }) { + $acc_type_map{$key}->{$ref->{"id"}} = $ref; + } + } + + foreach my $type (qw(IC IC_income IC_expense)) { + $form->{"select$type"} = + join("", + map({ "" } + sort({ $a->{"accno"} cmp $b->{"accno"} } + values(%{$acc_type_map{$type}})))); + } + + if ($form->{id}) { + $form->{selectIC} =~ s/selected//g; + $form->{selectIC} =~ s/ value=\Q$form->{inventory_accno_id}\E/ value=$form->{inventory_accno_id} selected/; + $form->{selectIC_income} =~ s/selected//g; + $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_0}\E/ value=$form->{income_accno_id_0} selected/; + $form->{selectIC_expense} =~ s/selected//g; + $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_0}\E/ value=$form->{expense_accno_id_0} selected/; + } + + my $linkaccounts; + if ( $::instance_conf->get_inventory_system eq 'perpetual' ) { # was !$::lx_office_conf{system}->{eur}) { + $linkaccounts = qq| + + | . $locale->text('Inventory') . qq| + + + |; + } elsif ( $::instance_conf->get_inventory_system eq 'periodic' ) { + # don't allow choice of inventory accno and don't show that line + $linkaccounts = qq| + {inventory_accno_id}>|; + }; + + + $linkaccounts .= qq| + + | . $locale->text('National Revenues') . qq| + + + + | . $locale->text('National Expenses') . qq| + + |; + if ($form->{id}) { + $form->{selectIC_income} =~ s/selected//g; + $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_1}\E/ value=$form->{income_accno_id_1} selected/; + $form->{selectIC_expense} =~ s/selected//g; + $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_1}\E/ value=$form->{expense_accno_id_1} selected/; + } + $linkaccounts .= qq| + | . $locale->text('Revenues EU with UStId') . qq| + + + + | . $locale->text('Expenses EU with UStId') . qq| + + |; + + if ($form->{id}) { + $form->{selectIC_income} =~ s/selected//g; + $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_2}\E/ value=$form->{income_accno_id_2} selected/; + $form->{selectIC_expense} =~ s/selected//g; + $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_2}\E/ value=$form->{expense_accno_id_2} selected/; + } + + $linkaccounts .= qq| + | . $locale->text('Revenues EU without UStId') . qq| + + + + | . $locale->text('Expenses EU without UStId') . qq| + + |; + + if ($form->{id}) { + $form->{selectIC_income} =~ s/selected//g; + $form->{selectIC_income} =~ s/ value=\Q$form->{income_accno_id_3}\E/ value=$form->{income_accno_id_3} selected/; + $form->{selectIC_expense} =~ s/selected//g; + $form->{selectIC_expense} =~ s/ value=\Q$form->{expense_accno_id_3}\E/ value=$form->{expense_accno_id_3} selected/; + } + $linkaccounts .= qq| + | . $locale->text('Foreign Revenues') . qq| + + + + | . $locale->text('Foreign Expenses') . qq| + + +|; $form->header; @@ -2451,7 +1470,7 @@ sub payment_header { {id}> - + @@ -2459,85 +1478,19 @@ sub payment_header { - - - - - - - -|; - - foreach my $language (@{ $form->{"TRANSLATION"} }) { - print qq| - - - - -|; - } - - print qq| - - - - - - - - + + - - - + $linkaccounts
| . $locale->text('Description') . qq|
| . $locale->text('Long Description') . qq|
| . - sprintf($locale->text('Translation (%s)'), - $language->{"language"}) - . qq|
| . $locale->text('Netto Terms') . qq|
| . $locale->text('Skonto Terms') . qq|
| . $locale->text('Buchungsgruppe') . qq|
| . $locale->text('Skonto') . qq| %

- -

| . $locale->text("You can use the following strings in the long " . - "description and all translations. They will be " . - "replaced by their actual values by Lx-Office " . - "before they're output.") -. qq|

- -|; +|; $main::lxdebug->leave_sub(); } -sub save_payment { +sub save_buchungsgruppe { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -2547,15 +1500,14 @@ sub save_payment { $main::auth->assert('config'); $form->isblank("description", $locale->text('Description missing!')); - $form->{"percent_skonto"} = - $form->parse_amount(\%myconfig, $form->{percent_skonto}) / 100; - AM->save_payment(\%myconfig, \%$form); - $form->redirect($locale->text('Payment Terms saved!')); + + AM->save_buchungsgruppe(\%myconfig, \%$form); + $form->redirect($locale->text('Accounting Group saved!')); $main::lxdebug->leave_sub(); } -sub delete_payment { +sub delete_buchungsgruppe { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -2564,13 +1516,13 @@ sub delete_payment { $main::auth->assert('config'); - AM->delete_payment(\%myconfig, \%$form); - $form->redirect($locale->text('Payment terms deleted!')); + AM->delete_buchungsgruppe(\%myconfig, \%$form); + $form->redirect($locale->text('Accounting Group deleted!')); $main::lxdebug->leave_sub(); } -sub swap_payment_terms { +sub swap_buchungsgruppen { $main::lxdebug->enter_sub(); my $form = $main::form; @@ -2578,8 +1530,8 @@ sub swap_payment_terms { $main::auth->assert('config'); - AM->swap_sortkeys(\%myconfig, $form, "payment_terms"); - list_payment(); + AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen"); + list_buchungsgruppe(); $main::lxdebug->leave_sub(); } @@ -2597,6 +1549,11 @@ sub edit_defaults { map { $form->{"defaults_${_}"} = $form->{defaults}->{$_} } keys %{ $form->{defaults} }; + # default language + my $all_languages = SL::DB::Manager::Language->get_all; + +# EÜR = cash, Bilanzierung = accrual + foreach my $key (keys %{ $form->{IC} }) { foreach my $accno (sort keys %{ $form->{IC}->{$key} }) { my $array = "ACCNOS_" . uc($key); @@ -2614,7 +1571,8 @@ sub edit_defaults { $form->{title} = $locale->text('Ranges of numbers and default accounts'); $form->header(); - print $form->parse_html_template('am/edit_defaults'); + print $form->parse_html_template('am/edit_defaults', + { ALL_LANGUAGES => $all_languages, }); $main::lxdebug->leave_sub(); } @@ -2660,20 +1618,21 @@ sub config { _build_cfg_options('numberformat', ('1,000.00', '1000.00', '1.000,00', '1000,00')); my @formats = (); - if ($main::opendocument_templates && $main::openofficeorg_writer_bin && - $main::xvfb_bin && (-x $main::openofficeorg_writer_bin) && (-x $main::xvfb_bin)) { + if ($::lx_office_conf{print_templates}->{opendocument} + && $::lx_office_conf{applications}->{openofficeorg_writer} && (-x $::lx_office_conf{applications}->{openofficeorg_writer}) + && $::lx_office_conf{applications}->{xvfb} && (-x $::lx_office_conf{applications}->{xvfb})) { push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"), "value" => "opendocument_pdf" }); } - if ($main::latex_templates) { + if ($::lx_office_conf{print_templates}->{latex}) { push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" }); } push(@formats, { "name" => "HTML", "value" => "html" }); - if ($main::latex_templates) { + if ($::lx_office_conf{print_templates}->{latex}) { push(@formats, { "name" => $locale->text("Postscript"), "value" => "postscript" }); } - if ($main::opendocument_templates) { + if ($::lx_office_conf{print_templates}->{opendocument}) { push(@formats, { "name" => $locale->text("OpenDocument/OASIS"), "value" => "opendocument" }); } @@ -2701,16 +1660,7 @@ sub config { { 'name' => $locale->text('Queue'), 'value' => 'queue', 'selected' => $selected{queue}, }, ]; - AM->printer(\%myconfig, $form); - - $form->{PRINTERS} = []; - foreach my $printer (@{$form->{"ALL"}}) { - push @{ $form->{PRINTERS} }, { - 'name' => $printer->{printer_description}, - 'value' => $printer->{id}, - 'selected' => $printer->{id} == $myconfig{default_printer_id}, - }; - } + $form->{PRINTERS} = [ SL::Printer->all_printers(%::myconfig) ]; my %countrycodes = User->country_codes; @@ -2724,7 +1674,7 @@ sub config { } $form->{STYLESHEETS} = []; - foreach my $item (qw(lx-office-erp.css Win2000.css)) { + foreach my $item (qw(lx-office-erp.css Win2000.css Mobile.css)) { push @{ $form->{STYLESHEETS} }, { 'name' => $item, 'value' => $item, @@ -2755,7 +1705,27 @@ sub save_preferences { TODO->save_user_config('login' => $form->{login}, %{ $form->{todo_cfg} || { } }); - $form->redirect($locale->text('Preferences saved!')) if (AM->save_preferences(\%myconfig, \%$form, 0)); + if (AM->save_preferences(\%myconfig, $form)) { + if ($::auth->can_change_password() + && defined $form->{new_password} + && ($form->{new_password} ne '********')) { + my $verifier = SL::Auth::PasswordPolicy->new; + my $result = $verifier->verify($form->{new_password}); + + if ($result != SL::Auth::PasswordPolicy->OK()) { + $form->error($::locale->text('The settings were saved, but the password was not changed.') . ' ' . join(' ', $verifier->errors($result))); + } + + $::auth->change_password($form->{login}, $form->{new_password}); + + $form->{password} = $form->{new_password}; + $::auth->set_session_value('password', $form->{password}); + $::auth->create_or_refresh_session(); + } + + $form->redirect($locale->text('Preferences saved!')); + } + $form->error($locale->text('Cannot save preferences!')); $main::lxdebug->leave_sub(); @@ -2871,15 +1841,13 @@ sub edit_units { $units = AM->retrieve_units(\%myconfig, $form); my $ddbox = AM->unit_select_data($units, undef, 1); - my $updownlink = build_std_url("action=swap_units"); - $form->{"title"} = $locale->text("Add and edit units"); $form->header(); print($form->parse_html_template("am/edit_units", { "UNITS" => \@unit_list, "NEW_BASE_UNIT_DDBOX" => $ddbox, "LANGUAGES" => \@languages, - "updownlink" => $updownlink })); + })); $main::lxdebug->leave_sub(); } @@ -3072,7 +2040,7 @@ sub show_am_history { my %searchNo = ( "Artikelnummer" => "partnumber", "Kundennummer" => "customernumber", "Lieferantennummer" => "vendornumber", - "Projektnummer" => "projectnummer", + "Projektnummer" => "projectnumber", "Buchungsnummer" => "ordnumber", "Eingangsrechnungnummer" => "invnumber", "Ausgangsrechnungnummer" => "invnumber", @@ -3117,22 +2085,6 @@ sub show_am_history { $main::lxdebug->leave_sub(); } -sub swap_units { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - my $dir = $form->{"dir"} eq "down" ? "down" : "up"; - AM->swap_units(\%myconfig, $form, $dir, $form->{"name"}); - - edit_units(); - - $main::lxdebug->leave_sub(); -} - sub add_tax { $main::lxdebug->enter_sub(); @@ -3325,16 +2277,8 @@ sub list_price_factors { AM->get_all_price_factors(\%myconfig, \%$form); - my $previous; foreach my $current (@{ $form->{PRICE_FACTORS} }) { - if ($previous) { - $previous->{next_id} = $current->{id}; - $current->{previous_id} = $previous->{id}; - } - $current->{factor} = $form->format_amount(\%myconfig, $current->{factor} * 1); - - $previous = $current; } $form->{callback} = build_std_url('action=list_price_factors'); @@ -3388,20 +2332,6 @@ sub delete_price_factor { $main::lxdebug->leave_sub(); } -sub swap_price_factors { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - AM->swap_sortkeys(\%myconfig, $form, 'price_factors'); - list_price_factors(); - - $main::lxdebug->leave_sub(); -} - sub add_warehouse { $main::lxdebug->enter_sub(); @@ -3454,16 +2384,6 @@ sub list_warehouses { AM->get_all_warehouses(\%myconfig, $form); - my $previous; - foreach my $current (@{ $form->{WAREHOUSES} }) { - if ($previous) { - $previous->{next_id} = $current->{id}; - $current->{previous_id} = $previous->{id}; - } - - $previous = $current; - } - $form->{callback} = build_std_url('action=list_warehouses'); $form->{title} = $locale->text('Warehouses'); $form->{url_base} = build_std_url('callback'); @@ -3496,20 +2416,6 @@ sub save_warehouse { $main::lxdebug->leave_sub(); } -sub swap_warehouses { - $main::lxdebug->enter_sub(); - - my $form = $main::form; - my %myconfig = %main::myconfig; - - $main::auth->assert('config'); - - AM->swap_sortkeys(\%myconfig, $form, 'warehouse'); - list_warehouses(); - - $main::lxdebug->leave_sub(); -} - sub delete_warehouse { $main::lxdebug->enter_sub(); @@ -3524,7 +2430,7 @@ sub delete_warehouse { $form->header(); print $form->parse_html_template('am/confirm_delete_warehouse'); - exit 0; + ::end_of_request(); } if (AM->delete_warehouse(\%myconfig, $form)) {