From 0d3d9d8e821147107b1bb6281e180313866a87bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 12 May 2011 15:33:04 +0200 Subject: [PATCH] =?utf8?q?Ein=20Query=20in=20IS->pricegroup=5Ffor=5Fpart?= =?utf8?q?=20aufger=C3=A4umt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IS.pm | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/SL/IS.pm b/SL/IS.pm index 039c034b4..c1b8fe378 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -2035,27 +2035,27 @@ sub get_pricegroups_for_parts { } my $query = - qq|SELECT + qq|SELECT + 0 as pricegroup_id, + sellprice AS default_sellprice, + '' AS pricegroup, + sellprice AS price, + 'selected' AS selected + FROM parts + WHERE id = ? + UNION ALL + SELECT pricegroup_id, - (SELECT p.sellprice FROM parts p WHERE p.id = ?) AS default_sellprice, - (SELECT pg.pricegroup FROM pricegroup pg WHERE id = pricegroup_id) AS pricegroup, + parts.sellprice AS default_sellprice, + pricegroup.pricegroup, price, '' AS selected FROM prices + LEFT JOIN parts ON parts.id = parts_id + LEFT JOIN pricegroup ON pricegroup.id = pricegroup_id WHERE parts_id = ? - - UNION - - SELECT - 0 as pricegroup_id, - (SELECT sellprice FROM parts WHERE id = ?) AS default_sellprice, - '' AS pricegroup, - (SELECT DISTINCT sellprice FROM parts where id = ?) AS price, - 'selected' AS selected - FROM prices - ORDER BY pricegroup|; - my @values = (conv_i($id), conv_i($id), conv_i($id), conv_i($id)); + my @values = (conv_i($id), conv_i($id)); my $pkq = prepare_execute_query($form, $dbh, $query, @values); while (my $pkr = $pkq->fetchrow_hashref('NAME_lc')) { -- 2.20.1