diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php
index c72976f829e..af44c18bee6 100644
--- a/htdocs/admin/company.php
+++ b/htdocs/admin/company.php
@@ -466,7 +466,7 @@ print ''."\n";
// Barcode
-if (!empty($conf->barcode->enabled)) {
+if (isModEnabled('barcode')) {
print '
| ';
print ' | ';
print '';
diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index f3cfc89dcc4..dd0b65d656a 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -1408,7 +1408,7 @@ class Form
if (count($scrit) > 1) {
$sql .= ")";
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$sql .= " OR s.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
}
$sql .= " OR s.code_client LIKE '".$this->db->escape($prefix.$filterkey)."%' OR s.code_fournisseur LIKE '".$this->db->escape($prefix.$filterkey)."%'";
@@ -2691,7 +2691,7 @@ class Form
if (count($scrit) > 1) {
$sql .= ")";
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
}
$sql .= ')';
@@ -3254,7 +3254,7 @@ class Form
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ", u.label as unit_long, u.short_label as unit_short, p.weight, p.weight_units, p.length, p.length_units, p.width, p.width_units, p.height, p.height_units, p.surface, p.surface_units, p.volume, p.volume_units";
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$sql .= ", pfp.barcode";
}
$sql .= " FROM ".$this->db->prefix()."product as p";
@@ -3305,7 +3305,7 @@ class Form
if (count($scrit) > 1) {
$sql .= ")";
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$sql .= " OR p.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
$sql .= " OR pfp.barcode LIKE '".$this->db->escape($prefix.$filterkey)."%'";
}
@@ -3402,7 +3402,7 @@ class Form
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
$optlabel .= ' ('.$objp->ref_fourn.')';
}
- if (!empty($conf->barcode->enabled) && !empty($objp->barcode)) {
+ if (isModEnabled('barcode') && !empty($objp->barcode)) {
$optlabel .= ' ('.$outbarcode.')';
}
$optlabel .= ' - '.dol_trunc($label, $maxlengtharticle);
@@ -3411,7 +3411,7 @@ class Form
if (!empty($objp->idprodfournprice) && ($objp->ref != $objp->ref_fourn)) {
$outvallabel .= ' ('.$objRefFourn.')';
}
- if (!empty($conf->barcode->enabled) && !empty($objp->barcode)) {
+ if (isModEnabled('barcode') && !empty($objp->barcode)) {
$outvallabel .= ' ('.$outbarcode.')';
}
$outvallabel .= ' - '.dol_trunc($label, $maxlengtharticle);
diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
index 3a8defb8db4..2a2f813011b 100644
--- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php
@@ -986,20 +986,20 @@ class pdf_espadon extends ModelePdfExpedition
}
// Show barcode
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$posx = 105;
} else {
$posx = $this->marge_gauche + 3;
}
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
}
$pdf->SetDrawColor(128, 128, 128);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
index ab9461d104f..de2c454de18 100644
--- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
+++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php
@@ -931,20 +931,20 @@ class pdf_rouget extends ModelePdfExpedition
}
// Show barcode
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$posx = 105;
} else {
$posx = $this->marge_gauche + 3;
}
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
}
$pdf->SetDrawColor(128, 128, 128);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php
index b18d10a29b1..090fdd59fa3 100644
--- a/htdocs/core/modules/modProduct.class.php
+++ b/htdocs/core/modules/modProduct.class.php
@@ -209,7 +209,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('e.ref'=>'DefaultWarehouse', 'p.tobatch'=>'ManageLotSerial', 'p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
}
$keyforselect = 'product';
@@ -247,7 +247,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('e.ref'=>'Text', 'p.tobatch'=>'Numeric', 'p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -266,7 +266,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -281,7 +281,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -404,7 +404,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
}
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
@@ -420,7 +420,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
@@ -436,7 +436,7 @@ class modProduct extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
}
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
@@ -629,7 +629,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@@ -722,7 +722,7 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
$import_sample = array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$import_sample = array_merge($import_sample, array('p.barcode'=>''));
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@@ -745,7 +745,7 @@ class modProduct extends DolibarrModules
}
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled
}
diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php
index bdc3388da5c..8f4b697332b 100644
--- a/htdocs/core/modules/modService.class.php
+++ b/htdocs/core/modules/modService.class.php
@@ -174,7 +174,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
}
$keyforselect = 'product';
@@ -210,7 +210,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -229,7 +229,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -244,7 +244,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'product', 'p.pmp'=>'product'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'product'));
}
if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled)) {
@@ -363,7 +363,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.stock'=>'Stock', 'p.seuil_stock_alerte'=>'StockLimit', 'p.desiredstock'=>'DesiredStock', 'p.pmp'=>'PMPValue'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode'));
}
$this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pa.qty'=>'Qty', 'pa.incdec'=>'ComposedProductIncDecStock'));
@@ -379,7 +379,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.stock'=>'Numeric', 'p.seuil_stock_alerte'=>'Numeric', 'p.desiredstock'=>'Numeric', 'p.pmp'=>'Numeric', 'p.cost_price'=>'Numeric'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('p.barcode'=>'Text'));
}
$this->export_TypeFields_array[$r] = array_merge($this->export_TypeFields_array[$r], array('pa.qty'=>'Numeric'));
@@ -395,7 +395,7 @@ class modService extends DolibarrModules
if (!empty($conf->stock->enabled)) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.stock'=>'virtualproduct', 'p.seuil_stock_alerte'=>'virtualproduct', 'p.desiredstock'=>'virtualproduct', 'p.pmp'=>'virtualproduct'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct'));
}
$this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct'));
@@ -576,7 +576,7 @@ class modService extends DolibarrModules
if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.localtax2_tx'=>'LT2', 'p.localtax2_type'=>'LT2Type'));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array('p.barcode'=>'BarCode'));
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@@ -667,7 +667,7 @@ class modService extends DolibarrModules
if (is_object($mysoc) && $mysoc->useLocalTax(2)) {
$import_sample = array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$import_sample = array_merge($import_sample, array('p.barcode'=>''));
}
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
@@ -693,7 +693,7 @@ class modService extends DolibarrModules
}
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->import_updatekeys_array[$r] = array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode')); //only show/allow barcode as update key if Barcode module enabled
}
diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
index 61fab1ab02d..886168c28a6 100644
--- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php
+++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php
@@ -856,20 +856,20 @@ class pdf_squille extends ModelePdfReception
}
// Show barcode
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$posx = 105;
} else {
$posx = $this->marge_gauche + 3;
}
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
}
$pdf->SetDrawColor(128, 128, 128);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for reception ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
index c00bf34621e..7722698593c 100644
--- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
+++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle.modules.php
@@ -944,20 +944,20 @@ class pdf_eagle extends ModelePdfStockTransfer
}
// Show barcode
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$posx = 105;
} else {
$posx = $this->marge_gauche + 3;
}
//$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
}
$pdf->SetDrawColor(128, 128, 128);
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
// TODO Build code bar with function writeBarCode of barcode module for sending ref $object->ref
//$pdf->SetXY($this->marge_gauche+3, $this->marge_haute+3);
//$pdf->Image($logo,10, 5, 0, 24);
diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php
index 333315b98c5..cdab93e6caa 100644
--- a/htdocs/fourn/class/fournisseur.product.class.php
+++ b/htdocs/fourn/class/fournisseur.product.class.php
@@ -620,7 +620,7 @@ class ProductFournisseur extends Product
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
$this->fourn_multicurrency_id = $obj->fk_multicurrency;
$this->fourn_multicurrency_code = $obj->multicurrency_code;
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$this->fourn_barcode = $obj->barcode; // deprecated
$this->fourn_fk_barcode_type = $obj->fk_barcode_type; // deprecated
$this->supplier_barcode = $obj->barcode;
@@ -730,7 +730,7 @@ class ProductFournisseur extends Product
$prodfourn->packaging = $record["packaging"];
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$prodfourn->supplier_barcode = $record["barcode"];
$prodfourn->supplier_fk_barcode_type = $record["fk_barcode_type"];
}
@@ -1178,7 +1178,7 @@ class ProductFournisseur extends Product
$label .= " ".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2);
}
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$label .= ' '.$langs->trans('BarCode').': '.$this->barcode;
}
diff --git a/htdocs/product/card.php b/htdocs/product/card.php
index d4baa9870ff..f0c765e59e9 100644
--- a/htdocs/product/card.php
+++ b/htdocs/product/card.php
@@ -1228,7 +1228,7 @@ llxHeader('', $title, $help_url);
// Load object modBarCodeProduct
$res = 0;
-if (!empty($conf->barcode->enabled) && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
+if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
$module = strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM);
$dirbarcode = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
foreach ($dirbarcode as $dirroot) {
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index acdb88da9f5..0b28ec54983 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -474,7 +474,7 @@ class Product extends CommonObject
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>5),
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>2, 'position'=>15),
- 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'!empty($conf->barcode->enabled)', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>3),
+ 'barcode' =>array('type'=>'varchar(255)', 'label'=>'Barcode', 'enabled'=>'isModEnabled('barcode')', 'position'=>20, 'visible'=>-1, 'showoncombobox'=>3),
'fk_barcode_type' => array('type'=>'integer', 'label'=>'BarcodeType', 'enabled'=>'1', 'position'=>21, 'notnull'=>0, 'visible'=>-1,),
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
'note' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
@@ -913,7 +913,7 @@ class Product extends CommonObject
{
// phpcs:enable
global $conf;
- if (!empty($conf->barcode->enabled) && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
+ if (isModEnabled('barcode') && !empty($conf->global->BARCODE_PRODUCT_ADDON_NUM)) {
$module = strtolower($conf->global->BARCODE_PRODUCT_ADDON_NUM);
$dirsociete = array_merge(array('/core/modules/barcode/'), $conf->modules_parts['barcode']);
@@ -4944,7 +4944,7 @@ class Product extends CommonObject
$label .= " ".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0, 2);
}
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$label .= ' '.$langs->trans('BarCode').': '.$this->barcode;
}
diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php
index bc6a1c36628..2e4962066e9 100644
--- a/htdocs/product/composition/card.php
+++ b/htdocs/product/composition/card.php
@@ -174,7 +174,7 @@ if ($action == 'search') {
$params[] = 'pl.description';
$params[] = 'pl.note';
}
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$params[] = 'p.barcode';
}
$sql .= natural_search($params, $key);
diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php
index 7b3520cc707..db4fdedbc01 100644
--- a/htdocs/product/fournisseurs.php
+++ b/htdocs/product/fournisseurs.php
@@ -40,7 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_expression.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php';
-if (!empty($conf->barcode->enabled)) {
+if (isModEnabled('barcode')) {
dol_include_once('/core/class/html.formbarcode.class.php');
}
// Load translation files required by the page
@@ -745,7 +745,7 @@ END;
print ' |
';
// Barcode
- if (!empty($conf->barcode->enabled)) {
+ if (isModEnabled('barcode')) {
$formbarcode = new FormBarCode($db);
// Barcode type
@@ -913,10 +913,10 @@ END;
'pfp.multicurrency_unitprice'=>array('label'=>$langs->trans("UnitPriceHTCurrency"), 'enabled' => (!empty($conf->multicurrency->enabled)), 'checked'=>0, 'position'=>10),
'pfp.delivery_time_days'=>array('label'=>$langs->trans("NbDaysToDelivery"), 'checked'=>1, 'position'=>13),
'pfp.supplier_reputation'=>array('label'=>$langs->trans("ReputationForThisProduct"), 'checked'=>1, 'position'=>14),
- 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => !empty($conf->barcode->enabled), 'checked'=>0, 'position'=>15),
- 'pfp.barcode'=>array('label'=>$langs->trans("BarcodeValue"), 'enabled' => !empty($conf->barcode->enabled), 'checked'=>0, 'position'=>16),
+ 'pfp.fk_barcode_type'=>array('label'=>$langs->trans("BarcodeType"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>15),
+ 'pfp.barcode'=>array('label'=>$langs->trans("BarcodeValue"), 'enabled' => isModEnabled('barcode'), 'checked'=>0, 'position'=>16),
'pfp.packaging'=>array('label'=>$langs->trans("PackagingForThisProduct"), 'enabled' => !empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING), 'checked'=>0, 'position'=>17),
- 'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => !empty($conf->barcode->enabled), 'checked'=>1, 'position'=>18),
+ 'pfp.tms'=>array('label'=>$langs->trans("DateModification"), 'enabled' => isModEnabled('barcode'), 'checked'=>1, 'position'=>18),
);
// fetch optionals attributes and labels
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index 00523c6bf3d..cdcfe74cb73 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -608,7 +608,7 @@ if ($object->id > 0) {
if (!empty($conf->use_javascript_ajax)) {
if ($permissiontoadd) {
// Link to launch scan tool
- if (!empty($conf->barcode->enabled) || !empty($conf->productbatch->enabled)) {
+ if (isModEnabled('barcode') || !empty($conf->productbatch->enabled)) {
print '