Skip to content

Commit

Permalink
Fix: origin and origin_id always in the fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Mar 9, 2011
1 parent 6671e8c commit 123fab9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 48 deletions.
Expand Up @@ -340,10 +340,9 @@ function _pagefoot(&$pdf, $object, $outputlangs)
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
Expand Down Expand Up @@ -399,32 +398,29 @@ function _pagehead(&$pdf, $object, $outputlangs)
$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');
}
}

Expand Down
Expand Up @@ -179,33 +179,31 @@ function _pagehead(&$pdf, $object, $showadress=1, $outputlangs)
$Yoff=40;

// Add list of linked orders
$object->load_object_linked();

if ($conf->commande->enabled)
// TODO possibility to use with other document (business module,...)
//$object->load_object_linked();

$origin = $object->origin;
$origin_id = $object->origin_id;

// 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');
}
}

Expand Down

0 comments on commit 123fab9

Please sign in to comment.