X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/737b3bdd3f0f38849d51162dc6f307a0d4a8da71..15b2640059:/SL/DB/Invoice.pm diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 99c2e11ad..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; } @@ -325,7 +330,7 @@ sub add_ar_amount_row { die "not an ar invoice" if $self->invoice and not $self->customer_id; die "add_ar_amount_row needs a chart object as chart param" unless $params{chart} && $params{chart}->isa('SL::DB::Chart'); - die unless $params{chart}->link =~ /AR_amount/; + die "chart must be an AR_amount chart" unless $params{chart}->link =~ /AR_amount/; my $acc_trans = [];