Clean code

This commit is contained in:
Laurent Destailleur 2015-05-06 23:31:03 +02:00
parent 7adbf033df
commit 36ebaf7a22

View File

@ -162,29 +162,9 @@ class pdf_azur extends ModelePDFPropales
for ($i = 0 ; $i < $nblignes ; $i++) 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);
$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;
}
if ($realpath) $realpatharray[$i]=$realpath;*/
$objphoto->fetch($object->lines[$i]->fk_product);
if (empty($object->lines[$i]->fk_product)) continue; if (empty($object->lines[$i]->fk_product)) continue;
else $objphoto->fetch($object->lines[$i]->fk_product);
$objphoto->fetch($object->lines[$i]->fk_product);
if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO))
{ {
@ -196,6 +176,7 @@ class pdf_azur extends ModelePDFPropales
$pdir[0] = dol_sanitizeFileName($objphoto->ref).'/'; $pdir[0] = dol_sanitizeFileName($objphoto->ref).'/';
$pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/"; $pdir[1] = get_exdir($objphoto->id,2) . $objphoto->id ."/photos/";
} }
$arephoto = false; $arephoto = false;
foreach ($pdir as $midir) foreach ($pdir as $midir)
{ {
@ -205,7 +186,7 @@ class pdf_azur extends ModelePDFPropales
foreach ($objphoto->liste_photos($dir,1) as $key => $obj) foreach ($objphoto->liste_photos($dir,1) as $key => $obj)
{ {
if($conf->global->CAT_HIGH_QUALITY_IMAGES == 0) if (empty($conf->global->CAT_HIGH_QUALITY_IMAGES)) // If CAT_HIGH_QUALITY_IMAGES not defined, we use thumb if defined and then original photo
{ {
if ($obj['photo_vignette']) if ($obj['photo_vignette'])
{ {