Fix: add pdf_writeLinkedObjects method
This commit is contained in:
parent
9301def08d
commit
30c7bf811b
@ -661,6 +661,39 @@ function pdf_pagefoot(&$pdf,$outputlangs,$paramfreetext,$fromcompany,$marge_bass
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show linked objects for PDF generation
|
||||
*
|
||||
* @param PDF &$pdf Object PDF
|
||||
* @param object $object Object
|
||||
* @param Translate $outputlangs Object lang
|
||||
* @param int $curx X
|
||||
* @param int $cury Y
|
||||
* @return void
|
||||
*/
|
||||
function pdf_writeLinkedObjects(&$pdf,$object,$outputlangs,$posx,$posy,$align,$default_font_size,$hookmanager=false)
|
||||
{
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', $align);
|
||||
|
||||
if (! empty($linkedobject["date_title"]) && ! empty($linkedobject["date_value"]))
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', $align);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $pdf->getY();
|
||||
}
|
||||
|
||||
/**
|
||||
* Output line description into PDF
|
||||
@ -1606,7 +1639,7 @@ function pdf_getCurrencySymbol(&$pdf, $currency_code)
|
||||
}
|
||||
|
||||
/**
|
||||
* Show linked objects for PDF generation
|
||||
* Return linked objects
|
||||
*
|
||||
* @param object $object Object
|
||||
* @param Translate $outputlangs Object lang for output
|
||||
@ -1618,7 +1651,7 @@ function pdf_getLinkedObjects($object,$outputlangs,$hookmanager=false)
|
||||
$linkedobjects=array();
|
||||
|
||||
$object->fetchObjectLinked();
|
||||
|
||||
|
||||
foreach($object->linkedObjects as $objecttype => $objects)
|
||||
{
|
||||
if ($objecttype == 'propal')
|
||||
|
||||
@ -649,23 +649,10 @@ class pdf_edison extends ModelePDFCommandes
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Order")." ".$outputlangs->convToOutputCharset($object->ref), 0, 'L');
|
||||
|
||||
|
||||
$posy+=1;
|
||||
$posy+=1;
|
||||
|
||||
// Add list of linked objects
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY(11,$posy);
|
||||
$pdf->SetFont('','', $default_font_size + 1);
|
||||
$pdf->MultiCell(100, 4, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', 'L');
|
||||
$posy+=4;
|
||||
$pdf->SetXY(11,$posy);
|
||||
$pdf->MultiCell(100, 4, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', 'L');
|
||||
}
|
||||
}
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'L', $default_font_size, $hookmanager);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -929,21 +929,8 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Add list of linked objects
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', 'R');
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', 'R');
|
||||
}
|
||||
}
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
|
||||
@ -1125,21 +1125,8 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Add list of linked objects
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', 'R');
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', 'R');
|
||||
}
|
||||
}
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
|
||||
@ -1002,21 +1002,8 @@ class pdf_oursin extends ModelePDFFactures
|
||||
|
||||
$posy+=1;
|
||||
|
||||
// Add list of linked objects
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($this->marges['g'],$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->MultiCell(60, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', 'L');
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell(60, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', 'L');
|
||||
}
|
||||
}
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'L', $default_font_size, $hookmanager);
|
||||
|
||||
// Amount in (at tab_top - 1)
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
@ -970,21 +970,8 @@ class pdf_azur extends ModelePDFPropales
|
||||
|
||||
$posy+=2;
|
||||
|
||||
// Add list of linked objects
|
||||
$linkedobjects = pdf_getLinkedObjects($object,$outputlangs,$hookmanager);
|
||||
if (! empty($linkedobjects))
|
||||
{
|
||||
foreach($linkedobjects as $linkedobject)
|
||||
{
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["ref_title"].' : '.$linkedobject["ref_value"], '', 'R');
|
||||
$posy+=3;
|
||||
$pdf->SetXY($posx,$posy);
|
||||
$pdf->MultiCell(100, 3, $linkedobject["date_title"].' : '.$linkedobject["date_value"], '', 'R');
|
||||
}
|
||||
}
|
||||
// Show list of linked objects
|
||||
$posy = pdf_writeLinkedObjects($pdf, $object, $outputlangs, $posx, $posy, 'R', $default_font_size, $hookmanager);
|
||||
|
||||
if ($showaddress)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user