From 504b519fb7b32e2cb7906091b3a225af9bf1aec6 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Wed, 1 Jan 2014 18:30:32 +0100
Subject: [PATCH] Fix: Bad link for download file into documents page of
 supplier invoices

---
 htdocs/core/class/html.formfile.class.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 189cec49f80..0559c7b56da 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -762,7 +762,10 @@ class FormFile
 				{
 					// Define relative path used to store the file
 					if (empty($relativepath))
+					{
 						$relativepath=(! empty($object->ref)?dol_sanitizeFileName($object->ref):'').'/';
+						if ($object->element == 'invoice_supplier') $relativepath=get_exdir($object->id,2).$relativepath;
+					}
 
 					$var=!$var;
 					print '<tr '.$bc[$var].'>';
-- 
GitLab