From 9a455c1f2d10f3e80336dd0d8b3f94367de58560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Sun, 11 May 2025 11:07:45 +0000 Subject: [PATCH] products hotfix --- modules/EcmProducts/EcmProduct.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/EcmProducts/EcmProduct.php b/modules/EcmProducts/EcmProduct.php index 012de61d..56ecc72c 100755 --- a/modules/EcmProducts/EcmProduct.php +++ b/modules/EcmProducts/EcmProduct.php @@ -624,6 +624,25 @@ class EcmProduct extends SugarBean } return false; } + function getProductUsingComponent() + { + $db = $GLOBALS['db']; + $res = $db->query(" + SELECT p.code, pc.quantity +FROM ecmproductcomponents AS pc +INNER JOIN ecmproducts AS p +ON p.id = pc.ecmproduct_id +WHERE ecmcomponent_id='$this->id'; + "); + $products = array(); + while ($row = $db->fetchByAssoc($res)) { + $products[] = array( + 'code' => $row['code'], + 'quantity' => $row['quantity'], + ); + } + return $products; + } //***************************Start Managing Positions*************************// function constructInsertQuery($data, $table = '') {