X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fam.pl;h=6ff99978453acc03e40ff4ae863face873e03087;hb=95155b0d6ddca4b62319edce20397a3ceebac346;hp=e58c81e31306664fc1e6b646c3f54d9fb85bc2aa;hpb=e0e6a9bb9c297b31a5846c7a01aff7d246773981;p=kivitendo-erp.git diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e58c81e31..6ff999784 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -40,6 +40,8 @@ use Data::Dumper; 1; + + require "$form->{path}/common.pl"; # end of main @@ -94,7 +96,6 @@ sub account_header { $form->{description} =~ s/\"/"/g; if (@{ $form->{TAXKEY} }) { - $form->{selecttaxkey} = "|; + foreach $item (qw(1,000.00 1000.00 1.000,00 1000,00)) { + $numberformat .= + ($item eq $form->{output_numberformat}) + ? ""; + } + + my $dateformat = + qq||; + foreach $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| @@ -1662,15 +1444,33 @@ sub language_header { | . $locale->text('Language') . qq| - + | . $locale->text('Template Code') . qq| - {template_code}> + | . $locale->text('Article Code') . qq| - {article_code}> + + + + | . $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|
@@ -1713,8 +1513,10 @@ sub add_buchungsgruppe { "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; AM->get_buchungsgruppe(\%myconfig, \%$form); - if ($eur) { - $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; + $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; @@ -1749,14 +1551,26 @@ sub list_buchungsgruppe { $form->{title} = $locale->text('Buchungsgruppen'); - @column_index = qw(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 ); + @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 ); + $column_header{up} = + qq|| + . qq|| . $locale->text(| + . qq||; + $column_header{down} = + qq|| + . qq|| . $locale->text(| + . qq||; $column_header{description} = - qq|| + qq|| . $locale->text('Description') . qq||; $column_header{inventory_accno} = - qq|| + qq|| . $locale->text('Bestandskonto') . qq||; $column_header{income_accno_0} = @@ -1813,6 +1627,11 @@ sub list_buchungsgruppe { |; + my $swap_link = qq|$form->{script}?action=swap_buchungsgruppen&|; + map({ $swap_link .= $_ . "=" . $form->escape($form->{$_}) . "&" } + qw(login password path)); + + my $row = 0; foreach $ref (@{ $form->{ALL} }) { $i++; @@ -1822,6 +1641,27 @@ sub list_buchungsgruppe { |; + if ($row) { + my $pref = $form->{ALL}->[$row - 1]; + $column_data{up} = + qq|| . + qq|| . + qq|| . $locale->text(| . + 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|| . + qq|| . + qq|| . $locale->text(| . + qq||; + } $column_data{description} = qq|{script}?action=edit_buchungsgruppe&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}|; @@ -1844,6 +1684,8 @@ sub list_buchungsgruppe { print qq| |; + + $row++; } print qq| @@ -1867,16 +1709,9 @@ sub list_buchungsgruppe { {password}> |; + . $locale->text('Add') . qq|"> - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| - - + @@ -2045,6 +1880,15 @@ sub delete_buchungsgruppe { $lxdebug->leave_sub(); } +sub swap_buchungsgruppen { + $lxdebug->enter_sub(); + + AM->swap_sortkeys(\%myconfig, $form, "buchungsgruppen"); + list_buchungsgruppe(); + + $lxdebug->leave_sub(); +} + sub add_printer { $lxdebug->enter_sub(); @@ -2169,14 +2013,7 @@ sub list_printer { {password}> |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| + . $locale->text('Add') . qq|"> @@ -2255,7 +2092,6 @@ sub delete_printer { $lxdebug->leave_sub(); } - sub add_payment { $lxdebug->enter_sub(); @@ -2265,6 +2101,13 @@ sub add_payment { "$form->{script}?action=add_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}" 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; @@ -2276,7 +2119,9 @@ sub edit_payment { $form->{title} = "Edit"; - AM->get_payment(\%myconfig, \%$form); + AM->get_payment(\%myconfig, $form); + $form->{percent_skonto} = + $form->format_amount(\%myconfig, $form->{percent_skonto} * 100); &payment_header; @@ -2291,15 +2136,23 @@ sub list_payment { AM->payment(\%myconfig, \%$form); - $form->{callback} = - "$form->{script}?action=list_payment&path=$form->{path}&login=$form->{login}&password=$form->{password}"; + $form->{callback} = build_std_url("action=list_payment"); $callback = $form->escape($form->{callback}); $form->{title} = $locale->text('Payment Terms'); - @column_index = qw(description description_long terms_netto terms_skonto percent_skonto); + @column_index = qw(up down description description_long terms_netto + terms_skonto percent_skonto); + $column_header{up} = + qq|| + . qq|| . $locale->text(| + . qq||; + $column_header{down} = + qq|| + . qq|| . $locale->text(| + . qq||; $column_header{description} = qq|| . $locale->text('Description') @@ -2343,6 +2196,9 @@ sub list_payment { |; + my $swap_link = build_std_url("action=swap_payment_terms"); + + my $row = 0; foreach $ref (@{ $form->{ALL} }) { $i++; @@ -2352,21 +2208,48 @@ sub list_payment { |; + if ($row) { + my $pref = $form->{ALL}->[$row - 1]; + $column_data{up} = + qq|| . + qq|| . + qq|| . $locale->text(| . + 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|| . + qq|| . + qq|| . $locale->text(| . + qq||; + } $column_data{description} = - qq|{script}?action=edit_payment&id=$ref->{id}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{description}|; - $column_data{description_long} = qq|$ref->{description_long}|; + 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|$ref->{percent_skonto} %|; + qq|| . + $form->format_amount(\%myconfig, $ref->{percent_skonto} * 100) . + qq|%|; map { print "$column_data{$_}\n" } @column_index; print qq| |; + $row++; } print qq| @@ -2383,21 +2266,14 @@ sub list_payment { - + {path}> {login}> {password}> |; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| + . $locale->text('Add') . qq|"> @@ -2439,14 +2315,26 @@ sub payment_header { | . $locale->text('Description') . qq| - - | . $locale->text('Ranking') . qq| - - | . $locale->text('Long Description') . qq| +|; + + foreach my $language (@{ $form->{"TRANSLATION"} }) { + print qq| + + | . + sprintf($locale->text('Translation (%s)'), + $language->{"language"}) + . qq| + + +|; + } + + print qq| | . $locale->text('Netto Terms') . qq| @@ -2462,7 +2350,38 @@ sub payment_header {
-|; + +

| . $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|

+ +|; $lxdebug->leave_sub(); } @@ -2470,7 +2389,9 @@ sub payment_header { sub save_payment { $lxdebug->enter_sub(); - $form->isblank("description", $locale->text('Language missing!')); + $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!')); @@ -2486,211 +2407,11 @@ sub delete_payment { $lxdebug->leave_sub(); } -sub add_sic { - $lxdebug->enter_sub(); - - $form->{title} = "Add"; - - $form->{callback} = - "$form->{script}?action=add_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}" - unless $form->{callback}; - - &sic_header; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub edit_sic { - $lxdebug->enter_sub(); - - $form->{title} = "Edit"; - - AM->get_sic(\%myconfig, \%$form); - - &sic_header; - - $form->{orphaned} = 1; - &form_footer; - - $lxdebug->leave_sub(); -} - -sub list_sic { - $lxdebug->enter_sub(); - - AM->sic(\%myconfig, \%$form); - - $form->{callback} = - "$form->{script}?action=list_sic&path=$form->{path}&login=$form->{login}&password=$form->{password}"; - - $callback = $form->escape($form->{callback}); - - $form->{title} = $locale->text('Standard Industrial Codes'); - - @column_index = qw(code description); - - $column_header{code} = - qq|| . $locale->text('Code') . qq||; - $column_header{description} = - qq|| . $locale->text('Description') . qq||; - - $form->header; - - print qq| - - - - - - - - - - - - - -
$form->{title}
- - -|; - - map { print "$column_header{$_}\n" } @column_index; - - print qq| - -|; - - foreach $ref (@{ $form->{ALL} }) { - - $i++; - $i %= 2; - - if ($ref->{sictype} eq 'H') { - print qq| - -|; - $column_data{code} = - qq||; - $column_data{description} = qq||; - - } else { - print qq| - -|; - - $column_data{code} = - qq||; - $column_data{description} = qq||; - - } - - map { print "$column_data{$_}\n" } @column_index; - - print qq| - -|; - } - - print qq| -
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}$ref->{description}
{script}?action=edit_sic&code=$ref->{code}&path=$form->{path}&login=$form->{login}&password=$form->{password}&callback=$callback>$ref->{code}$ref->{description}
-

- -
-
{script}> - - - - - -{path}> -{login}> -{password}> - -|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq| -
- - - -|; - - $lxdebug->leave_sub(); -} - -sub sic_header { +sub swap_payment_terms { $lxdebug->enter_sub(); - $form->{title} = $locale->text("$form->{title} SIC"); - - # $locale->text('Add SIC') - # $locale->text('Edit SIC') - - $form->{code} =~ s/\"/"/g; - $form->{description} =~ s/\"/"/g; - - $checked = ($form->{sictype} eq 'H') ? "checked" : ""; - - $form->header; - - print qq| - - -
{script}> - - -{code}> - - - - - - - - - - - - - - - - - - - - -
$form->{title}
| . $locale->text('Code') . qq|{code}>
| - . $locale->text('Heading') . qq|
| . $locale->text('Description') . qq|

-|; - - $lxdebug->leave_sub(); -} - -sub save_sic { - $lxdebug->enter_sub(); - - $form->isblank("code", $locale->text('Code missing!')); - $form->isblank("description", $locale->text('Description missing!')); - AM->save_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC saved!')); - - $lxdebug->leave_sub(); -} - -sub delete_sic { - $lxdebug->enter_sub(); - - AM->delete_sic(\%myconfig, \%$form); - $form->redirect($locale->text('SIC deleted!')); + AM->swap_sortkeys(\%myconfig, $form, "payment_terms"); + list_payment(); $lxdebug->leave_sub(); } @@ -2739,14 +2460,8 @@ $form->{body} {password}> |; + . $locale->text('Edit') . qq|"> - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } - - print qq|
@@ -2788,14 +2503,8 @@ $form->{body}
|; - - if ($form->{menubar}) { - require "$form->{path}/menu.pl"; - &menubar; - } + . $locale->text('Save') . qq|"> - print q| @@ -2843,6 +2552,58 @@ sub config { $myconfig{$item} =~ s/\\n/\r\n/g; } + @formats = (); + if ($opendocument_templates && $openofficeorg_writer_bin && + $xvfb_bin && (-x $openofficeorg_writer_bin) && (-x $xvfb_bin)) { + push(@formats, { "name" => $locale->text("PDF (OpenDocument/OASIS)"), + "value" => "opendocument_pdf" }); + } + if ($latex_templates) { + push(@formats, { "name" => $locale->text("PDF"), "value" => "pdf" }); + } + push(@formats, { "name" => "HTML", "value" => "html" }); + if ($latex_templates) { + push(@formats, { "name" => $locale->text("Postscript"), + "value" => "postscript" }); + } + if ($opendocument_templates) { + push(@formats, { "name" => $locale->text("OpenDocument/OASIS"), + "value" => "opendocument" }); + } + + if (!$myconfig{"template_format"}) { + $myconfig{"template_format"} = "pdf"; + } + my $template_format = ""; + foreach $item (@formats) { + $template_format .= + ""; + } + + if (!$myconfig{"default_media"}) { + $myconfig{"default_media"} = "screen"; + } + my %selected = ($myconfig{"default_media"} => "selected"); + my $default_media = qq| + + + +|; + + %selected = (); + $selected{$myconfig{"default_printer_id"}} = "selected" + if ($myconfig{"default_printer_id"}); + my $default_printer = qq||; + AM->printer(\%myconfig, $form); + foreach my $printer (@{$form->{"ALL"}}) { + $default_printer .= qq||; + } + %countrycodes = User->country_codes; $countrycodes = ''; foreach $key (sort { $countrycodes{$a} cmp $countrycodes{$b} } @@ -2855,19 +2616,6 @@ sub config { } $countrycodes = "