2
0
forked from Wavyzz/dolibarr

FIX PDF_NOLD_PRODUCT_LABEL

This commit is contained in:
fr69400
2021-11-28 14:40:15 +01:00
parent af1baf057b
commit 5a165ae2bf
4 changed files with 41 additions and 5 deletions

View File

@@ -1363,7 +1363,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
// Description short of product line
$libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) {
// This part of code is bugged. It introduces a HTML tag making the label a html string but without converting \n into br if it was a full text non html string before.
if (!dol_textishtml($libelleproduitservice)){
$libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice);
}
$libelleproduitservice = '<b>'.$libelleproduitservice.'</b>';
}
}
@@ -1375,7 +1377,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
$tmparrayofsubproducts = reset($prodser->sousprods);
foreach ($tmparrayofsubproducts as $subprodval) {
$libelleproduitservice .= "\n * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')';
$libelleproduitservice .= "__N__ * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')';
}
}
}
@@ -1419,7 +1421,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
if (empty($hidedesc)) {
if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) {
$libelleproduitservice = $desc."\n".$libelleproduitservice;
$libelleproduitservice = $desc."__N__".$libelleproduitservice;
} else {
if (!empty($conf->global->HIDE_LABEL_VARIANT_PDF) && $prodser->isVariant()) {
$libelleproduitservice = $desc;
@@ -1493,10 +1495,14 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
if (!empty($ref_prodserv) && !empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) {
if (!dol_textishtml($libelleproduitservice)){
$libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice);
}
$ref_prodserv = '<b>'.$ref_prodserv.'</b>';
}
// $prefix_prodserv and $ref_prodser are not HTML var
}
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
// Add an additional description for the category products
if (!empty($conf->global->CATEGORY_ADD_DESC_INTO_DOC) && $idprod && !empty($conf->categorie->enabled)) {
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
@@ -1527,6 +1533,9 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
//print '>'.$outputlangs->charset_output.','.$period;
if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) {
if (!dol_textishtml($libelleproduitservice)){
$libelleproduitservice = str_replace("\n", '__N__', $libelleproduitservice);
}
$libelleproduitservice .= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
} else {
$libelleproduitservice .= "__N__".$period;