|
@@ -282,15 +282,15 @@ class pdf_azur extends ModelePDFPropales
|
|
|
$showpricebeforepagebreak=1;
|
|
|
|
|
|
$pdf->startTransaction();
|
|
|
- if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
- {
|
|
|
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
+ {
|
|
|
pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
}
|
|
|
-
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
+ }
|
|
|
+
|
|
|
$pageposafter=$pdf->getPage();
|
|
|
if ($pageposafter > $pageposbefore) // There is a pagebreak
|
|
|
{
|
|
@@ -298,13 +298,13 @@ class pdf_azur extends ModelePDFPropales
|
|
|
$pageposafter=$pageposbefore;
|
|
|
//print $pageposafter.'-'.$pageposbefore;exit;
|
|
|
$pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it.
|
|
|
- if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
- {
|
|
|
- pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
+ if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
+ {
|
|
|
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxtva-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ pdf_writelinedesc($pdf,$object,$i,$outputlangs,$this->posxpicture-$curX,3,$curX,$curY,$hideref,$hidedesc);
|
|
|
}
|
|
|
|
|
|
$pageposafter=$pdf->getPage();
|
|
@@ -343,53 +343,60 @@ class pdf_azur extends ModelePDFPropales
|
|
|
|
|
|
$pdf->SetFont('','', $default_font_size - 1); // On repositionne la police par defaut
|
|
|
|
|
|
- // Photo
|
|
|
- if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
- {
|
|
|
- $curX = $this->posxpicture-1;
|
|
|
- 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;
|
|
|
-
|
|
|
+ // Photo
|
|
|
+ if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
+ {
|
|
|
+ $curX = $this->posxpicture-1;
|
|
|
+ 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='';
|
|
|
if ($object->ref == 'SPECIMEN')
|
|
|
{
|
|
|
$realpath = DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg';
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
|
|
|
- {
|
|
|
- if ($obj['photo_vignette'])
|
|
|
- {
|
|
|
- $filename='thumbs/'.$obj['photo_vignette'];
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- $filename=$obj['photo'];
|
|
|
- }
|
|
|
-
|
|
|
+ {
|
|
|
+ foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
|
|
|
+ {
|
|
|
+ if ($obj['photo_vignette'])
|
|
|
+ {
|
|
|
+ $filename='thumbs/'.$obj['photo_vignette'];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ $filename=$obj['photo'];
|
|
|
+ }
|
|
|
+
|
|
|
$realpath = $dir.$filename;
|
|
|
- break;
|
|
|
- }
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if (!empty($realpath))
|
|
|
- {
|
|
|
+
|
|
|
+ if (!empty($realpath))
|
|
|
+ {
|
|
|
+ //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
|
|
|
$tmp=pdf_getHeightForImage($realpath);
|
|
|
- //var_dump($tmp['height']);exit;
|
|
|
- $pdf->Image($realpath, $curX, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi
|
|
|
+ //var_dump(constant('PDF_IMAGE_SCALE_RATIO'));var_dump($pdf->getImageScale());var_dump($tmp['width']);var_dump($pdf->pixelsToUnits($tmp['width']));exit;
|
|
|
+ // measures 1/72 of an inch, i.e. approximately 0.0139 inch or 25.4/72 = 0.3528 mm
|
|
|
+ var_dump($this->page_largeur);exit;
|
|
|
+ //var_dump(tmp['height']);exit;
|
|
|
+ $pdf->Line($this->posxtva,10,$this->posxtva+0.5,10);
|
|
|
+ $pdf->Image($realpath, $this->posxtva, 10, $tmp['width'], $tmp['height'],'','','',2,0); // Use 300 dpi
|
|
|
+ $pdf->Line($this->posxtva+$pdf->pixelsToUnits($tmp['width']),10,$this->posxtva+$pdf->pixelsToUnits($tmp['width'])+0.5,10);
|
|
|
+ $pdf->Image($realpath, $curX + ($this->posxtva-$this->posxpicture-($pdf->pixelsToUnits($tmp['width'])))/2, $curY-1, $tmp['width'], $tmp['height'],'','','',2, 300); // Use 300 dpi
|
|
|
//$nexY += 7; // +7 for height = 12
|
|
|
- $nexY += round($tmp['height'] / 12 * 7);
|
|
|
- //var_dump($nexY);exit;
|
|
|
+ $nexY += round($pdf->pixelsToUnits($tmp['height']));
|
|
|
+ //var_dump($nexY);exit;
|
|
|
}
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// VAT Rate
|
|
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
|
|
{
|
|
@@ -1073,15 +1080,15 @@ class pdf_azur extends ModelePDFPropales
|
|
|
$pdf->MultiCell(108,2, $outputlangs->transnoentities("Designation"),'','L');
|
|
|
}
|
|
|
|
|
|
- if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
- {
|
|
|
- $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height);
|
|
|
- if (empty($hidetop))
|
|
|
- {
|
|
|
- $pdf->SetXY($this->posxpicture-1, $tab_top+1);
|
|
|
- $pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
|
|
|
- }
|
|
|
- }
|
|
|
+ if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITH_PICTURE))
|
|
|
+ {
|
|
|
+ $pdf->line($this->posxpicture-1, $tab_top, $this->posxpicture-1, $tab_top + $tab_height);
|
|
|
+ if (empty($hidetop))
|
|
|
+ {
|
|
|
+ $pdf->SetXY($this->posxpicture-1, $tab_top+1);
|
|
|
+ $pdf->MultiCell($this->posxtva-$this->posxpicture-1,2, $outputlangs->transnoentities("Photo"),'','C');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
|
|
|
{
|