This commit is contained in:
Laurent Destailleur 2013-07-15 18:51:56 +02:00
parent 9e9e5224f6
commit dd10ff8a11
3 changed files with 40 additions and 40 deletions

View File

@ -1574,7 +1574,7 @@ function pdf_getSizeForImage($realpath)
if ($width > $maxwidth) // Pb with maxheight, so i use maxwidth
{
$width=$maxwidth;
$height=(int) round($maxwidth*$tmp['height']/$tmp['width']);
$height=(int) round($maxwidth*$tmp['height']/$tmp['width']);
}
else // No pb with maxheight
{

View File

@ -273,29 +273,29 @@ class pdf_azur extends ModelePDFPropales
$pdf->SetTextColor(0,0,0);
// Define size of image if we need it
$imglinesize=array(); $realpath='';
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
if ($object->lines[$i]->fk_product)
{
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
$realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{
$filename=$obj['photo'];
$imglinesize=array(); $realpath='';
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
{
if ($object->lines[$i]->fk_product)
{
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product,2) . $object->lines[$i]->fk_product ."/photos/";
$dir = $conf->product->dir_output.'/'.$pdir;
$realpath='';
foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{
$filename=$obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
$realpath = $dir.$filename;
break;
}
$realpath = $dir.$filename;
break;
}
if (!empty($realpath)) $imglinesize=pdf_getSizeForImage($realpath);
}
}
}
}
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
@ -308,23 +308,23 @@ class pdf_azur extends ModelePDFPropales
// We start with Photo of product line
if (($curY + $imglinesize['height']) > ($this->page_hauteur-($heightforfooter+$heightforfreetext+$heightforinfotot))) // If photo to high, we moved completely on new page
{
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->AddPage('','',true);
if (! empty($tplidx)) $pdf->useTemplate($tplidx);
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs);
$pdf->setPage($pagenb+1);
$curY = $tab_top_newpage;
$showpricebeforepagebreak=0;
}
$showpricebeforepagebreak=0;
}
if (isset($imglinesize['width']) && isset($imglinesize['height']))
{
$curX = $this->posxpicture-1;
if (isset($imglinesize['width']) && isset($imglinesize['height']))
{
$curX = $this->posxpicture-1;
$pdf->Image($realpath, $curX + (($this->posxtva-$this->posxpicture-$imglinesize['width'])/2), $curY, $imglinesize['width'], $imglinesize['height'], '', '', '', 2, 300); // Use 300 dpi
// $pdf->Image does not increase value return by getY, so we save it manually
$posYAfterImage=$curY+$imglinesize['height'];
}
}
// Description of product line
$curX = $this->posxdesc-1;
@ -376,7 +376,7 @@ class pdf_azur extends ModelePDFPropales
{
$pdf->commitTransaction();
}
$posYAfterDescription=$pdf->GetY();
$posYAfterDescription=$pdf->GetY();
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();

View File

@ -183,13 +183,13 @@ foreach ($argv as $key => $value)
print 'Exclude credit note invoices'."\n";
}
if ($value == 'filter=excludethirdparties')
{
$found=true;
$filter[]='excludethirdparties';
$excludethirdpartiesid=explode(',',$argv[$key+1]);
print 'Exclude thirdparties with id in list ('.join(',',$excludethirdpartiesid).").\n";
if ($value == 'filter=excludethirdparties')
{
$found=true;
$filter[]='excludethirdparties';
$excludethirdpartiesid=explode(',',$argv[$key+1]);
print 'Exclude thirdparties with id in list ('.join(',',$excludethirdpartiesid).").\n";
}
if (! $found && preg_match('/filter=/i',$value))