From da2f5aa8cea79ff0a3e1e5e88e74cbf7e9e79794 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Mon, 30 Sep 2019 10:56:14 +0200 Subject: [PATCH] =?utf8?q?AccountingPeriod=20-=20Methode=20an=20get=5Fbala?= =?utf8?q?nce=5Fstarting=5Fdate=20=C3=BCbergeben?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Für den Fall, daß man die Methode zur Ermittlung des Startdatums nicht aus der Mandantenkonfiguration nehmen möchte, sondern diese selber vorgeben, gibt es nun einen neuen Parameter, um die Methode selber zu bestimmen. Der Default ist weiterhin der Wert aus der Mandantenkonfiguration. --- SL/DB/Helper/AccountingPeriod.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SL/DB/Helper/AccountingPeriod.pm b/SL/DB/Helper/AccountingPeriod.pm index e29d0e5ed..9be3774e5 100644 --- a/SL/DB/Helper/AccountingPeriod.pm +++ b/SL/DB/Helper/AccountingPeriod.pm @@ -20,9 +20,10 @@ sub get_balance_startdate_method_options { } sub get_balance_starting_date { - my ($self,$asofdate) = @_; + my ($self, $asofdate, $startdate_method) = @_; - $asofdate ||= DateTime->today_local; + $asofdate ||= DateTime->today_local; + $startdate_method ||= $::instance_conf->get_balance_startdate_method; unless ( ref $asofdate eq 'DateTime' ) { $asofdate = $::locale->parse_date_to_object($asofdate); @@ -30,7 +31,6 @@ sub get_balance_starting_date { my $dbh = $::form->get_standard_dbh; - my $startdate_method = $::instance_conf->get_balance_startdate_method; # We could use the following objects to determine the starting date for # calculating the balance from asofdate (the reference date for the balance): @@ -122,7 +122,7 @@ SL::DB::Helper::AccountingPeriod - Helper functions for calculating dates relati 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 +=item C Given a date this method calculates and returns the starting date of the financial period relative to that date, according to the configured @@ -134,6 +134,8 @@ date-parsed. If no argument is passed the current day is assumed as default. +If no startdate method is passed, the default method from defaults is used. + =back =head1 BUGS -- 2.20.1