balance_startdate_method_options nach AccountingPeriod Helper
authorG. Richardson <grichardson@kivitec.de>
Sun, 29 Sep 2019 07:33:29 +0000 (09:33 +0200)
committerG. Richardson <grichardson@kivitec.de>
Mon, 30 Sep 2019 09:50:41 +0000 (11:50 +0200)
verlagert, wird auch für YearEndTransactions benötigt.

SL/Controller/ClientConfig.pm
SL/DB/Helper/AccountingPeriod.pm

index 59fe4f5..3d5b770 100644 (file)
@@ -18,6 +18,7 @@ use SL::Locale::String qw(t8);
 use SL::PriceSource::ALL;
 use SL::Template;
 use SL::Controller::TopQuickSearch;
+use SL::DB::Helper::AccountingPeriod qw(get_balance_startdate_method_options);
 use SL::Helper::ShippedQty;
 
 __PACKAGE__->run_before('check_auth');
@@ -188,11 +189,7 @@ sub init_profit_options {
 }
 
 sub init_balance_startdate_method_options {
-  [ { title => t8("After closed period"),                       value => "closed_to"                   },
-    { title => t8("Start of year"),                             value => "start_of_year"               },
-    { title => t8("All transactions"),                          value => "all_transactions"            },
-    { title => t8("Last opening balance or all transactions"),  value => "last_ob_or_all_transactions" },
-    { title => t8("Last opening balance or start of year"),     value => "last_ob_or_start_of_year"    }, ]
+  return SL::DB::Helper::AccountingPeriod::get_balance_startdate_method_options;
 }
 
 sub init_all_price_sources {
index 1bd0806..e29d0e5 100644 (file)
@@ -1,13 +1,24 @@
 package SL::DB::Helper::AccountingPeriod;
 
 use strict;
+use SL::Locale::String qw(t8);
 
 use parent qw(Exporter);
 use SL::DBUtils;
-our @EXPORT = qw(get_balance_starting_date);
+our @EXPORT = qw(get_balance_starting_date get_balance_startdate_method_options);
 
 use Carp;
 
+sub get_balance_startdate_method_options {
+  [
+    { title => t8("After closed period"),                       value => "closed_to"                   },
+    { title => t8("Start of year"),                             value => "start_of_year"               },
+    { title => t8("All transactions"),                          value => "all_transactions"            },
+    { title => t8("Last opening balance or all transactions"),  value => "last_ob_or_all_transactions" },
+    { title => t8("Last opening balance or start of year"),     value => "last_ob_or_start_of_year"    },
+  ]
+}
+
 sub get_balance_starting_date {
   my ($self,$asofdate) = @_;
 
@@ -106,6 +117,11 @@ SL::DB::Helper::AccountingPeriod - Helper functions for calculating dates relati
 
 =over 4
 
+=item C<get_balance_startdate_method_options>
+
+Returns an arrayref of translated options for determining the startdate of a
+balance period or the yearend period. To be used as the options for a dropdown.
+
 =item C<get_balance_starting_date $date>
 
 Given a date this method calculates and returns the starting date of the