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)
|
if ($this->franchise!=1)
|
||||||
{
|
{
|
||||||
$pdf->SetXY ($this->marges['g']+119, $curY);
|
$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
|
// Prix unitaire HT avant remise
|
||||||
$pdf->SetXY ($this->marges['g']+132, $curY);
|
$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
|
// Quantit
|
||||||
$pdf->SetXY ($this->marges['g']+150, $curY);
|
$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
|
// Remise sur ligne
|
||||||
$pdf->SetXY ($this->marges['g']+160, $curY);
|
$pdf->SetXY ($this->marges['g']+160, $curY);
|
||||||
if ($fac->lignes[$i]->remise_percent) {
|
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
|
// Total HT
|
||||||
$pdf->SetXY ($this->marges['g']+168, $curY);
|
$pdf->SetXY ($this->marges['g']+168, $curY);
|
||||||
$total = price($fac->lignes[$i]->total_ht);
|
$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)
|
if ($nexY > 200 && $i < $nblignes - 1)
|
||||||
|
|||||||
@ -197,19 +197,40 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
|||||||
*/
|
*/
|
||||||
function pdf_getlinedesc($line,$outputlangs)
|
function pdf_getlinedesc($line,$outputlangs)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db, $conf, $langs;
|
||||||
|
|
||||||
if (empty($line->libelle)) $line->libelle=$line->label;
|
$label=$line->label;
|
||||||
if (empty($line->desc)) $line->desc=$line->description;
|
$desc=$line->desc;
|
||||||
if (empty($line->produit_id)) $line->produit_id=$line->fk_product;
|
$note=$line->note;
|
||||||
|
$idprod=$line->fk_product;
|
||||||
|
|
||||||
// Description of product line
|
if (empty($label)) $label=$line->libelle;
|
||||||
$libelleproduitservice=$line->libelle;
|
if (empty($desc)) $desc=$line->description;
|
||||||
if ($line->desc && $line->desc != $line->libelle)
|
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 ($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=new DiscountAbsolute($this->db);
|
||||||
$discount->fetch($line->fk_remise_except);
|
$discount->fetch($line->fk_remise_except);
|
||||||
@ -217,22 +238,20 @@ function pdf_getlinedesc($line,$outputlangs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($line->produit_id)
|
if ($idprod)
|
||||||
{
|
{
|
||||||
$libelleproduitservice.=$line->desc;
|
$libelleproduitservice.=$desc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$libelleproduitservice.=$line->desc;
|
$libelleproduitservice.=$desc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si ligne associee a un code produit
|
// 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
|
// On ajoute la ref
|
||||||
if ($prodser->ref)
|
if ($prodser->ref)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user