From dd10ff8a11a599736aeb6ff2b1a9fbc1102dfa32 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jul 2013 18:51:56 +0200 Subject: [PATCH] eol --- htdocs/core/lib/pdf.lib.php | 2 +- .../modules/propale/doc/pdf_azur.modules.php | 64 +++++++++---------- scripts/invoices/rebuild_merge_pdf.php | 14 ++-- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index c895ea541d7..f22d35e7de1 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -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 { diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index ce4c3d4d36f..ed501026c8a 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -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(); diff --git a/scripts/invoices/rebuild_merge_pdf.php b/scripts/invoices/rebuild_merge_pdf.php index d7b64bb92a4..fca2a32ce13 100755 --- a/scripts/invoices/rebuild_merge_pdf.php +++ b/scripts/invoices/rebuild_merge_pdf.php @@ -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))