From 1f9b0c55e2288183a36b9026f1758a3921967811 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Mon, 4 Aug 2014 14:19:28 +0200 Subject: [PATCH] =?utf8?q?CsvImport=20-=20Part=20:=20Anpassung=20f=C3=BCr?= =?utf8?q?=20neue=20Steuerzonen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit statt income/expense_accno_id_0 werden jetzt bei importierten Waren/Dienstleistungen die Konten-IDs der Standardsteuerzone verwendet. (Wobei die genau ID ja egal ist, wichtig ist, ob etwas gesetzt ist). --- SL/Controller/CsvImport/Part.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 34bdd7365..7dd4d83e3 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -258,7 +258,7 @@ sub check_type { my ($self, $entry) = @_; my $bg = $self->bg_by->{id}->{ $entry->{object}->buchungsgruppen_id }; - $bg ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1, income_accno_id_0 => 1, expense_accno_id_0 => 1); + $bg ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1); # does this case ever occur? my $type = $self->settings->{parts_type}; if ($type eq 'mixed') { @@ -270,17 +270,21 @@ sub check_type { $entry->{object}->assembly($type eq 'assembly'); - $entry->{object}->income_accno_id( $bg->income_accno_id_0 ); + # when saving income_accno_id or expense_accno_id use ids from the selected + # $bg according to the default tax_zone (the one with the highest sort + # order). Alternatively one could use the ids from defaults, but they might + # not all be set. + + $entry->{object}->income_accno_id( $bg->income_accno_id( SL::DB::Manager::TaxZone->get_default->id ) ); if ($type eq 'part' || $type eq 'service') { - $entry->{object}->expense_accno_id( $bg->expense_accno_id_0 ); + $entry->{object}->expense_accno_id( $bg->expense_accno_id( SL::DB::Manager::TaxZone->get_default->id ) ); } if ($type eq 'part') { $entry->{object}->inventory_accno_id( $bg->inventory_accno_id ); } - if (none { $_ eq $type } qw(part service assembly)) { push @{ $entry->{errors} }, $::locale->text('Error: Invalid part type'); return 0; -- 2.20.1