42function doc_getlinedesc($line, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
44 global $db,
$conf, $langs;
46 $idprod = $line->fk_product;
47 $label = (!empty($line->label) ? $line->label : (!empty($line->libelle) ? $line->libelle :
''));
48 $desc = (!empty($line->desc) ? $line->desc : (!empty($line->description) ? $line->description :
''));
49 $ref_supplier = (!empty($line->ref_supplier) ? $line->ref_supplier : (!empty($line->ref_fourn) ? $line->ref_fourn :
''));
50 $note = (!empty($line->note) ? $line->note :
'');
52 if ($issupplierline) {
59 $prodser->fetch($idprod);
61 if (
getDolGlobalInt(
'MAIN_MULTILANGS') && ($outputlangs->defaultlang != $langs->defaultlang)) {
62 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"label"]) && $label == $prodser->label) {
63 $label = $prodser->multilangs[$outputlangs->defaultlang][
"label"];
65 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"description"]) && $desc == $prodser->description) {
66 $desc = $prodser->multilangs[$outputlangs->defaultlang][
"description"];
68 if (!empty($prodser->multilangs[$outputlangs->defaultlang][
"note"]) && $note == $prodser->note) {
69 $note = $prodser->multilangs[$outputlangs->defaultlang][
"note"];
75 $libelleproduitservice = $label;
78 if ($desc && ($desc != $label)) {
79 if ($desc ==
'(CREDIT_NOTE)' && $line->fk_remise_except) {
81 $discount->fetch($line->fk_remise_except);
82 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
83 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromCreditNote", $sourceref);
84 } elseif ($desc ==
'(DEPOSIT)' && $line->fk_remise_except) {
86 $discount->fetch($line->fk_remise_except);
87 $sourceref = !empty($discount->discount_type) ? $discount->ref_invoice_supplier_source : $discount->ref_facture_source;
88 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromDeposit", $sourceref);
91 $libelleproduitservice .=
' ('.dol_print_date($discount->datec,
'day',
'', $outputlangs).
')';
93 } elseif ($desc ==
'(EXCESS RECEIVED)' && $line->fk_remise_except) {
95 $discount->fetch($line->fk_remise_except);
96 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessReceived", $discount->ref_facture_source);
97 } elseif ($desc ==
'(EXCESS PAID)' && $line->fk_remise_except) {
99 $discount->fetch($line->fk_remise_except);
100 $libelleproduitservice = $outputlangs->transnoentitiesnoconv(
"DiscountFromExcessPaid", $discount->ref_invoice_supplier_source);
103 if (empty($hidedesc)) {
104 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
107 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $desc);
116 $prefix_prodserv =
"";
119 if ($prodser->isService()) {
120 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Service").
" ";
122 $prefix_prodserv = $outputlangs->transnoentitiesnoconv(
"Product").
" ";
126 if (empty($hideref)) {
127 if ($issupplierline) {
128 $ref_prodserv = $prodser->ref.
' ('.$outputlangs->trans(
"SupplierRef").
' '.$ref_supplier.
')';
130 $ref_prodserv = $prodser->ref;
134 $libelleproduitservice = $prefix_prodserv.$ref_prodserv.($libelleproduitservice ?
" - " :
"").$libelleproduitservice;
138 if (!empty($line->date_start) || !empty($line->date_end)) {
142 if ($line->date_start && $line->date_end) {
143 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFromTo',
dol_print_date($line->date_start, $format,
false, $outputlangs),
dol_print_date($line->date_end, $format,
false, $outputlangs)).
')';
145 if ($line->date_start && !$line->date_end) {
146 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateFrom',
dol_print_date($line->date_start, $format,
false, $outputlangs)).
')';
148 if (!$line->date_start && $line->date_end) {
149 $period =
'('.$outputlangs->transnoentitiesnoconv(
'DateUntil',
dol_print_date($line->date_end, $format,
false, $outputlangs)).
')';
152 $libelleproduitservice =
dol_concatdesc($libelleproduitservice, $period);
156 return $libelleproduitservice;