Use isModEnabled

This commit is contained in:
Alexandre SPANGARO 2022-09-25 06:09:58 +02:00
parent 49f1afccca
commit cce6d82741
5 changed files with 11 additions and 11 deletions

View File

@ -545,7 +545,7 @@ print '<td>'.$langs->trans("VariantsAbility").'</td>';
print '<td class="right">';
//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 '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("Module610Name")).'</span>';
} else {
print yn(1).' <span class="opacitymedium">('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')</span>';

View File

@ -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) {

View File

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

View File

@ -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 .= '<div class="divsearchfield">';
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';

View File

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