From 72e403238ba3798e1d5ab57d1708d44fe6692677 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Sat, 11 Jun 2016 12:04:08 +0200 Subject: [PATCH] SL::DB::Invoice.pm post Methode benutzt Standardforderungskonto MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit statt einfach das erste AR-Konto, wenn es in der Mandantenkonfiguration gesetzt ist, und kein Forderungskonto übergeben wurde. --- SL/DB/Invoice.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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; } -- 2.20.1