Add reading of picture paths
This commit is contained in:
parent
7fc359df5d
commit
34153eec7f
@ -110,12 +110,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
|
||||
if ($conf->global->PRODUCT_USE_UNITS)
|
||||
{
|
||||
$this->posxtva=97;
|
||||
$this->posxtva=95;
|
||||
$this->posxup=114;
|
||||
$this->posxqty=132;
|
||||
$this->posxunit=147;
|
||||
} else {
|
||||
$this->posxtva=112;
|
||||
$this->posxtva=110;
|
||||
$this->posxup=126;
|
||||
$this->posxqty=145;
|
||||
}
|
||||
@ -167,6 +167,44 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->load("orders");
|
||||
|
||||
$nblignes = count($object->lines);
|
||||
|
||||
// Loop on each lines to detect if there is at least one image to show
|
||||
$realpatharray=array();
|
||||
if (! empty($conf->global->MAIN_GENERATE_SUPPLIER_ORDER_WITH_PICTURE))
|
||||
{
|
||||
for ($i = 0 ; $i < $nblignes ; $i++)
|
||||
{
|
||||
if (empty($object->lines[$i]->fk_product)) continue;
|
||||
|
||||
$objphoto = new Product($this->db);
|
||||
$objphoto->fetch($object->lines[$i]->fk_product);
|
||||
|
||||
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
|
||||
{
|
||||
$pdir = get_exdir($object->lines[$i]->fk_product,2,0,0,$objphoto,'product') . $object->lines[$i]->fk_product ."/photos/";
|
||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdir = get_exdir(0,2,0,0,$objphoto,'product') . dol_sanitizeFileName($objphoto->ref).'/';
|
||||
$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;
|
||||
}
|
||||
|
||||
if ($realpath) $realpatharray[$i]=$realpath;
|
||||
}
|
||||
}
|
||||
if (count($realpatharray) == 0) $this->posxpicture=$this->posxtva;
|
||||
|
||||
if ($conf->fournisseur->dir_output.'/commande')
|
||||
{
|
||||
$object->fetch_thirdparty();
|
||||
@ -338,6 +376,10 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetFont('','', $default_font_size - 1); // Into loop to work with multipage
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
// Define size of image if we need it
|
||||
$imglinesize=array();
|
||||
if (! empty($realpatharray[$i])) $imglinesize=pdf_getSizeForImage($realpatharray[$i]);
|
||||
|
||||
$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.
|
||||
$pageposbefore=$pdf->getPage();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user