From: Sven Schöling Date: Tue, 28 Dec 2010 09:10:00 +0000 (+0100) Subject: Merge branch 'master' of ssh://lx-office/~/lx-office-erp X-Git-Tag: release-2.6.2beta1~60 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/7ecdb94715674d62df85fc746fe06db10c7ade9b?hp=6023db971c9e140540df39c63639f9ce16163915 Merge branch 'master' of ssh://lx-office/~/lx-office-erp --- diff --git a/SL/InstallationCheck.pm b/SL/InstallationCheck.pm index d8d058bc5..15db0cb70 100644 --- a/SL/InstallationCheck.pm +++ b/SL/InstallationCheck.pm @@ -18,7 +18,6 @@ BEGIN { { name => "DBD::Pg", version => '1.49', url => "http://search.cpan.org/~dbdpg/" }, { name => "Email::Address", url => "http://search.cpan.org/~rjbs/" }, { name => "FCGI", url => "http://search.cpan.org/~mstrout/" }, - { name => "IO::Wrap", version => '2.110', url => "http://search.cpan.org/~dskoll/" }, { name => "List::MoreUtils", version => '0.21', url => "http://search.cpan.org/~vparseval/" }, { name => "PDF::API2", version => '2.000', url => "http://search.cpan.org/~areibens/" }, { name => "Template", version => '2.18', url => "http://search.cpan.org/~abw/" }, diff --git a/SL/Locale.pm b/SL/Locale.pm index 4fde61654..b1c8205e8 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -480,4 +480,19 @@ sub with_raw_io { $self->{raw_io_active} = 0; } +sub set_numberformat_wo_thousands_separator { + my $self = shift; + my $myconfig = shift || \%::myconfig; + + $self->{saved_numberformat} = $myconfig->{numberformat}; + $myconfig->{numberformat} =~ s/^1[,\.]/1/; +} + +sub restore_numberformat { + my $self = shift; + my $myconfig = shift || \%::myconfig; + + $myconfig->{numberformat} = $self->{saved_numberformat} if $self->{saved_numberformat}; +} + 1; diff --git a/SL/ReportGenerator.pm b/SL/ReportGenerator.pm index f02f56875..2b37e78f5 100644 --- a/SL/ReportGenerator.pm +++ b/SL/ReportGenerator.pm @@ -1,7 +1,6 @@ package SL::ReportGenerator; use Data::Dumper; -use IO::Wrap; use List::Util qw(max); use Text::CSV_XS; #use PDF::API2; # these two eat up to .75s on startup. only load them if we actually need them @@ -688,11 +687,10 @@ sub _print_content { } sub unescape_string { - my $self = shift; - my $text = shift; + my ($self, $text, $do_iconv) = @_; - $text = $main::locale->unquote_special_chars('HTML', $text); - $text = $::locale->{iconv}->convert($text); + $text = $main::locale->unquote_special_chars('HTML', $text); + $text = $::locale->{iconv}->convert($text) if $do_iconv; return $text; } @@ -718,12 +716,15 @@ sub generate_csv_content { 'quote_char' => $quote_char, 'eol' => $eol, }); - my $stdout = wraphandle(\*STDOUT); my @visible_columns = $self->get_visible_columns('CSV'); + my $stdout; + open $stdout, '>-'; + binmode $stdout, ':encoding(utf8)' if $::locale->is_utf8; + if ($opts->{headers}) { if (!$self->{custom_headers}) { - $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}) } @visible_columns ]); + $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}, 1) } @visible_columns ]); } else { foreach my $row (@{ $self->{custom_headers} }) { diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 8b32585a0..06541ef05 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -1342,6 +1342,7 @@ sub ap_transactions { 'attachment_basename' => $locale->text('vendor_invoice_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index f0c3f4f18..e2777bd49 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1440,6 +1440,7 @@ sub ar_transactions { 'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; diff --git a/bin/mozilla/bankaccounts.pl b/bin/mozilla/bankaccounts.pl index 0815954dc..f8bbb3a84 100644 --- a/bin/mozilla/bankaccounts.pl +++ b/bin/mozilla/bankaccounts.pl @@ -1,5 +1,6 @@ use strict; +use List::MoreUtils qw(any); use POSIX qw(strftime); use SL::BankAccount; @@ -125,6 +126,7 @@ sub bank_account_list { 'attachment_basename' => $locale->text('bankaccounts') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/ca.pl b/bin/mozilla/ca.pl index a58ac1e26..31c77da10 100644 --- a/bin/mozilla/ca.pl +++ b/bin/mozilla/ca.pl @@ -106,6 +106,7 @@ sub chart_of_accounts { 'std_column_visibility' => 1, ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); @@ -593,6 +594,7 @@ sub list_transactions { 'std_column_visibility' => 1, ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 447641177..63aa8313f 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -208,6 +208,7 @@ sub list_names { 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 0d5941cb0..2b1bdd948 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -551,6 +551,7 @@ sub orders { 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; @@ -938,7 +939,7 @@ sub calculate_stock_in_out { 'amount_unit' => $all_units->{$form->{"partunit_$i"}}->{base_unit}, 'conv_units' => 'convertible_not_smaller', 'max_places' => 2); - $content .= qq| |; + $content = qq|${content} |; $main::lxdebug->leave_sub(); @@ -1060,6 +1061,18 @@ sub display_stock_in_form { $main::lxdebug->leave_sub(); } +sub _stock_in_out_set_qty_display { + my $stock_info = shift; + my $form = $::form; + my $all_units = AM->retrieve_all_units(); + my $sum = AM->sum_with_unit(map { $_->{qty}, $_->{unit} } @{ $stock_info }); + $form->{qty_display} = $form->format_amount_units(amount => $sum * 1, + part_unit => $form->{partunit}, + amount_unit => $all_units->{ $form->{partunit} }->{base_unit}, + conv_units => 'convertible_not_smaller', + max_places => 2); +} + sub set_stock_in { $main::lxdebug->enter_sub(); @@ -1078,6 +1091,8 @@ sub set_stock_in { $form->{stock} = YAML::Dump($stock_info); + _stock_in_out_set_qty_display($stock_info); + $form->header(); print $form->parse_html_template('do/set_stock_in_out'); @@ -1171,6 +1186,8 @@ sub set_stock_out { stock_in_out_form(); } else { + _stock_in_out_set_qty_display($stock_info); + $form->header(); print $form->parse_html_template('do/set_stock_in_out'); } diff --git a/bin/mozilla/fu.pl b/bin/mozilla/fu.pl index ac9e81f2e..ec322413f 100644 --- a/bin/mozilla/fu.pl +++ b/bin/mozilla/fu.pl @@ -300,6 +300,7 @@ sub report { 'attachment_basename' => $locale->text('follow_up_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; my $idx = 0; my $callback = build_std_url('action=report', grep { $form->{$_} } @report_params); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index f7810c76b..e642f7e42 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -541,6 +541,7 @@ sub generate_report { 'attachment_basename' => $locale->text('general_ledger_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort to callback $form->{callback} = "$callback&sort=" . E($form->{sort}) . "&sortdir=" . E($form->{sortdir}); diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 5a012b7a3..d83d40942 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1235,6 +1235,7 @@ sub generate_report { 'attachment_basename' => $attachment_basenames{$form->{searchitems}} . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 3867c1b41..0a0ce98d3 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -864,6 +864,7 @@ sub orders { 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; diff --git a/bin/mozilla/projects.pl b/bin/mozilla/projects.pl index f854a4af9..8f5991e2f 100644 --- a/bin/mozilla/projects.pl +++ b/bin/mozilla/projects.pl @@ -169,6 +169,7 @@ sub project_report { 'attachment_basename' => $locale->text('project_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; CVar->add_custom_variables_to_report('module' => 'Projects', 'trans_id_field' => 'id', diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index e1b0773f7..b0831022c 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -807,7 +807,7 @@ $jsscript | . $locale->text('Review of Aging list') . qq| - @@ -1368,6 +1368,7 @@ sub generate_trial_balance { 'pdf_template' => 'rp/html_report_susa', ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; # add sort and escape callback, this one we use for the add sub $form->{callback} = $href .= "&sort=$form->{sort}"; @@ -1519,6 +1520,7 @@ sub list_accounts { 'std_column_visibility' => 1, ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); @@ -1719,6 +1721,8 @@ sub aging { 'title' => $form->{title}, 'attachment_basename' => $attachment_basename . strftime('_%Y%m%d', localtime time), ); + $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; my $previous_ctid = 0; my $row_idx = 0; @@ -1775,8 +1779,6 @@ sub aging { 'raw_bottom_info_text' => $raw_bottom_info_text); } - $report->set_options_from_form(); - $report->generate_with_headers(); $main::lxdebug->leave_sub(); @@ -2433,6 +2435,8 @@ sub list_payments { ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; + $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl index f6041fbcd..fd45f80a1 100755 --- a/bin/mozilla/sepa.pl +++ b/bin/mozilla/sepa.pl @@ -248,6 +248,7 @@ sub bank_transfer_list { 'attachment_basename' => $locale->text('banktransfers') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%::myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); diff --git a/bin/mozilla/vk.pl b/bin/mozilla/vk.pl index 021761ee9..16fcc78b7 100644 --- a/bin/mozilla/vk.pl +++ b/bin/mozilla/vk.pl @@ -87,7 +87,7 @@ sub invoice_transactions { my ($callback, $href, @columns); $form->{customer} = $form->unescape($form->{customer}); - + ($form->{customername}, $form->{customer_id}) = split(/--/, $form->{customer}); # decimalplaces überprüfen oder auf Default 2 setzen @@ -137,7 +137,7 @@ sub invoice_transactions { 'marge_total' => { 'text' => $locale->text('Sales margin'), }, 'marge_percent' => { 'text' => $locale->text('Sales margin %'), }, ); - + my %column_alignment = map { $_ => 'right' } qw(lastcost sellprice sellprice_total lastcost_total unit discount marge_total marge_percent qty); $form->{"l_type"} = "Y"; @@ -188,6 +188,7 @@ sub invoice_transactions { 'attachment_basename' => $locale->text('Sales Report') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; $report->set_columns(%column_defs); $report->set_column_order(@columns); @@ -222,7 +223,7 @@ sub invoice_transactions { $ar->{sellprice} = $ar->{sellprice} / $ar->{price_factor}; $ar->{lastcost} = $ar->{lastcost} / $ar->{price_factor}; $ar->{sellprice_total} = $ar->{qty} * $ar->{sellprice}; - $ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost}; + $ar->{lastcost_total} = $ar->{qty} * $ar->{lastcost}; # marge_percent wird neu berechnet, da Wert in invoice leer ist (Bug) $ar->{marge_percent} = $ar->{sellprice_total} ? (($ar->{sellprice_total}-$ar->{lastcost_total}) / $ar->{sellprice_total}) : 0; # marge_total neu berechnen @@ -243,14 +244,14 @@ sub invoice_transactions { $report->add_data($headerrow_set); # add empty row after main header -# my $emptyheaderrow->{description}->{data} = ""; +# my $emptyheaderrow->{description}->{data} = ""; # $emptyheaderrow->{description}->{class} = "listmainsortheader"; # my $emptyheaderrow_set = [ $emptyheaderrow ]; -# $report->add_data($emptyheaderrow_set) if $form->{l_headers} eq "Y"; +# $report->add_data($emptyheaderrow_set) if $form->{l_headers} eq "Y"; }; # subsort überschriften - if ( $idx == 0 + if ( $idx == 0 or $ar->{ $form->{'subsort'} } ne $form->{AR}->[$idx - 1]->{ $form->{'subsort'} } or $ar->{ $form->{'mainsort'} } ne $form->{AR}->[$idx - 1]->{ $form->{'mainsort'} } ) { @@ -271,8 +272,8 @@ sub invoice_transactions { map { $subtotals1{$_} += $ar->{$_}; $subtotals2{$_} += $ar->{$_}; } @subtotal_columns; - - map { $totals{$_} += $ar->{$_} } @total_columns; + + map { $totals{$_} += $ar->{$_} } @total_columns; $subtotals2{sellprice} = $subtotals2{sellprice_total} / $subtotals2{qty} if $subtotals2{qty} != 0; $subtotals1{sellprice} = $subtotals1{sellprice_total} / $subtotals1{qty} if $subtotals1{qty} != 0; @@ -298,7 +299,7 @@ sub invoice_transactions { 'align' => $column_alignment{$column}, }; } - + $row->{description}->{class} = 'listsortdescription'; $row->{invnumber}->{link} = build_std_url("script=is.pl", 'action=edit') @@ -317,14 +318,14 @@ sub invoice_transactions { } else { $name = 'name'; }; - + if ($form->{l_subtotal} eq 'Y' ) { push @{ $row_set }, create_subtotal_row_invoice(\%subtotals2, \@columns, \%column_alignment, \@subtotal_columns, 'listsubsortsubtotal', $ar->{$name}) ; push @{ $row_set }, insert_empty_row(); }; } - # if mainsort has changed, add mainsort subtotal and empty row + # if mainsort has changed, add mainsort subtotal and empty row if (($form->{l_subtotal} eq 'Y') && (($idx == (scalar @{ $form->{AR} } - 1)) # last element always has a subtotal || ($ar->{ $form->{'mainsort'} } ne $form->{AR}->[$idx + 1]->{ $form->{'mainsort'} }) @@ -340,7 +341,7 @@ sub invoice_transactions { push @{ $row_set }, insert_empty_row(); }; } - + $report->add_data($row_set); $idx++; @@ -373,7 +374,7 @@ sub create_subtotal_row_invoice { my %myconfig = %main::myconfig; my $row = { map { $_ => { 'data' => '', 'class' => $class, 'align' => $column_alignment->{$_}, } } @{ $columns } }; - + $row->{description}->{data} = "Summe " . $name; map { $row->{$_}->{data} = $form->format_amount(\%myconfig, $totals->{$_}, 2) } qw(marge_total marge_percent); diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 30ee32676..c990e632f 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -721,6 +721,7 @@ sub generate_journal { 'title' => $form->{title}, 'attachment_basename' => strftime($locale->text('warehouse_journal_list') . '_%Y%m%d', localtime time)); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; my $all_units = AM->retrieve_units(\%myconfig, $form); my @contents = WH->get_warehouse_journal(%filter); @@ -869,6 +870,7 @@ sub generate_report { 'title' => $form->{title}, 'attachment_basename' => strftime($locale->text('warehouse_report_list') . '_%Y%m%d', localtime time)); $report->set_options_from_form(); + $locale->set_numberformat_wo_thousands_separator(\%myconfig) if lc($report->{options}->{output_format}) eq 'csv'; my $all_units = AM->retrieve_units(\%myconfig, $form); my @contents = WH->get_warehouse_report(%filter); diff --git a/doc/INSTALL.texi b/doc/INSTALL.texi index 23ba2e084..2120bc014 100644 --- a/doc/INSTALL.texi +++ b/doc/INSTALL.texi @@ -76,8 +76,6 @@ DBD::Pg @item Email::Address @item -IO::Wrap (aus dem Paket IO::Stringy) -@item List::MoreUtils @item PDF::API2 diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt index 86d5687e8..70510d4cb 100644 --- a/doc/INSTALL.txt +++ b/doc/INSTALL.txt @@ -68,8 +68,6 @@ Bestandteil einer Standard-Perl-Installation sind: * Email::Address - * IO::Wrap (aus dem Paket IO::Stringy) - * List::MoreUtils * PDF::API2 diff --git a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html index 52c3c51e8..bea9c255d 100644 --- a/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html +++ b/doc/INSTALL/Ben_00c3_00b6tigte-Software-und-Pakete.html @@ -17,8 +17,8 @@ pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } - span.roman { font-family:serif; font-weight:normal; } - span.sansserif { font-family:sans-serif; font-weight:normal; } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } --> @@ -46,7 +46,6 @@ aufwärts: Top
  • DBI
  • DBD::Pg
  • Email::Address -
  • IO::Wrap (aus dem Paket IO::Stringy)
  • List::MoreUtils
  • PDF::API2
  • Template diff --git a/doc/UPGRADE b/doc/UPGRADE index 0ad5fd168..190181850 100644 --- a/doc/UPGRADE +++ b/doc/UPGRADE @@ -109,7 +109,6 @@ der Datei "doc/INSTALL". Seit Version 2.4.0 sind die folgenden Module neu hinzugekommen: - Achive::Zip -- IO::Wrap (aus dem Paket "IO::Stringy") - Template - Text::CSV_XS - Text::Iconv diff --git a/templates/webpages/do/set_stock_in_out.html b/templates/webpages/do/set_stock_in_out.html index 36bbf7ff0..07e084d4d 100644 --- a/templates/webpages/do/set_stock_in_out.html +++ b/templates/webpages/do/set_stock_in_out.html @@ -1,13 +1,14 @@ -[% USE HTML %] +[% USE HTML %] +[% USE L %] +[% L.javascript_tag('jquery') %] +
    - - - + + + +
    diff --git a/templates/webpages/report_generator/csv_export_options.html b/templates/webpages/report_generator/csv_export_options.html index ee7f442f7..0af556014 100644 --- a/templates/webpages/report_generator/csv_export_options.html +++ b/templates/webpages/report_generator/csv_export_options.html @@ -49,8 +49,8 @@ [% 'Separator chararacter' | $T8 %]