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 <eldy@destailleur.fr>
This commit is contained in:
atm-corentin 2025-07-29 02:59:43 +02:00 committed by GitHub
parent 0a40502fae
commit 5d22b46c68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');