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 if ($width > $maxwidth) // Pb with maxheight, so i use maxwidth
{ {
$width=$maxwidth; $width=$maxwidth;
$height=(int) round($maxwidth*$tmp['height']/$tmp['width']); $height=(int) round($maxwidth*$tmp['height']/$tmp['width']);
} }
else // No pb with maxheight else // No pb with maxheight
{ {

View File

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

View File

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