41function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
43 global $db, $conf, $langs;
45 $idprod = $line->fk_product;
46 $label = (!empty($line->label) ? $line->label : (!empty($line->libelle) ? $line->libelle :
''));
47 $desc = (!empty($line->desc) ? $line->desc : (!empty($line->description) ? $line->description :
''));
48 $ref_supplier = (!empty($line->ref_supplier) ? $line->ref_supplier : (!empty($line->ref_fourn) ? $line->ref_fourn :
''));
49 $note = (!empty($line->note) ? $line->note :
'');
51 if ($issupplierline) {
58 $prodser->fetch($idprod);
60 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
61 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"label"]) && $label == $prodser->label) {
62 $label = $prodser->multilangs[$outputlangs->defaultlang][
"label"];
64 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"description"]) && $desc == $prodser->description) {
65 $desc = $prodser->multilangs[$outputlangs->defaultlang][
"description"];
67 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"note"]) && $note == $prodser->note) {
68 $note = $prodser->multilangs[$outputlangs->defaultlang][
"note"];
74 $libelleproduitservice = $label;
77 if ($desc && ($desc != $label)) {
78 if ($desc ==
'(CREDIT_NOTE)' && $line->fk_remise_except) {
80 $discount->fetch($line->fk_remise_except);
81 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
82 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromCreditNote", $sourceref);
83 } elseif ($desc ==
'(DEPOSIT)' && $line->fk_remise_except) {
85 $discount->fetch($line->fk_remise_except);
86 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
87 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromDeposit", $sourceref);
90 $libelleproduitservice .=
' ('.dol_print_date($discount->datec,
'day',
'', $outputlangs).
')';
92 } elseif ($desc ==
'(EXCESS RECEIVED)' && $line->fk_remise_except) {
94 $discount->fetch($line->fk_remise_except);
95 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessReceived", $discount->ref_facture_source);
96 } elseif ($desc ==
'(EXCESS PAID)' && $line->fk_remise_except) {
98 $discount->fetch($line->fk_remise_except);
99 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessPaid", $discount->ref_invoice_supplier_source);
102 if (empty($hidedesc)) {
103 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
106 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
115 $prefix_prodserv =
"";
118 if ($prodser->isService()) {
119 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Service").
" ";
121 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Product").
" ";
125 if (empty($hideref)) {
126 if ($issupplierline) {
127 $ref_prodserv = $prodser->ref.
' ('.$outputlangs->trans(
"SupplierRef").
' '.$ref_supplier.
')';
129 $ref_prodserv = $prodser->ref;
133 $libelleproduitservice = $prefix_prodserv.$ref_prodserv.($libelleproduitservice ?
" - " :
"").$libelleproduitservice;
137 if (!empty($line->date_start) || !empty($line->date_end)) {
140 if ($line->date_start && $line->date_end) {
141 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFromTo',
dol_print_date($line->date_start, $format,
false, $outputlangs),
dol_print_date($line->date_end, $format,
false, $outputlangs)).
')';
143 if ($line->date_start && !$line->date_end) {
144 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFrom',
dol_print_date($line->date_start, $format,
false, $outputlangs)).
')';
146 if (!$line->date_start && $line->date_end) {
147 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateUntil',
dol_print_date($line->date_end, $format,
false, $outputlangs)).
')';
150 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $period);
154 return $libelleproduitservice;