commit fc8ad1a3510949f71a0b35415130d573599fb5d4
Author: Moritz Bunkus <m.bunkus@linet.de>
Date:   Mon Jul 7 09:26:09 2008 +0000

    Auslagerung gemeinsamen Codes.

diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl
index c3c4b07e4..b4ccfe3c4 100644
--- a/bin/mozilla/do.pl
+++ b/bin/mozilla/do.pl
@@ -409,9 +409,7 @@ sub orders {
 
   ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} });
 
-  $form->{sort}    ||= 'transdate';
-  $form->{sortdir}   = 1 unless (defined $form->{sortdir});
-  $form->{sortdir}   = $form->{sortdir} ? 1 : 0;
+  report_generator_set_default_sort('transdate', 1);
 
   DO->transactions();
 
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 5c1a9c246..322706ac1 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -888,9 +888,7 @@ sub orders {
 
   ($form->{ $form->{vc} }, $form->{"${form->{vc}}_id"}) = split(/--/, $form->{ $form->{vc} });
 
-  $form->{sort}    ||= 'transdate';
-  $form->{sortdir}   = 1 unless (defined $form->{sortdir});
-  $form->{sortdir}   = $form->{sortdir} ? 1 : 0;
+  report_generator_set_default_sort('transdate', 1);
 
   OE->transactions(\%myconfig, \%$form);
 
diff --git a/bin/mozilla/reportgenerator.pl b/bin/mozilla/reportgenerator.pl
index 50f6eccad..5f5d4079b 100644
--- a/bin/mozilla/reportgenerator.pl
+++ b/bin/mozilla/reportgenerator.pl
@@ -16,6 +16,20 @@ use SL::Common;
 use SL::MoreCommon;
 use SL::ReportGenerator;
 
+sub report_generator_set_default_sort {
+  $lxdebug->enter_sub();
+
+  my $default_sortorder   = shift;
+  my $default_sortdir     = shift;
+
+  $form->{sort}         ||= $default_sortorder;
+  $form->{sortdir}        = $default_sortdir unless (defined $form->{sortdir});
+  $form->{sortdir}        = $form->{sortdir} ? 1 : 0;
+
+  $lxdebug->leave_sub();
+}
+
+
 sub report_generator_export_as_pdf {
   $lxdebug->enter_sub();
 
diff --git a/locale/de/ap b/locale/de/ap
index b3268c3e8..575e48259 100644
--- a/locale/de/ap
+++ b/locale/de/ap
@@ -311,6 +311,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save_draft'                  => 'save_draft',
   'search'                      => 'search',
diff --git a/locale/de/ar b/locale/de/ar
index 9259d315c..6f4891721 100644
--- a/locale/de/ar
+++ b/locale/de/ar
@@ -322,6 +322,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save_draft'                  => 'save_draft',
   'search'                      => 'search',
diff --git a/locale/de/ca b/locale/de/ca
index 462950484..959acfea3 100644
--- a/locale/de/ca
+++ b/locale/de/ca
@@ -175,6 +175,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'weiter'                      => 'continue',
   'buchungsliste'               => 'list_transactions',
 };
diff --git a/locale/de/ct b/locale/de/ct
index cdd9e0377..19126f0f1 100644
--- a/locale/de/ct
+++ b/locale/de/ct
@@ -215,6 +215,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save'                        => 'save',
   'save_and_ap_transaction'     => 'save_and_ap_transaction',
diff --git a/locale/de/dn b/locale/de/dn
index fb35eac9d..98089a18e 100644
--- a/locale/de/dn
+++ b/locale/de/dn
@@ -318,6 +318,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save'                        => 'save',
diff --git a/locale/de/do b/locale/de/do
index 3e05f0add..137c9ac3f 100644
--- a/locale/de/do
+++ b/locale/de/do
@@ -361,6 +361,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save'                        => 'save',
diff --git a/locale/de/fu b/locale/de/fu
index c91b0bfbe..0c08e9340 100644
--- a/locale/de/fu
+++ b/locale/de/fu
@@ -161,6 +161,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'save'                        => 'save',
   'save_access_rights'          => 'save_access_rights',
   'save_follow_up'              => 'save_follow_up',
diff --git a/locale/de/gl b/locale/de/gl
index ce11afc8f..f1e768732 100644
--- a/locale/de/gl
+++ b/locale/de/gl
@@ -284,6 +284,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'search'                      => 'search',
   'select_part'                 => 'select_part',
diff --git a/locale/de/ic b/locale/de/ic
index bd2bd7c1d..30845d6e5 100644
--- a/locale/de/ic
+++ b/locale/de/ic
@@ -386,6 +386,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save'                        => 'save',
diff --git a/locale/de/login b/locale/de/login
index 4b4fcd2c8..380f8351c 100644
--- a/locale/de/login
+++ b/locale/de/login
@@ -469,6 +469,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'sales_order'                 => 'sales_order',
diff --git a/locale/de/oe b/locale/de/oe
index da8a2988a..23553b914 100644
--- a/locale/de/oe
+++ b/locale/de/oe
@@ -426,6 +426,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'sales_order'                 => 'sales_order',
diff --git a/locale/de/projects b/locale/de/projects
index 3f1ede5c0..82ab89db6 100644
--- a/locale/de/projects
+++ b/locale/de/projects
@@ -181,6 +181,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'save'                        => 'save',
   'save_as_new'                 => 'save_as_new',
diff --git a/locale/de/reportgenerator b/locale/de/reportgenerator
index a4e7c3ceb..18eac6645 100644
--- a/locale/de/reportgenerator
+++ b/locale/de/reportgenerator
@@ -112,6 +112,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'weiter'                      => 'continue',
 };
 
diff --git a/locale/de/rp b/locale/de/rp
index 098f74924..0338f2111 100644
--- a/locale/de/rp
+++ b/locale/de/rp
@@ -307,6 +307,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'select_all'                  => 'select_all',
   'select_name'                 => 'select_name',
diff --git a/locale/de/todo b/locale/de/todo
index 04e38cef3..2b8ca2e25 100644
--- a/locale/de/todo
+++ b/locale/de/todo
@@ -458,6 +458,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'request_for_quotation'       => 'request_for_quotation',
   'retrieve_partunits'          => 'retrieve_partunits',
   'sales_order'                 => 'sales_order',
diff --git a/locale/de/wh b/locale/de/wh
index a305ae5da..5adb82f4d 100644
--- a/locale/de/wh
+++ b/locale/de/wh
@@ -228,6 +228,7 @@ $self->{subs} = {
   'report_generator_do'         => 'report_generator_do',
   'report_generator_export_as_csv' => 'report_generator_export_as_csv',
   'report_generator_export_as_pdf' => 'report_generator_export_as_pdf',
+  'report_generator_set_default_sort' => 'report_generator_set_default_sort',
   'retrieve_partunits'          => 'retrieve_partunits',
   'select_part'                 => 'select_part',
   'select_part_internal'        => 'select_part_internal',
