FIX print pictures in shipment docs

This commit is contained in:
Francis Appels 2020-04-09 15:40:36 +02:00
parent b9fc642a35
commit 0a8a8bafa0
2 changed files with 25 additions and 8 deletions

View File

@ -172,6 +172,7 @@ class pdf_espadon extends ModelePdfExpedition
// Loop on each lines to detect if there is at least one image to show // Loop on each lines to detect if there is at least one image to show
$realpatharray=array(); $realpatharray=array();
$this->atleastonephoto = false;
if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE)) if (! empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE))
{ {
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
@ -183,8 +184,16 @@ class pdf_espadon extends ModelePdfExpedition
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $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/"; $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; $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=''; $realpath='';
@ -207,6 +216,7 @@ class pdf_espadon extends ModelePdfExpedition
} }
$realpath = $dir.$filename; $realpath = $dir.$filename;
$this->atleastonephoto = true;
break; break;
} }
@ -1150,7 +1160,7 @@ class pdf_espadon extends ModelePdfExpedition
'border-left' => false, // remove left line separator 'border-left' => false, // remove left line separator
); );
if (!empty($conf->global->MAIN_GENERATE_PROPOSALS_WITH_PICTURE) && !empty($this->atleastonephoto)) if (!empty($conf->global->MAIN_GENERATE_SHIPMENT_WITH_PICTURE) && !empty($this->atleastonephoto))
{ {
$this->cols['photo']['status'] = true; $this->cols['photo']['status'] = true;
} }

View File

@ -214,9 +214,16 @@ class pdf_rouget extends ModelePdfExpedition
$objphoto = new Product($this->db); $objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product); $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/"; {
$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; $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 = ''; $realpath = '';