FIX option MAIN_GENERATE_SUPPLIER_PROPOSAL_WITH_PICTURE
This commit is contained in:
parent
421681cda4
commit
81a94f5642
@ -239,7 +239,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
|
|||||||
$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 {
|
} else {
|
||||||
$pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/';
|
$pdir = get_exdir(0, 0, 0, 0, $objphoto, 'product');
|
||||||
$dir = $conf->product->dir_output.'/'.$pdir;
|
$dir = $conf->product->dir_output.'/'.$pdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5208,11 +5208,11 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Retourne tableau de toutes les photos du produit
|
* Return an array with all photos of product found on disk. There is no sorting criteria.
|
||||||
*
|
*
|
||||||
* @param string $dir Repertoire a scanner
|
* @param string $dir Directory to scan
|
||||||
* @param int $nbmax Nombre maximum de photos (0=pas de max)
|
* @param int $nbmax Number maxium of photos (0=no maximum)
|
||||||
* @return array Tableau de photos
|
* @return array Array of photos
|
||||||
*/
|
*/
|
||||||
public function liste_photos($dir, $nbmax = 0)
|
public function liste_photos($dir, $nbmax = 0)
|
||||||
{
|
{
|
||||||
@ -5226,16 +5226,17 @@ class Product extends CommonObject
|
|||||||
$dir_osencoded = dol_osencode($dir);
|
$dir_osencoded = dol_osencode($dir);
|
||||||
$handle = @opendir($dir_osencoded);
|
$handle = @opendir($dir_osencoded);
|
||||||
if (is_resource($handle)) {
|
if (is_resource($handle)) {
|
||||||
while (($file = readdir($handle)) !== false)
|
while (($file = readdir($handle)) !== false) {
|
||||||
{
|
if (!utf8_check($file)) {
|
||||||
if (!utf8_check($file)) { $file = utf8_encode($file); // readdir returns ISO
|
$file = utf8_encode($file); // readdir returns ISO
|
||||||
}
|
}
|
||||||
if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) {
|
if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) {
|
||||||
$nbphoto++;
|
$nbphoto++;
|
||||||
|
|
||||||
// On determine nom du fichier vignette
|
// We forge name of thumb.
|
||||||
$photo = $file;
|
$photo = $file;
|
||||||
$photo_vignette = '';
|
$photo_vignette = '';
|
||||||
|
$regs = array();
|
||||||
if (preg_match('/('.$this->regeximgext.')$/i', $photo, $regs)) {
|
if (preg_match('/('.$this->regeximgext.')$/i', $photo, $regs)) {
|
||||||
$photo_vignette = preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0];
|
$photo_vignette = preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0];
|
||||||
}
|
}
|
||||||
@ -5245,14 +5246,17 @@ class Product extends CommonObject
|
|||||||
// Objet
|
// Objet
|
||||||
$obj = array();
|
$obj = array();
|
||||||
$obj['photo'] = $photo;
|
$obj['photo'] = $photo;
|
||||||
if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) { $obj['photo_vignette'] = 'thumbs/'.$photo_vignette;
|
if ($photo_vignette && dol_is_file($dirthumb.$photo_vignette)) {
|
||||||
} else { $obj['photo_vignette'] = "";
|
$obj['photo_vignette'] = 'thumbs/'.$photo_vignette;
|
||||||
|
} else {
|
||||||
|
$obj['photo_vignette'] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$tabobj[$nbphoto - 1] = $obj;
|
$tabobj[$nbphoto - 1] = $obj;
|
||||||
|
|
||||||
// On continue ou on arrete de boucler ?
|
// Do we have to continue with next photo ?
|
||||||
if ($nbmax && $nbphoto >= $nbmax) { break;
|
if ($nbmax && $nbphoto >= $nbmax) {
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5265,9 +5269,9 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||||
/**
|
/**
|
||||||
* Efface la photo du produit et sa vignette
|
* Delete a photo and its thumbs
|
||||||
*
|
*
|
||||||
* @param string $file Chemin de l'image
|
* @param string $file Path to image file
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete_photo($file)
|
public function delete_photo($file)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user