diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 0bd4bb3d0d7..4599d89a471 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -959,7 +959,7 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc); + $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add dimensions into product description /*if (empty($conf->global->MAIN_PRODUCT_DISABLE_AUTOADD_DIM)) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 978bc5aa04a..c3a61df5070 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -866,7 +866,7 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc); + $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index cafd59569bb..0575ca92aea 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -133,7 +133,6 @@ if ($user->societe_id) $socid = $user->societe_id; $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); - /* * Actions */ @@ -1916,7 +1915,7 @@ if (empty($reshook)) $desc = $prod->description; } - $desc = dol_concatdesc($desc, $product_desc); + $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); // Add custom code and origin country into description if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) { diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index d53413efee0..d4b03faaf28 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -540,7 +540,7 @@ if (empty($reshook)) } $desc=$prod->description; - $desc=dol_concatdesc($desc,$product_desc); + $desc=dol_concatdesc($desc,$product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); $fk_unit = $prod->fk_unit; } else diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 947b3800d60..9c0c6c4457d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5729,22 +5729,31 @@ function dol_textishtml($msg,$option=0) * text1 txt + text2 html => dol_nl2br(text1) + '
' + text2 * text1 txt + text2 txt => text1 + '\n' + text2 * - * @param string $text1 Text 1 - * @param string $text2 Text 2 - * @param bool $forxml false=Use
, true=Use
- * @return string Text 1 + new line + Text2 + * @param string $text1 Text 1 + * @param string $text2 Text 2 + * @param bool $forxml false=Use
, true=Use
+ * @param bool $invert invert order of description lines if CONF CHANGE_ORDER_CONCAT_DESCRIPTION is active + * @return string Text 1 + new line + Text2 * @see dol_textishtml */ -function dol_concatdesc($text1,$text2,$forxml=false) +function dol_concatdesc($text1,$text2,$forxml=false, $invert=false) { - $ret=''; - $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; - $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; - $ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2; - return $ret; + if (!empty($invert)) + { + $tmp = $text1; + $text1 = $text2; + $text2 = $tmp; + } + + $ret=''; + $ret.= (! dol_textishtml($text1) && dol_textishtml($text2))?dol_nl2br($text1, 0, $forxml):$text1; + $ret.= (! empty($text1) && ! empty($text2)) ? ((dol_textishtml($text1) || dol_textishtml($text2))?($forxml?"
\n":"
\n") : "\n") : ""; + $ret.= (dol_textishtml($text1) && ! dol_textishtml($text2))?dol_nl2br($text2, 0, $forxml):$text2; + return $ret; } + /** * Return array of possible common substitutions. This includes several families like: 'system', 'mycompany', 'object', 'objectamount', 'date', 'user' * diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 8098946b186..eb82fbed8f3 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -404,7 +404,7 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; $price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT'); diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index b6ff1d36551..a5a4bf594f8 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -1222,7 +1222,7 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); $type = $productsupplier->type; $price_base_type = ($productsupplier->fourn_price_base_type?$productsupplier->fourn_price_base_type:'HT'); diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 99e99517f75..2afce7bb78c 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -630,7 +630,7 @@ if (empty($reshook)) $desc = $productsupplier->desc_supplier; } else $desc = $productsupplier->description; - if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc); + if (trim($product_desc) != trim($desc)) $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->CHANGE_ORDER_CONCAT_DESCRIPTION)); $pu_ht = $productsupplier->fourn_pu;