From: G. Richardson Date: Sat, 11 Jun 2016 10:04:08 +0000 (+0200) Subject: SL::DB::Invoice.pm post Methode benutzt Standardforderungskonto X-Git-Tag: release-3.5.4~2232 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=72e403238ba3798e1d5ab57d1708d44fe6692677;p=kivitendo-erp.git SL::DB::Invoice.pm post Methode benutzt Standardforderungskonto statt einfach das erste AR-Konto, wenn es in der Mandantenkonfiguration gesetzt ist, und kein Forderungskonto übergeben wurde. --- diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 7800daa0d..3f337f103 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -240,9 +240,14 @@ sub post { require SL::DB::Chart; if (!$params{ar_id}) { - my $chart = SL::DB::Manager::Chart->get_all(query => [ SL::DB::Manager::Chart->link_filter('AR') ], - sort_by => 'id ASC', - limit => 1)->[0]; + my $chart; + if ($::instance_conf->get_ar_chart_id) { + $chart = SL::DB::Manager::Chart->find_by(id => $::instance_conf->get_ar_chart_id); + } else { + $chart = SL::DB::Manager::Chart->get_all(query => [ SL::DB::Manager::Chart->link_filter('AR') ], + sort_by => 'id ASC', + limit => 1)->[0]; + }; croak("No AR chart found and no parameter 'ar_id' given") unless $chart; $params{ar_id} = $chart->id; }