Merge pull request #13545 from fappels/fix_photos_on_shipment_docs

FIX print pictures on shipment docs
This commit is contained in:
Laurent Destailleur 2020-04-09 19:30:31 +02:00 committed by GitHub
commit 2ac03c2875
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 8 deletions

View File

@ -171,7 +171,8 @@ class pdf_espadon extends ModelePdfExpedition
$nblines = count($object->lines); $nblines = count($object->lines);
// 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);
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
$dir = $conf->product->dir_output.'/'.$pdir; {
$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=''; $realpath='';
@ -206,7 +215,8 @@ class pdf_espadon extends ModelePdfExpedition
$filename = $obj['photo']; $filename = $obj['photo'];
} }
$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/"; {
$dir = $conf->product->dir_output.'/'.$pdir; $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 = ''; $realpath = '';