diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index 08124d3a22a..35cfdfbd4f3 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -3041,7 +3041,6 @@ class Form
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
{
// phpcs:enable
- global $db;
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
@@ -3072,7 +3071,7 @@ class Form
if (!empty($limit)) {
$sql .= ' LIMIT ' . (int) $limit;
}
- $resql = $db->query($sql);
+ $resql = $this->db->query($sql);
if ($resql) {
if ($showempty) {
$out .= '