Can use multilanguage label and desc for product
This commit is contained in:
parent
5233e4894e
commit
57fc0db956
@ -217,26 +217,26 @@ class pdf_oursin extends ModelePDFFactures
|
||||
if ($this->franchise!=1)
|
||||
{
|
||||
$pdf->SetXY ($this->marges['g']+119, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->tva_tx, 0, 'C');
|
||||
$pdf->MultiCell(10, 3, $fac->lignes[$i]->tva_tx, 0, 'C');
|
||||
}
|
||||
// Prix unitaire HT avant remise
|
||||
$pdf->SetXY ($this->marges['g']+132, $curY);
|
||||
$pdf->MultiCell(16, 5, price($fac->lignes[$i]->subprice), 0, 'R', 0);
|
||||
$pdf->MultiCell(16, 3, price($fac->lignes[$i]->subprice), 0, 'R', 0);
|
||||
|
||||
// Quantit
|
||||
$pdf->SetXY ($this->marges['g']+150, $curY);
|
||||
$pdf->MultiCell(10, 5, $fac->lignes[$i]->qty, 0, 'R');
|
||||
$pdf->MultiCell(10, 3, $fac->lignes[$i]->qty, 0, 'R');
|
||||
|
||||
// Remise sur ligne
|
||||
$pdf->SetXY ($this->marges['g']+160, $curY);
|
||||
if ($fac->lignes[$i]->remise_percent) {
|
||||
$pdf->MultiCell(14, 5, $fac->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
$pdf->MultiCell(14, 3, $fac->lignes[$i]->remise_percent."%", 0, 'R');
|
||||
}
|
||||
|
||||
// Total HT
|
||||
$pdf->SetXY ($this->marges['g']+168, $curY);
|
||||
$total = price($fac->lignes[$i]->total_ht);
|
||||
$pdf->MultiCell(21, 5, $total, 0, 'R', 0);
|
||||
$pdf->MultiCell(21, 3, $total, 0, 'R', 0);
|
||||
|
||||
|
||||
if ($nexY > 200 && $i < $nblignes - 1)
|
||||
|
||||
@ -197,19 +197,40 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
*/
|
||||
function pdf_getlinedesc($line,$outputlangs)
|
||||
{
|
||||
global $db;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
if (empty($line->libelle)) $line->libelle=$line->label;
|
||||
if (empty($line->desc)) $line->desc=$line->description;
|
||||
if (empty($line->produit_id)) $line->produit_id=$line->fk_product;
|
||||
$label=$line->label;
|
||||
$desc=$line->desc;
|
||||
$note=$line->note;
|
||||
$idprod=$line->fk_product;
|
||||
|
||||
// Description of product line
|
||||
$libelleproduitservice=$line->libelle;
|
||||
if ($line->desc && $line->desc != $line->libelle)
|
||||
if (empty($label)) $label=$line->libelle;
|
||||
if (empty($desc)) $desc=$line->description;
|
||||
if (empty($idprod)) $idprod=$line->produit_id;
|
||||
|
||||
$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) $libelleproduitservice.="<br>";
|
||||
|
||||
if ($line->desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
|
||||
if ($desc == '(CREDIT_NOTE)' && $line->fk_remise_except)
|
||||
{
|
||||
$discount=new DiscountAbsolute($this->db);
|
||||
$discount->fetch($line->fk_remise_except);
|
||||
@ -217,22 +238,20 @@ function pdf_getlinedesc($line,$outputlangs)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($line->produit_id)
|
||||
if ($idprod)
|
||||
{
|
||||
$libelleproduitservice.=$line->desc;
|
||||
$libelleproduitservice.=$desc;
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=$line->desc;
|
||||
$libelleproduitservice.=$desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Si ligne associee a un code produit
|
||||
if ($line->produit_id)
|
||||
if ($idprod)
|
||||
{
|
||||
$prodser = new Product($db);
|
||||
$prodser->fetch($line->produit_id);
|
||||
// On ajoute la ref
|
||||
if ($prodser->ref)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user