From d1846b76fffdbafaa5610f713700d991c4a6d5e3 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Sun, 15 Nov 2020 09:12:14 +0100 Subject: [PATCH] Fixed parent product selection (fixes #1128) --- controllers/StockController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/StockController.php b/controllers/StockController.php index 89ed2a76..94ff438b 100644 --- a/controllers/StockController.php +++ b/controllers/StockController.php @@ -142,7 +142,7 @@ class StockController extends BaseController 'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'), 'productgroups' => $this->getDatabase()->product_groups()->orderBy('name'), 'userfields' => $this->getUserfieldsService()->GetFields('products'), - 'products' => $this->getDatabase()->products()->where('parent_product_id IS NULL and active = 1')->orderBy('name'), + 'products' => $this->getDatabase()->products()->where('IFNULL(parent_product_id, \'\') = \'\' and active = 1')->orderBy('name'), 'isSubProductOfOthers' => false, 'mode' => 'create' ]); @@ -159,7 +159,7 @@ class StockController extends BaseController 'shoppinglocations' => $this->getDatabase()->shopping_locations()->orderBy('name'), 'productgroups' => $this->getDatabase()->product_groups()->orderBy('name'), 'userfields' => $this->getUserfieldsService()->GetFields('products'), - 'products' => $this->getDatabase()->products()->where('id != :1 AND parent_product_id IS NULL and active = 1', $product->id)->orderBy('name'), + 'products' => $this->getDatabase()->products()->where('id != :1 AND IFNULL(parent_product_id, \'\') = \'\' and active = 1', $product->id)->orderBy('name'), 'isSubProductOfOthers' => $this->getDatabase()->products()->where('parent_product_id = :1', $product->id)->count() !== 0, 'mode' => 'edit', 'quConversions' => $this->getDatabase()->quantity_unit_conversions()