From de5b97c7e7140a3b8475cebbfa6a08c1c4408a1b Mon Sep 17 00:00:00 2001 From: tgsw Date: Thu, 12 Oct 2023 15:39:42 +0200 Subject: [PATCH] Show product description (#26193) * Show product description shows product-description on list of products when hover the product-ref * Update product.class.php limiting the display to 5 lines --- htdocs/product/class/product.class.php | 3 +++ htdocs/product/list.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ce0ac4277fb..6c75e7d0fb2 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -5072,6 +5072,9 @@ class Product extends CommonObject if (!empty($this->label)) { $datas['label']= '
'.$langs->trans('ProductLabel').': '.$this->label; } + if (!empty($this->description)) { + $datas['description']= '
'.$langs->trans('ProductDescription').': '.dolGetFirstLineofText($this->description, 5); + } if ($this->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { if (isModEnabled('productbatch')) { $langs->load("productbatch"); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 187474aec47..f3aae1a04cb 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -432,7 +432,7 @@ if ($search_type != '' && $search_type != '-1') { // Build and execute select // -------------------------------------------------------------------- -$sql = 'SELECT p.rowid, p.ref, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,'; +$sql = 'SELECT p.rowid, p.ref, p.description, p.label, p.fk_product_type, p.barcode, p.price, p.tva_tx, p.price_ttc, p.price_base_type, p.entity,'; $sql .= ' p.fk_product_type, p.duration, p.finished, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,'; $sql .= ' p.tobatch, '; if (isModEnabled('workstation')) { @@ -1495,6 +1495,7 @@ while ($i < $imaxinloop) { if (empty($reshook)) { $product_static->id = $obj->rowid; $product_static->ref = $obj->ref; + $product_static->description = $obj->description; $product_static->ref_fourn = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; // deprecated $product_static->ref_supplier = empty($obj->ref_supplier) ? '' : $obj->ref_supplier; $product_static->label = $obj->label;