From: Moritz Bunkus Date: Tue, 5 May 2009 09:22:05 +0000 (+0000) Subject: Beim PDF- und CSV-Export der verschiedenen Berichte die vorherige Sortierreihenfolge... X-Git-Tag: release-2.6.0beta2~53 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=19688fcacc86e86dd6ff5c5427e3b50893bb60f0;p=kivitendo-erp.git Beim PDF- und CSV-Export der verschiedenen Berichte die vorherige Sortierreihenfolge beibehalten. Fix für Bug 845. --- diff --git a/SL/WH.pm b/SL/WH.pm index 70bf7db1f..59fdfc5ce 100644 --- a/SL/WH.pm +++ b/SL/WH.pm @@ -301,11 +301,14 @@ sub get_warehouse_journal { $filter{na} = '-' unless $filter{na}; # make order, search in $filter and $form - $form->{sort} = $filter{sort} unless $form->{sort}; - $form->{order} = ($form->{sort} = 'itime') unless $form->{sort}; - $form->{sort} = 'itime' if $form->{sort} eq "date"; - $form->{order} = $filter{order} unless $form->{order}; - $form->{sort} .= (($form->{order}) ? " DESC" : " ASC"); + my $sort_col = $form->{sort}; + my $sort_order = $form->{order}; + + $sort_col = $filter{sort} unless $sort_col; + $sort_order = ($sort_col = 'itime') unless $sort_col; + $sort_col = 'itime' if $sort_col eq 'date'; + $sort_order = $filter{order} unless $sort_order; + my $sort_spec = "${sort_col} " . ($sort_order ? " DESC" : " ASC"); my $where_clause = join(" AND ", @filter_ary) . " AND " if (@filter_ary); @@ -400,7 +403,7 @@ sub get_warehouse_journal { WHERE $where_clause i1.qty > 0 AND i1.trans_id IN ( SELECT i.trans_id FROM inventory i GROUP BY i.trans_id HAVING COUNT(i.trans_id) = 1 ) GROUP BY $group_clause - ORDER BY r_$form->{sort}|; + ORDER BY r_${sort_spec}|; my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars, @filter_vars, @filter_vars); @@ -521,12 +524,15 @@ sub get_warehouse_report { map { $form->{"l_${_}id"} = "Y" if ($form->{"l_${_}description"} || $form->{"l_${_}number"}); } qw(warehouse bin); # make order, search in $filter and $form - $form->{sort} = $filter{sort} unless $form->{sort}; - $form->{sort} = "parts_id" unless $form->{sort}; - $form->{order} = $filter{order} unless $form->{order}; - $form->{sort} =~ s/ASC|DESC//; # kill stuff left in from previous queries - my $orderby = $form->{sort}; - $form->{sort} .= (($form->{order}) ? " DESC" : " ASC"); + my $sort_col = $form->{sort}; + my $sort_order = $form->{order}; + + $sort_col = $filter{sort} unless $sort_col; + $sort_col = "parts_id" unless $sort_col; + $sort_order = $filter{order} unless $sort_order; + $sort_col =~ s/ASC|DESC//; # kill stuff left in from previous queries + my $orderby = $sort_col; + my $sort_spec = "${sort_col} " . ($sort_order ? " DESC" : " ASC"); my $where_clause = join " AND ", ("1=1", @filter_ary); @@ -571,7 +577,7 @@ sub get_warehouse_report { $joins WHERE $where_clause GROUP BY $group_clause $group_by - ORDER BY $form->{sort}|; + ORDER BY $sort_spec|; my $sth = prepare_execute_query($form, $dbh, $query, @filter_vars); diff --git a/bin/mozilla/ap.pl b/bin/mozilla/ap.pl index 070748b1a..884933b9f 100644 --- a/bin/mozilla/ap.pl +++ b/bin/mozilla/ap.pl @@ -1420,7 +1420,7 @@ sub ap_transactions { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('ap_transactions', @hidden_variables); + $report->set_export_options('ap_transactions', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); @@ -1440,7 +1440,7 @@ sub ap_transactions { 'raw_bottom_info_text' => $form->parse_html_template('ap/ap_transactions_bottom'), 'output_format' => 'HTML', 'title' => $form->{title}, - 'attachment_basename' => $locale->text('invoice_list') . strftime('_%Y%m%d', localtime time), + 'attachment_basename' => $locale->text('vendor_invoice_list') . strftime('_%Y%m%d', localtime time), ); $report->set_options_from_form(); diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl index b8aa128a9..43d324bf4 100644 --- a/bin/mozilla/ar.pl +++ b/bin/mozilla/ar.pl @@ -1507,7 +1507,7 @@ sub ar_transactions { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('ar_transactions', @hidden_variables); + $report->set_export_options('ar_transactions', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 75c10a340..02ac29e1c 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -206,7 +206,7 @@ sub list_names { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('list_names', @hidden_variables); + $report->set_export_options('list_names', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/dn.pl b/bin/mozilla/dn.pl index 07830aabc..f9485c554 100644 --- a/bin/mozilla/dn.pl +++ b/bin/mozilla/dn.pl @@ -310,7 +310,7 @@ sub show_dunning { $report->set_options('std_column_visibility' => 1, 'title' => $form->{title}); - $report->set_export_options('show_dunning', @filter_field_list); + $report->set_export_options('show_dunning', @filter_field_list, qw(sort sortdir)); my %column_defs = ( 'checkbox' => { 'text' => '', 'visible' => 'HTML' }, diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index 29eff0ec8..23989b302 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -460,7 +460,7 @@ sub orders { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('orders', @hidden_variables); + $report->set_export_options('orders', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/fu.pl b/bin/mozilla/fu.pl index 437d6bf52..202a9d806 100644 --- a/bin/mozilla/fu.pl +++ b/bin/mozilla/fu.pl @@ -259,7 +259,7 @@ sub report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('report', @report_params); + $report->set_export_options('report', @report_params, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/gl.pl b/bin/mozilla/gl.pl index 3887720de..a2816e8f0 100644 --- a/bin/mozilla/gl.pl +++ b/bin/mozilla/gl.pl @@ -499,7 +499,7 @@ sub generate_report { foreach my $name (qw(id transdate reference source description debit_accno credit_accno debit_tax_accno credit_tax_accno)) { my $sortname = $name =~ m/accno/ ? 'accno' : $name; - my $sortdir = $sortname eq $name ? 1 - $form->{sortdir} : $form->{sortdir}; + my $sortdir = $sortname eq $form->{sort} ? 1 - $form->{sortdir} : $form->{sortdir}; $column_defs{$name}->{link} = $callback . "&sort=$sortname&sortdir=$sortdir"; } @@ -516,7 +516,7 @@ sub generate_report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('generate_report', @hidden_variables); + $report->set_export_options('generate_report', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort} eq 'accno' ? 'debit_accno' : $form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index c49089552..196960825 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -972,7 +972,7 @@ sub orders { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('orders', @hidden_variables); + $report->set_export_options('orders', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); my @options; diff --git a/bin/mozilla/projects.pl b/bin/mozilla/projects.pl index a65874271..a9740b1fa 100644 --- a/bin/mozilla/projects.pl +++ b/bin/mozilla/projects.pl @@ -132,7 +132,7 @@ sub project_report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('project_report', @hidden_vars); + $report->set_export_options('project_report', @hidden_vars, 'sort'); $report->set_sort_indicator($form->{sort}, 1); diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 944106586..98a0aba59 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -2308,7 +2308,7 @@ sub list_payments { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('list_payments', @hidden_variables); + $report->set_export_options('list_payments', @hidden_variables, qw(sort sortdir)); $report->set_sort_indicator($form->{sort}, $form->{sortdir}); diff --git a/bin/mozilla/wh.pl b/bin/mozilla/wh.pl index 477ab0bce..d1d406da6 100644 --- a/bin/mozilla/wh.pl +++ b/bin/mozilla/wh.pl @@ -645,13 +645,13 @@ sub generate_journal { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('generate_journal', @hidden_variables); + $report->set_export_options('generate_journal', @hidden_variables, qw(sort order)); $report->set_sort_indicator($form->{sort}, $form->{order}); $report->set_options('output_format' => 'HTML', 'title' => $form->{title}, - 'attachment_basename' => strftime('warehouse_journal_%Y%m%d', localtime time)); + 'attachment_basename' => strftime($locale->text('warehouse_journal_list') . '_%Y%m%d', localtime time)); $report->set_options_from_form(); my $all_units = AM->retrieve_units(\%myconfig, $form); @@ -767,13 +767,13 @@ sub generate_report { $report->set_columns(%column_defs); $report->set_column_order(@columns); - $report->set_export_options('generate_report', @hidden_variables); + $report->set_export_options('generate_report', @hidden_variables, qw(sort order)); $report->set_sort_indicator($sort_col, $form->{order}); $report->set_options('output_format' => 'HTML', 'title' => $form->{title}, - 'attachment_basename' => strftime('warehouse_report_%Y%m%d', localtime time)); + 'attachment_basename' => strftime($locale->text('warehouse_report_list') . '_%Y%m%d', localtime time)); $report->set_options_from_form(); my $all_units = AM->retrieve_units(\%myconfig, $form); diff --git a/locale/de/all b/locale/de/all index e936f00e1..47a8fbae5 100644 --- a/locale/de/all +++ b/locale/de/all @@ -1680,6 +1680,7 @@ $self->{texts} = { 'You\'ve already chosen the following limitations:' => 'Sie haben bereits die folgenden Einschränkungen vorgenommen:', 'Your PostgreSQL installationen uses UTF-8 as its encoding. Therefore you have to configure Lx-Office to use UTF-8 as well.' => 'Ihre PostgreSQL-Installation benutzt UTF-8 als Zeichensatz. Sie müssen deshalb Lx-Office so konfigurieren, dass es ebenfalls UTF-8 als Zeichensatz benutzt.', 'Your TODO list' => 'Ihre Aufgabenliste', + 'Your download does not exist anymore. Please re-run the DATEV export assistant.' => 'Ihr Download existiert nicht mehr. Bitte starten Sie den DATEV-Exportassistenten erneut.', 'Zeitpunkt' => 'Zeitpunkt', 'Zeitraum' => 'Zeitraum', 'Zero amount posting!' => 'Buchung ohne Wert', @@ -1812,7 +1813,10 @@ $self->{texts} = { 'used' => 'Verbraucht', 'valid from' => 'Gültig ab', 'vendor' => 'Lieferant', + 'vendor_invoice_list' => 'kreditorenbuchungsliste', 'vendor_list' => 'lieferantenliste', + 'warehouse_journal_list' => 'lagerbuchungsliste', + 'warehouse_report_list' => 'lagerbestandsliste', 'wrongformat' => 'Falsches Format', 'yes' => 'ja', }; diff --git a/locale/de/ap b/locale/de/ap index 2e8492eeb..d450bc703 100644 --- a/locale/de/ap +++ b/locale/de/ap @@ -271,7 +271,6 @@ $self->{texts} = { 'customer' => 'Kunde', 'history' => 'Historie', 'invoice' => 'Rechnung', - 'invoice_list' => 'debitorenbuchungsliste', 'mark as paid' => 'als bezahlt markieren', 'no' => 'nein', 'packing_list' => 'Versandliste', @@ -284,6 +283,7 @@ $self->{texts} = { 'sales_order' => 'Kundenauftrag', 'sales_quotation' => 'Verkaufsangebot', 'vendor' => 'Lieferant', + 'vendor_invoice_list' => 'kreditorenbuchungsliste', 'wrongformat' => 'Falsches Format', 'yes' => 'ja', }; diff --git a/locale/de/datev b/locale/de/datev index 147912b68..3af715bcd 100644 --- a/locale/de/datev +++ b/locale/de/datev @@ -165,6 +165,7 @@ $self->{texts} = { 'Warehouse management' => 'Lagerverwaltung/Bestandsveränderung', 'You do not have the permissions to access this function.' => 'Sie verfügen nicht über die notwendigen Rechte, um auf diese Funktion zuzugreifen.', 'Your PostgreSQL installationen uses UTF-8 as its encoding. Therefore you have to configure Lx-Office to use UTF-8 as well.' => 'Ihre PostgreSQL-Installation benutzt UTF-8 als Zeichensatz. Sie müssen deshalb Lx-Office so konfigurieren, dass es ebenfalls UTF-8 als Zeichensatz benutzt.', + 'Your download does not exist anymore. Please re-run the DATEV export assistant.' => 'Ihr Download existiert nicht mehr. Bitte starten Sie den DATEV-Exportassistenten erneut.', 'Zeitraum' => 'Zeitraum', '[email]' => '[email]', 'bin_list' => 'Lagerliste', diff --git a/locale/de/wh b/locale/de/wh index a0001ae0e..76fb757c3 100644 --- a/locale/de/wh +++ b/locale/de/wh @@ -219,6 +219,8 @@ $self->{texts} = { 'transfer' => 'Umlagerung', 'used' => 'Verbraucht', 'vendor' => 'Lieferant', + 'warehouse_journal_list' => 'lagerbuchungsliste', + 'warehouse_report_list' => 'lagerbestandsliste', 'yes' => 'ja', };