Fix: Now have one function to show and one to return.
This commit is contained in:
parent
a718947b3d
commit
43f5f95439
@ -198,11 +198,10 @@ class pdf_edison extends ModelePDFCommandes
|
|||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
// Description de la ligne produit
|
// Description de la ligne produit
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
|
||||||
//$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
$ref = pdf_getlineref($object, $i, $outputlangs);
|
$ref = pdf_getlineref($object, $i, $outputlangs);
|
||||||
|
|||||||
@ -247,7 +247,7 @@ class pdf_einstein extends ModelePDFCommandes
|
|||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
$curX = $this->posxdesc-1;
|
$curX = $this->posxdesc-1;
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|||||||
@ -205,8 +205,6 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||||
{
|
{
|
||||||
// Description de la ligne produit
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($pdf,$object->$origin,$i,$outputlangs);
|
|
||||||
//if ($i==1) { print $object->commande->lignes[$i]->libelle.' - '.$libelleproduitservice; exit; }
|
|
||||||
|
|
||||||
//Creation des cases a cocher
|
//Creation des cases a cocher
|
||||||
$pdf->rect(10+3, $curY+1, 3, 3);
|
$pdf->rect(10+3, $curY+1, 3, 3);
|
||||||
@ -218,7 +216,8 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
|||||||
//Insertion du libelle
|
//Insertion du libelle
|
||||||
$pdf->SetFont('','', 7);
|
$pdf->SetFont('','', 7);
|
||||||
$pdf->SetXY (50, $curY+1 );
|
$pdf->SetXY (50, $curY+1 );
|
||||||
$libelleproduitservice = pdf_getlinedesc($pdf,$object->$origin,$i,$outputlangs,90,3,50,$curY+1,1);
|
//$libelleproduitservice=pdf_getlinedesc($object->$origin,$i,$outputlangs);
|
||||||
|
$libelleproduitservice = pdf_writelinedesc($pdf,$object->$origin,$i,$outputlangs,90,3,50,$curY+1,1);
|
||||||
//$pdf->writeHTMLCell(90, 3, 50, $curY+1, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'L', 0);
|
//$pdf->writeHTMLCell(90, 3, 50, $curY+1, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 'L', 0);
|
||||||
//Insertion de la quantite commandee
|
//Insertion de la quantite commandee
|
||||||
$pdf->SetFont('','', 7);
|
$pdf->SetFont('','', 7);
|
||||||
|
|||||||
@ -340,8 +340,7 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
|||||||
|
|
||||||
// Description de la ligne produit
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,150,3,$this->posxdesc,$curY);
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,150,3,$this->posxdesc,$curY);
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(150, 3, $this->posxdesc, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|||||||
@ -250,12 +250,10 @@ class pdf_crabe extends ModelePDFFactures
|
|||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
$curX = $this->posxdesc-1;
|
$curX = $this->posxdesc-1;
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY);
|
||||||
|
|
||||||
//$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell($this->posxtva-$this->posxdesc-1, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
|
|||||||
@ -215,9 +215,7 @@ class pdf_oursin extends ModelePDFFactures
|
|||||||
|
|
||||||
// Description of product line
|
// Description of product line
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY+1);
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY+1);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|||||||
@ -184,13 +184,11 @@ class pdf_sirocco extends ModelePDFDeliveryOrder
|
|||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
|
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,100,3,30,$curY,1);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(100, 3, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|||||||
@ -241,13 +241,11 @@ class pdf_typhon extends ModelePDFDeliveryOrder
|
|||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY);
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
|
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|||||||
@ -248,7 +248,7 @@ class pdf_propale_azur extends ModelePDFPropales
|
|||||||
|
|
||||||
// Description de la ligne produit
|
// Description de la ligne produit
|
||||||
$curX = $this->posxdesc-1;
|
$curX = $this->posxdesc-1;
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,4,$curX,$curY);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|||||||
@ -185,12 +185,11 @@ class pdf_propale_jaune extends ModelePDFPropales
|
|||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,1);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,1);
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,102,4,30,$curY,1);
|
||||||
|
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,102,4,30,$curY,1);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(102, 4, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(102, 4, 30, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|||||||
@ -221,17 +221,14 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
|
|||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,0,0,1);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,0,0,1);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY,0,0,1);
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
|
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY,0,0,1);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
// TVA
|
// TVA
|
||||||
|
|||||||
@ -232,17 +232,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
|||||||
{
|
{
|
||||||
$curY = $nexY;
|
$curY = $nexY;
|
||||||
|
|
||||||
// Description de la ligne produit
|
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
||||||
|
|
||||||
|
// Description de la ligne produit
|
||||||
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,0,0,1);
|
//$libelleproduitservice=pdf_getlinedesc($object,$i,$outputlangs,0,0,1);
|
||||||
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY,0,0,1);
|
||||||
$pdf->SetFont('','', 9); // Dans boucle pour gerer multi-page
|
|
||||||
|
|
||||||
pdf_getlinedesc($pdf,$object,$i,$outputlangs,108,3,$this->posxdesc-1,$curY,0,0,1);
|
|
||||||
|
|
||||||
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
//$pdf->writeHTMLCell(108, 3, $this->posxdesc-1, $curY, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
$pdf->SetFont('','', 9); // On repositionne la police par defaut
|
||||||
|
|
||||||
$nexY = $pdf->GetY();
|
$nexY = $pdf->GetY();
|
||||||
|
|
||||||
// TVA
|
// TVA
|
||||||
|
|||||||
@ -445,134 +445,158 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return line description translated in outputlangs and encoded in UTF8
|
* Output line description into PDF
|
||||||
|
* @param pdf PDF object
|
||||||
* @param object Object
|
* @param object Object
|
||||||
* @param $i Current line number
|
* @param i Current line number
|
||||||
* @param outputlang Object lang for output
|
* @param outputlang Object lang for output
|
||||||
|
* @param w
|
||||||
|
* @param h
|
||||||
|
* @param posx
|
||||||
|
* @param posy
|
||||||
* @param hideref Hide reference
|
* @param hideref Hide reference
|
||||||
* @param hidedesc Hide description
|
* @param hidedesc Hide description
|
||||||
* @param issupplierline Is it a line for a supplier object ?
|
* @param issupplierline Is it a line for a supplier object ?
|
||||||
*/
|
*/
|
||||||
function pdf_getlinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
|
function pdf_writelinedesc(&$pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy,$hideref=0,$hidedesc=0,$issupplierline=0)
|
||||||
{
|
{
|
||||||
global $db, $conf, $langs;
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
||||||
{
|
{
|
||||||
$object->hooks[$object->lines[$i]->special_code]->pdf_getlinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy);
|
return $object->hooks[$object->lines[$i]->special_code]->pdf_writelinedesc($pdf,$object,$i,$outputlangs,$w,$h,$posx,$posy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$idprod=$object->lines[$i]->fk_product;
|
$libellproduitservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
|
||||||
$label=$object->lines[$i]->label; if (empty($label)) $label=$object->lines[$i]->libelle;
|
|
||||||
$desc=$object->lines[$i]->desc; if (empty($desc)) $desc=$object->lines[$i]->description;
|
|
||||||
$ref_supplier=$object->lines[$i]->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$object->lines[$i]->ref_fourn; // TODO Not yeld saved for supplier invoices, only supplier orders
|
|
||||||
$note=$object->lines[$i]->note;
|
|
||||||
|
|
||||||
if ($issupplierline) $prodser = new ProductFournisseur($db);
|
|
||||||
else $prodser = new Product($db);
|
|
||||||
|
|
||||||
if ($idprod)
|
|
||||||
{
|
|
||||||
$prodser->fetch($idprod);
|
|
||||||
// If a predefined product and multilang and on other lang, we renamed label with label translated
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang))
|
|
||||||
{
|
|
||||||
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"])) $label=$prodser->multilangs[$outputlangs->defaultlang]["libelle"];
|
|
||||||
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"])) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"];
|
|
||||||
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"])) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description short of product line
|
|
||||||
$libelleproduitservice=$label;
|
|
||||||
|
|
||||||
// Description long of product line
|
|
||||||
if ($desc && ($desc != $label))
|
|
||||||
{
|
|
||||||
if ($libelleproduitservice && !$hidedesc) $libelleproduitservice.="\n";
|
|
||||||
|
|
||||||
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except)
|
|
||||||
{
|
|
||||||
$discount=new DiscountAbsolute($db);
|
|
||||||
$discount->fetch($object->lines[$i]->fk_remise_except);
|
|
||||||
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$discount->ref_facture_source);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($idprod)
|
|
||||||
{
|
|
||||||
if (!$hidedesc) $libelleproduitservice.=$desc;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$libelleproduitservice.=$desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If line linked to a product
|
|
||||||
if ($idprod)
|
|
||||||
{
|
|
||||||
// On ajoute la ref
|
|
||||||
if ($prodser->ref)
|
|
||||||
{
|
|
||||||
$prefix_prodserv = "";
|
|
||||||
$ref_prodserv = "";
|
|
||||||
if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this
|
|
||||||
{
|
|
||||||
if($prodser->isservice())
|
|
||||||
{
|
|
||||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$hideref)
|
|
||||||
{
|
|
||||||
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
|
||||||
else $ref_prodserv = $prodser->ref; // Show local ref only
|
|
||||||
|
|
||||||
$ref_prodserv .= " - ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice,1);
|
|
||||||
|
|
||||||
if ($object->lines[$i]->date_start || $object->lines[$i]->date_end)
|
|
||||||
{
|
|
||||||
// Show duration if exists
|
|
||||||
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
|
||||||
{
|
|
||||||
$period='('.$outputlangs->transnoentitiesnoconv('DateFromTo',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs),dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
|
|
||||||
}
|
|
||||||
if ($object->lines[$i]->date_start && ! $object->lines[$i]->date_end)
|
|
||||||
{
|
|
||||||
$period='('.$outputlangs->transnoentitiesnoconv('DateFrom',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs)).')';
|
|
||||||
}
|
|
||||||
if (! $object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
|
||||||
{
|
|
||||||
$period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
|
|
||||||
}
|
|
||||||
//print '>'.$outputlangs->charset_output.','.$period;
|
|
||||||
$libelleproduitservice.="<br>".dol_htmlentitiesbr($period,1);
|
|
||||||
//print $libelleproduitservice;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Description
|
// Description
|
||||||
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($libelleproduitservice), 0, 1);
|
||||||
|
|
||||||
// For compatibility
|
return $libellproduitservice;
|
||||||
return $libelleproduitservice;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return line description translated in outputlangs and encoded in UTF8
|
||||||
|
* @param object Object
|
||||||
|
* @param i Current line number
|
||||||
|
* @param outputlang Object lang for output
|
||||||
|
* @param hideref Hide reference
|
||||||
|
* @param hidedesc Hide description
|
||||||
|
* @param issupplierline Is it a line for a supplier object ?
|
||||||
|
* @return string String with line
|
||||||
|
*/
|
||||||
|
function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issupplierline=0)
|
||||||
|
{
|
||||||
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
|
$idprod=$object->lines[$i]->fk_product;
|
||||||
|
$label=$object->lines[$i]->label; if (empty($label)) $label=$object->lines[$i]->libelle;
|
||||||
|
$desc=$object->lines[$i]->desc; if (empty($desc)) $desc=$object->lines[$i]->description;
|
||||||
|
$ref_supplier=$object->lines[$i]->ref_supplier; if (empty($ref_supplier)) $ref_supplier=$object->lines[$i]->ref_fourn; // TODO Not yeld saved for supplier invoices, only supplier orders
|
||||||
|
$note=$object->lines[$i]->note;
|
||||||
|
|
||||||
|
if ($issupplierline) $prodser = new ProductFournisseur($db);
|
||||||
|
else $prodser = new Product($db);
|
||||||
|
|
||||||
|
if ($idprod)
|
||||||
|
{
|
||||||
|
$prodser->fetch($idprod);
|
||||||
|
// If a predefined product and multilang and on other lang, we renamed label with label translated
|
||||||
|
if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang))
|
||||||
|
{
|
||||||
|
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"])) $label=$prodser->multilangs[$outputlangs->defaultlang]["libelle"];
|
||||||
|
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"])) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"];
|
||||||
|
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"])) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Description short of product line
|
||||||
|
$libelleproduitservice=$label;
|
||||||
|
|
||||||
|
// Description long of product line
|
||||||
|
if ($desc && ($desc != $label))
|
||||||
|
{
|
||||||
|
if ($libelleproduitservice && !$hidedesc) $libelleproduitservice.="\n";
|
||||||
|
|
||||||
|
if ($desc == '(CREDIT_NOTE)' && $object->lines[$i]->fk_remise_except)
|
||||||
|
{
|
||||||
|
$discount=new DiscountAbsolute($db);
|
||||||
|
$discount->fetch($object->lines[$i]->fk_remise_except);
|
||||||
|
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromCreditNote",$discount->ref_facture_source);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($idprod)
|
||||||
|
{
|
||||||
|
if (!$hidedesc) $libelleproduitservice.=$desc;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$libelleproduitservice.=$desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If line linked to a product
|
||||||
|
if ($idprod)
|
||||||
|
{
|
||||||
|
// On ajoute la ref
|
||||||
|
if ($prodser->ref)
|
||||||
|
{
|
||||||
|
$prefix_prodserv = "";
|
||||||
|
$ref_prodserv = "";
|
||||||
|
if ($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS) // In standard mode, we do not show this
|
||||||
|
{
|
||||||
|
if($prodser->isservice())
|
||||||
|
{
|
||||||
|
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hideref)
|
||||||
|
{
|
||||||
|
if ($issupplierline) $ref_prodserv = $prodser->ref.' ('.$outputlangs->trans("SupplierRef").' '.$ref_supplier.')'; // Show local ref and supplier ref
|
||||||
|
else $ref_prodserv = $prodser->ref; // Show local ref only
|
||||||
|
|
||||||
|
$ref_prodserv .= " - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
$libelleproduitservice=$prefix_prodserv.$ref_prodserv.$libelleproduitservice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$libelleproduitservice=dol_htmlentitiesbr($libelleproduitservice,1);
|
||||||
|
|
||||||
|
if ($object->lines[$i]->date_start || $object->lines[$i]->date_end)
|
||||||
|
{
|
||||||
|
// Show duration if exists
|
||||||
|
if ($object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
||||||
|
{
|
||||||
|
$period='('.$outputlangs->transnoentitiesnoconv('DateFromTo',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs),dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
|
||||||
|
}
|
||||||
|
if ($object->lines[$i]->date_start && ! $object->lines[$i]->date_end)
|
||||||
|
{
|
||||||
|
$period='('.$outputlangs->transnoentitiesnoconv('DateFrom',dol_print_date($object->lines[$i]->date_start, $format, false, $outputlangs)).')';
|
||||||
|
}
|
||||||
|
if (! $object->lines[$i]->date_start && $object->lines[$i]->date_end)
|
||||||
|
{
|
||||||
|
$period='('.$outputlangs->transnoentitiesnoconv('DateUntil',dol_print_date($object->lines[$i]->date_end, $format, false, $outputlangs)).')';
|
||||||
|
}
|
||||||
|
//print '>'.$outputlangs->charset_output.','.$period;
|
||||||
|
$libelleproduitservice.="<br>".dol_htmlentitiesbr($period,1);
|
||||||
|
//print $libelleproduitservice;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $libelleproduitservice;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return line ref
|
* Return line ref
|
||||||
* @param object Object
|
* @param object Object
|
||||||
@ -656,6 +680,7 @@ function pdf_getlineqty($object,$i,$outputlangs)
|
|||||||
*/
|
*/
|
||||||
function pdf_getlineremisepercent($object,$i,$outputlangs)
|
function pdf_getlineremisepercent($object,$i,$outputlangs)
|
||||||
{
|
{
|
||||||
|
include_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php");
|
||||||
if ($object->lines[$i]->special_code != 3)
|
if ($object->lines[$i]->special_code != 3)
|
||||||
{
|
{
|
||||||
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
if (!empty($object->hooks) && $object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user