From 5772b02ec63ecad6ba778e8ed78a190c5ce243c0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 11 Dec 2006 15:06:40 +0000 Subject: [PATCH] =?utf8?q?Beim=20Datenbankupgrade=20fuer=20Buchungsgruppen?= =?utf8?q?=20muss=20bei=20aktivierter=20EUR=20der=20Vergleich=20mit=20den?= =?utf8?q?=20Buchungsgruppen=20ohne=20das=20Bestandskonto=20erfolgen.=20Da?= =?utf8?q?s=20Bestandskonto=20wird=20dann=20f=C3=BCr=20die=20Artikel=20imm?= =?utf8?q?er=20=C3=BCberschrieben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl b/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl index 9387b0e1d..89f42cf7c 100644 --- a/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl +++ b/sql/Pg-upgrade/Pg-upgrade-2.2.0.33-2.2.0.34.pl @@ -154,16 +154,21 @@ sub update_known_buchungsgruppen { my $sth = $dbh->prepare($query); $sth->execute() || mydberror($query); - my $query_update = "UPDATE parts SET buchungsgruppen_id = ? WHERE id = ?"; + my $query_update = "UPDATE parts SET buchungsgruppen_id = ?"; + $query_update .= ", inventory_accno_id = ?" if ($main::eur); + $query_update .= " WHERE id = ?"; my $sth_update = $dbh->prepare($query_update); while (my $ref = $sth->fetchrow_hashref()) { foreach my $bg (@{$buchungsgruppen}) { - if (($ref->{"inventory_accno_id"} == $bg->{"inventory_accno_id"}) && + if (($main::eur || + ($ref->{"inventory_accno_id"} == $bg->{"inventory_accno_id"})) && ($ref->{"income_accno_id"} == $bg->{"income_accno_id_0"}) && ($ref->{"expense_accno_id"} == $bg->{"expense_accno_id_0"})) { - $sth_update->execute($bg->{"id"}, $ref->{"id"}) || - mydberror($query_update . " ($bg->{id}, $ref->{id})"); + my @values = ($bg->{"id"}, $ref->{"id"}); + splice(@values, 1, 0, $bg->{"inventory_accno_id"}) if ($main::eur); + $sth_update->execute(@values) || + mydberror($query_update . " (" . join(", ", @values) . ")"); last; } } -- 2.20.1