From 5d22b46c68935cdcaaabb6e3df1d6499925f24aa Mon Sep 17 00:00:00 2001 From: atm-corentin <165782689+atm-corentin@users.noreply.github.com> Date: Tue, 29 Jul 2025 02:59:43 +0200 Subject: [PATCH] FIX|Fix #Hide mandatory DLC/DLUO options when disabled in product configuration (#34790) * Hide DLC/DLUO mandatory options in product form when disabled by configuration * fix using constant * Update card.php --------- Co-authored-by: Laurent Destailleur --- htdocs/product/card.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 476614ad7da..be85f1fb953 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1330,6 +1330,18 @@ if (isModEnabled('accounting')) { $sellOrEatByMandatoryList = null; if (isModEnabled('productbatch')) { $sellOrEatByMandatoryList = Product::getSellOrEatByMandatoryList(); + + $disableSellBy = getDolGlobalString('PRODUCT_DISABLE_SELLBY'); + $disableEatBy = getDolGlobalString('PRODUCT_DISABLE_EATBY'); + + if ($disableSellBy) { + unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_BY]); + unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]); + } + if ($disableEatBy) { + unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_EAT_BY]); + unset($sellOrEatByMandatoryList[Product::SELL_OR_EAT_BY_MANDATORY_ID_SELL_AND_EAT]); + } } $title = $langs->trans('ProductServiceCard');