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 ''.img_picto('', 'barcode', 'class="paddingrightonly"').$langs->trans("UpdateByScaning").''; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 8f2eed18829..4cc79472ada 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -179,7 +179,7 @@ if (!empty($conf->global->MAIN_MULTILANGS)) { $fieldstosearchall['pl.description'] = 'ProductDescriptionTranslated'; $fieldstosearchall['pl.note'] = 'ProductNoteTranslated'; } -if (!empty($conf->barcode->enabled)) { +if (isModEnabled('barcode')) { $fieldstosearchall['p.barcode'] = 'Gencod'; $fieldstosearchall['pfp.barcode'] = 'GencodBuyPrice'; } @@ -207,7 +207,7 @@ $arrayfields = array( 'thumbnail'=>array('label'=>'Photo', 'checked'=>0, 'position'=>10), 'p.label'=>array('label'=>"Label", 'checked'=>1, 'position'=>10), 'p.fk_product_type'=>array('label'=>"Type", 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && !empty($conf->service->enabled)), 'position'=>11), - 'p.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled)), 'position'=>12), + 'p.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(isModEnabled('barcode')), 'position'=>12), 'p.duration'=>array('label'=>"Duration", 'checked'=>($contextpage != 'productlist'), 'enabled'=>(!empty($conf->service->enabled) && (string) $type == '1'), 'position'=>13), 'p.finished'=>array('label'=>"Nature", 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && $type != '1'), 'position'=>19), 'p.weight'=>array('label'=>'Weight', 'checked'=>0, 'enabled'=>(!empty($conf->product->enabled) && $type != '1'), 'position'=>20), diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index 2deb1dba8b1..58752a1bc7b 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -105,7 +105,7 @@ if (empty($conf) || !is_object($conf)) { barcode->enabled)) { ?> +if (isModEnabled('barcode')) { ?> trans('Gencod'); ?> diff --git a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php index 35e38a10f0e..eb300cfdd4e 100644 --- a/htdocs/societe/canvas/company/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_edit.tpl.php @@ -120,7 +120,7 @@ if ($this->control->tpl['fournisseur']) { } } -if (!empty($conf->barcode->enabled)) { ?> +if (isModEnabled('barcode')) { ?> trans('Gencod'); ?> diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index e57421bf8b5..0c6f2caf1e1 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -79,7 +79,7 @@ print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company -barcode->enabled)) { ?> + trans('Gencod'); ?> control->tpl['barcode']; ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index 0010b87ff90..1c8b51dac7c 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -113,7 +113,7 @@ if (empty($conf) || !is_object($conf)) { barcode->enabled)) { ?> +if (isModEnabled('barcode')) { ?> trans('Gencod'); ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php index 7a43f256b45..56192bbe4e7 100644 --- a/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_edit.tpl.php @@ -117,7 +117,7 @@ if ($this->control->tpl['fournisseur']) { } ?> -barcode->enabled)) { ?> + trans('Gencod'); ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index 16cd9f1e637..bfbf6271711 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -74,7 +74,7 @@ if ($this->control->tpl['action_delete']) { -barcode->enabled)) { ?> + trans('Gencod'); ?> control->tpl['barcode']; ?> diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d5f8a685155..4ca09e031d6 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1510,7 +1510,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''; // Barcode - if (!empty($conf->barcode->enabled)) { + if (isModEnabled('barcode')) { print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print ''; print img_picto('', 'barcode', 'class="pictofixedwidth"'); @@ -2207,7 +2207,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Barcode - if (!empty($conf->barcode->enabled)) { + if (isModEnabled('barcode')) { print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; print ''; print img_picto('', 'barcode'); @@ -2687,7 +2687,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { } // Barcode - if (!empty($conf->barcode->enabled)) { + if (isModEnabled('barcode')) { print ''; print $langs->trans('Gencod').''.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode)); print ''; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 07591d7db9d..aad8d3edc3e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -187,7 +187,7 @@ if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') { $fieldstosearchall['s.idprof6'] = 'ProfId6'; } -if (!empty($conf->barcode->enabled)) { +if (isModEnabled('barcode')) { $fieldstosearchall['s.barcode'] = 'Gencod'; } // Personalized search criterias. Example: $conf->global->THIRDPARTY_QUICKSEARCH_ON_FIELDS = 's.nom=ThirdPartyName;s.name_alias=AliasNameShort;s.code_client=CustomerCode' @@ -217,7 +217,7 @@ $arrayfields = array( 's.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)), 'enabled'=>(!empty($conf->global->MAIN_SHOW_TECHNICAL_ID))), 's.nom'=>array('label'=>"ThirdPartyName", 'position'=>2, 'checked'=>1), 's.name_alias'=>array('label'=>"AliasNameShort", 'position'=>3, 'checked'=>1), - 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(!empty($conf->barcode->enabled))), + 's.barcode'=>array('label'=>"Gencod", 'position'=>5, 'checked'=>1, 'enabled'=>(isModEnabled('barcode'))), 's.code_client'=>array('label'=>"CustomerCodeShort", 'position'=>10, 'checked'=>$checkedcustomercode), 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))), 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode), @@ -638,7 +638,7 @@ if ($search_type == '0') { if ($search_status != '' && $search_status >= 0) { $sql .= natural_search("s.status", $search_status, 2); } -if (!empty($conf->barcode->enabled) && $search_barcode) { +if (isModEnabled('barcode') && $search_barcode) { $sql .= natural_search("s.barcode", $search_barcode); } if ($search_price_level && $search_price_level != '-1') { diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 849c5c56481..a21bf3de219 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -82,7 +82,7 @@ if ($action == 'set') { $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_AFFILIATE", GETPOST('TAKEPOS_SUMUP_AFFILIATE', 'alpha'), 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "TAKEPOS_SUMUP_APPID", GETPOST('TAKEPOS_SUMUP_APPID', 'alpha'), 'chaine', 0, '', $conf->entity); } - if (!empty($conf->barcode->enabled)) { + if (isModEnabled('barcode')) { $res = dolibarr_set_const($db, 'TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', GETPOST('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT', 'alpha'), 'chaine', 0, '', $conf->entity); } @@ -388,7 +388,7 @@ print ajax_constantonoff("TAKEPOS_SHOW_HT", array(), $conf->entity, 0, 0, 1, 0); print "\n"; // Barcode rule to insert product -if (!empty($conf->barcode->enabled)) { +if (isModEnabled('barcode')) { print ''; print $form->textwithpicto($langs->trans("TakeposBarcodeRuleToInsertProduct"), $langs->trans("TakeposBarcodeRuleToInsertProductDesc")); print ''; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 9f7483319b3..6f84fccb9c8 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -123,7 +123,7 @@ if ($action == 'getProducts') { } $barcode_rules = getDolGlobalString('TAKEPOS_BARCODE_RULE_TO_INSERT_PRODUCT'); - if (!empty($conf->barcode->enabled) && !empty($barcode_rules)) { + if (isModEnabled('barcode') && !empty($barcode_rules)) { $barcode_rules_list = array(); // get barcode rules