From: Moritz Bunkus Date: Mon, 11 Dec 2006 12:53:03 +0000 (+0000) Subject: Buchungsgruppen: Bei aktivierter EUR muss das Inventarkonto automatisch ausgewaehlt... X-Git-Tag: release-2.4.0^2~89 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1beff66b3fa058377168668daac8a51092bfea5d;p=kivitendo-erp.git Buchungsgruppen: Bei aktivierter EUR muss das Inventarkonto automatisch ausgewaehlt und vorbelegt werden. War durch Commit 1406 defekt. --- diff --git a/SL/AM.pm b/SL/AM.pm index 01167eebe..843d5ea63 100644 --- a/SL/AM.pm +++ b/SL/AM.pm @@ -998,6 +998,10 @@ sub get_buchungsgruppe { $sth->finish; } + + $query = "SELECT inventory_accno_id FROM defaults"; + ($form->{"std_inventory_accno_id"}) = $dbh->selectrow_array($query); + my $module = "IC"; $query = qq|SELECT c.accno, c.description, c.link, c.id, d.inventory_accno_id, d.income_accno_id, d.expense_accno_id @@ -1010,6 +1014,9 @@ sub get_buchungsgruppe { $sth->execute || $form->dberror($query); while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { foreach my $key (split(/:/, $ref->{link})) { + if (!$form->{"std_inventory_accno_id"} && ($key eq "IC")) { + $form->{"std_inventory_accno_id"} = $ref->{"id"}; + } if ($key =~ /$module/) { if ( ($ref->{id} eq $ref->{inventory_accno_id}) || ($ref->{id} eq $ref->{income_accno_id}) diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e7d7db206..fcf7d018b 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1712,6 +1712,9 @@ sub add_buchungsgruppe { "$form->{script}?action=add_buchungsgruppe&path=$form->{path}&login=$form->{login}&password=$form->{password}" unless $form->{callback}; AM->get_buchungsgruppe(\%myconfig, \%$form); + if ($eur) { + $form->{"inventory_accno_id"} = $form->{"std_inventory_accno_id"}; + } &buchungsgruppe_header; &form_footer;