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