diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php
index d530b57b125..7462431d087 100644
--- a/htdocs/product/admin/product.php
+++ b/htdocs/product/admin/product.php
@@ -545,7 +545,7 @@ print '
'.$langs->trans("VariantsAbility").' | ';
print '';
//print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1);
-if (empty($conf->variants->enabled)) {
+if (!isModEnabled('variants')) {
print ''.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("Module610Name")).'';
} else {
print yn(1).' ('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')';
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index c856ef97a35..3cb335fbdb2 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -2534,7 +2534,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
}
// Parent product.
- if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
+ if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) {
$combination = new ProductCombination($db);
if ($combination->fetchByFkProductChild($object->id) > 0) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 0460642c746..30cf4393d1b 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -1279,7 +1279,7 @@ class Product extends CommonObject
}
if (!$error) {
- if (!empty($conf->variants->enabled)) {
+ if (isModEnabled('variants')) {
include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
$comb = new ProductCombination($this->db);
@@ -4762,7 +4762,7 @@ class Product extends CommonObject
public function isVariant()
{
global $conf;
- if (!empty($conf->variants->enabled)) {
+ if (isModEnabled('variants')) {
$sql = "SELECT rowid FROM ".$this->db->prefix()."product_attribute_combination WHERE fk_product_child = ".((int) $this->id)." AND entity IN (".getEntity('product').")";
$query = $this->db->query($sql);
diff --git a/htdocs/product/list.php b/htdocs/product/list.php
index 0a17c8e936f..2eb281e734c 100644
--- a/htdocs/product/list.php
+++ b/htdocs/product/list.php
@@ -95,7 +95,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
$type = GETPOST("type", "int");
//Show/hide child products
-if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
+if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$show_childproducts = GETPOST('search_show_childproducts');
} else {
$show_childproducts = '';
@@ -419,7 +419,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' p.fk_unit, cu.label as cu_label,';
}
$sql .= ' MIN(pfp.unitprice) as minsellprice';
-if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
+if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= ', pac.rowid prod_comb_id';
}
// Add fields from extrafields
@@ -448,7 +448,7 @@ if (getDolGlobalInt('MAIN_MULTILANGS')) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang = '".$db->escape($langs->getDefaultLang())."'";
}
-if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
+if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@@ -469,7 +469,7 @@ if (dol_strlen($search_type) && $search_type != '-1') {
}
}
-if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
+if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= " AND pac.rowid IS NULL";
}
@@ -580,7 +580,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ', p.fk_unit, cu.label';
}
-if (!empty($conf->variants->enabled) && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
+if (isModEnabled('variants') && (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD) && !$show_childproducts)) {
$sql .= ', pac.rowid';
}
// Add fields from extrafields
@@ -837,7 +837,7 @@ if ($resql) {
}
//Show/hide child products. Hidden by default
- if (!empty($conf->variants->enabled) && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
+ if (isModEnabled('variants') && !empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$moreforfilter .= ' ';
$moreforfilter .= '';
$moreforfilter .= ' ';
diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php
index bb89e670ee8..bd679a3f2d8 100644
--- a/htdocs/product/stock/product.php
+++ b/htdocs/product/stock/product.php
@@ -48,7 +48,7 @@ if (!empty($conf->project->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
}
-if (!empty($conf->variants->enabled)) {
+if (isModEnabled('variants')) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|