From 1c01e187c1ef9a5b3698801fac4c088bc5636eb3 Mon Sep 17 00:00:00 2001
From: fmarcet <fmarcet@imedia>
Date: Mon, 27 Apr 2015 16:44:12 +0200
Subject: [PATCH] Fix: Bug in the new photo system

---
 htdocs/product/class/product.class.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 228f790438b..bfb1a660b55 100755
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -3409,9 +3409,12 @@ class Product extends CommonObject
 	function is_photo_available($sdir)
 	{
 		include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
+		
+		global $conf;
 
 		$dir = $sdir;
-		if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos";
+		if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $dir .= '/'. get_exdir($this->id,2) . $this->id ."/photos/";
+		else $dir .= '/'.dol_sanitizeFileName($this->ref).'/';
 
 		$nbphoto=0;
 
-- 
GitLab