Wallpapers use new pricing listprice, external products use old version (#151)

This commit is contained in:
Fredrik Ringqvist
2023-06-12 09:05:47 +02:00
committed by GitHub
parent 1b6c24a5d2
commit 21ae1c4fb9
+13 -1
View File
@@ -225,5 +225,17 @@ export function searchByFieldValue(fieldid: number) {
} }
export function getProductListPrice() { 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 = ?';
} }