Use isModEnabled
This commit is contained in:
parent
49f1afccca
commit
cce6d82741
@ -545,7 +545,7 @@ print '<td>'.$langs->trans("VariantsAbility").'</td>';
|
|||||||
print '<td class="right">';
|
print '<td class="right">';
|
||||||
//print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0);
|
//print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0);
|
||||||
//print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1);
|
//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>';
|
print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabled", $langs->transnoentitiesnoconv("Module610Name")).'</span>';
|
||||||
} else {
|
} else {
|
||||||
print yn(1).' <span class="opacitymedium">('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')</span>';
|
print yn(1).' <span class="opacitymedium">('.$langs->trans("ModuleIsEnabled", $langs->transnoentitiesnoconv("Module610Name")).')</span>';
|
||||||
|
|||||||
@ -2534,7 +2534,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parent product.
|
// Parent product.
|
||||||
if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) {
|
if (isModEnabled('variants') && ($object->isProduct() || $object->isService())) {
|
||||||
$combination = new ProductCombination($db);
|
$combination = new ProductCombination($db);
|
||||||
|
|
||||||
if ($combination->fetchByFkProductChild($object->id) > 0) {
|
if ($combination->fetchByFkProductChild($object->id) > 0) {
|
||||||
|
|||||||
@ -1279,7 +1279,7 @@ class Product extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
if (!empty($conf->variants->enabled)) {
|
if (isModEnabled('variants')) {
|
||||||
include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
||||||
|
|
||||||
$comb = new ProductCombination($this->db);
|
$comb = new ProductCombination($this->db);
|
||||||
@ -4762,7 +4762,7 @@ class Product extends CommonObject
|
|||||||
public function isVariant()
|
public function isVariant()
|
||||||
{
|
{
|
||||||
global $conf;
|
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').")";
|
$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);
|
$query = $this->db->query($sql);
|
||||||
|
|||||||
@ -95,7 +95,7 @@ $optioncss = GETPOST('optioncss', 'alpha');
|
|||||||
$type = GETPOST("type", "int");
|
$type = GETPOST("type", "int");
|
||||||
|
|
||||||
//Show/hide child products
|
//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');
|
$show_childproducts = GETPOST('search_show_childproducts');
|
||||||
} else {
|
} else {
|
||||||
$show_childproducts = '';
|
$show_childproducts = '';
|
||||||
@ -419,7 +419,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
|||||||
$sql .= ' p.fk_unit, cu.label as cu_label,';
|
$sql .= ' p.fk_unit, cu.label as cu_label,';
|
||||||
}
|
}
|
||||||
$sql .= ' MIN(pfp.unitprice) as minsellprice';
|
$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';
|
$sql .= ', pac.rowid prod_comb_id';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// 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())."'";
|
$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";
|
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid";
|
||||||
}
|
}
|
||||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
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";
|
$sql .= " AND pac.rowid IS NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +580,7 @@ if (!empty($conf->global->PRODUCT_USE_UNITS)) {
|
|||||||
$sql .= ', p.fk_unit, cu.label';
|
$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';
|
$sql .= ', pac.rowid';
|
||||||
}
|
}
|
||||||
// Add fields from extrafields
|
// Add fields from extrafields
|
||||||
@ -837,7 +837,7 @@ if ($resql) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Show/hide child products. Hidden by default
|
//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 .= '<div class="divsearchfield">';
|
||||||
$moreforfilter .= '<input type="checkbox" id="search_show_childproducts" name="search_show_childproducts"'.($show_childproducts ? 'checked="checked"' : '').'>';
|
$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>';
|
$moreforfilter .= ' <label for="search_show_childproducts">'.$langs->trans('ShowChildProducts').'</label>';
|
||||||
|
|||||||
@ -48,7 +48,7 @@ if (!empty($conf->project->enabled)) {
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
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/ProductAttribute.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user