From 21ae1c4fb901610b98b22a0302e1eadc1b6efc39 Mon Sep 17 00:00:00 2001 From: Fredrik Ringqvist <35255659+fredrikphotowall@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:05:47 +0200 Subject: [PATCH] Wallpapers use new pricing listprice, external products use old version (#151) --- src/datasources/sql/products-sql.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/datasources/sql/products-sql.ts b/src/datasources/sql/products-sql.ts index 334fd2e..50b7849 100644 --- a/src/datasources/sql/products-sql.ts +++ b/src/datasources/sql/products-sql.ts @@ -225,5 +225,17 @@ export function searchByFieldValue(fieldid: number) { } export function getProductListPrice() { - return 'SELECT listprice FROM v_listprices WHERE market_id = ? AND printproduct_id = ?'; + // Temporary solution during partial release of new pricing system. + // Wallpapers read price from new pricing system's listprice view, external products use the old view. + return ` + SELECT CASE + WHEN groupid IN (1,3) THEN new.listprice + ELSE old.listprice + END AS listprice + FROM v_listprices_new new + JOIN "product-printproducts" pp ON new.printproduct_id = printid + JOIN v_listprices old USING (market_id, printproduct_id) + WHERE new.market_id = ? AND new.printproduct_id = ? + `; + // return 'SELECT listprice FROM v_listprices WHERE market_id = ? AND printproduct_id = ?'; }