Fix: origin and origin_id always in the fetch
This commit is contained in:
parent
d37cc84413
commit
c5c9432b01
@ -340,10 +340,9 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
function _pagehead(&$pdf, $object, $outputlangs)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$default_font_size = pdf_getPDFFontSize($outputlangs);
|
||||
|
||||
$origin = $object->origin;
|
||||
|
||||
pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
|
||||
|
||||
//Affiche le filigrane brouillon - Print Draft Watermark
|
||||
@ -399,32 +398,29 @@ Class pdf_expedition_merou extends ModelePdfExpedition
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefSending").': '.$outputlangs->convToOutputCharset($object->ref), '' , 'R');
|
||||
//$this->Code39($Xoff+43, $Yoff+1, $object->ref,$ext = true, $cks = false, $w = 0.4, $h = 4, $wide = true);
|
||||
|
||||
// Add list of linked orders
|
||||
$object->load_object_linked();
|
||||
// Add list of linked elements
|
||||
// TODO possibility to use with other elements (business module,...)
|
||||
//$object->load_object_linked();
|
||||
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
||||
if ($conf->commande->enabled)
|
||||
// TODO move to external function
|
||||
if ($conf->$origin->enabled)
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
foreach($object->linked_object as $key => $val)
|
||||
|
||||
$classname = ucfirst($origin);
|
||||
$linkedobject = new $classname($this->db);
|
||||
$result=$linkedobject->fetch($origin_id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($key == $origin)
|
||||
{
|
||||
for ($i = 0; $i<sizeof($val);$i++)
|
||||
{
|
||||
$classname = ucfirst($origin);
|
||||
$linkedobject = new $classname($this->db);
|
||||
$result=$linkedobject->fetch($val[$i]);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$Yoff = $Yoff+4;
|
||||
$pdf->SetXY($Xoff,$Yoff);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$text=$linkedobject->ref;
|
||||
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
$Yoff = $Yoff+4;
|
||||
$pdf->SetXY($Xoff,$Yoff);
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$text=$linkedobject->ref;
|
||||
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
|
||||
$pdf->MultiCell(0, 3, $outputlangs->transnoentities("RefOrder")." : ".$outputlangs->transnoentities($text), '', 'R');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -179,33 +179,31 @@ Class pdf_expedition_rouget extends ModelePdfExpedition
|
||||
$Yoff=40;
|
||||
|
||||
// Add list of linked orders
|
||||
$object->load_object_linked();
|
||||
// TODO possibility to use with other document (business module,...)
|
||||
//$object->load_object_linked();
|
||||
|
||||
$origin = $object->origin;
|
||||
$origin_id = $object->origin_id;
|
||||
|
||||
if ($conf->commande->enabled)
|
||||
// TODO move to external function
|
||||
if ($conf->$origin->enabled)
|
||||
{
|
||||
$outputlangs->load('orders');
|
||||
foreach($object->linked_object as $key => $val)
|
||||
|
||||
$classname = ucfirst($origin);
|
||||
$linkedobject = new $classname($this->db);
|
||||
$result=$linkedobject->fetch($origin_id);
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($key == 'commande')
|
||||
{
|
||||
for ($i = 0; $i<sizeof($val);$i++)
|
||||
{
|
||||
$newobject=new Commande($this->db);
|
||||
$result=$newobject->fetch($val[$i]);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$text=$newobject->ref;
|
||||
if ($newobject->ref_client) $text.=' ('.$newobject->ref_client.')';
|
||||
$Yoff = $Yoff+8;
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||
$pdf->MultiCell(60, 4, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
|
||||
$Yoff = $Yoff+4;
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||
$pdf->MultiCell(60, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"%d %b %Y",false,$outputlangs,true), 0, 'R');
|
||||
}
|
||||
}
|
||||
}
|
||||
$pdf->SetFont('','', $default_font_size - 2);
|
||||
$text=$linkedobject->ref;
|
||||
if ($linkedobject->ref_client) $text.=' ('.$linkedobject->ref_client.')';
|
||||
$Yoff = $Yoff+8;
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||
$pdf->MultiCell(60, 4, $outputlangs->transnoentities("RefOrder") ." : ".$outputlangs->transnoentities($text), 0, 'R');
|
||||
$Yoff = $Yoff+4;
|
||||
$pdf->SetXY($this->page_largeur - $this->marge_droite - 60,$Yoff);
|
||||
$pdf->MultiCell(60, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->commande->date,"%d %b %Y",false,$outputlangs,true), 0, 'R');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user