From 5f0c4dbe48defc14c0a8e847d77c866c6d514288 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 12 May 2014 10:07:57 +0200
Subject: [PATCH] Fix: TCPDF error file not found in member card generation

---
 ChangeLog                                                | 1 +
 htdocs/core/modules/member/doc/pdf_standard.class.php    | 9 ++++++---
 .../modules/printsheet/doc/pdf_standardlabel.class.php   | 6 ++++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 27ebfed92ee..03f35cae0cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -24,6 +24,7 @@ Fix: Nb of notes and doc not visible onto tasks.
 Fix: [ bug #1372 ] Margin calculation does not work in proposals.
 Fix: [ bug #1381 ] PHP Warning when listing stock transactions page.
 Fix: [ bug #1367 ] "Show invoice" link after a POS sell throws an error.
+Fix: TCPDF error file not found in member card generation.
 
 ***** ChangeLog for 3.5.2 compared to 3.5.1 *****
 Fix: Can't add user for a task.
diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php
index 4f8e909d2b1..c259d027a8e 100644
--- a/htdocs/core/modules/member/doc/pdf_standard.class.php
+++ b/htdocs/core/modules/member/doc/pdf_standard.class.php
@@ -161,9 +161,12 @@ class pdf_standard
 
 		// Define photo
 		$dir=$conf->adherent->dir_output;
-		$file=get_exdir($idmember,2).'photos/'.$photo;
-		$photo=$dir.'/'.$file;
-		if (empty($photo) || ! is_readable($photo)) $photo='';
+		if (! empty($photo))
+		{
+			$file=get_exdir($idmember,2).'photos/'.$photo;
+			$photo=$dir.'/'.$file;
+			if (! is_readable($photo)) $photo='';
+		}
 
 		// Define background image
 		$backgroundimage='';
diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
index 9c6d1eb3353..dd3f8155918 100644
--- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
+++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
@@ -157,6 +157,12 @@ class pdf_standardlabel
 			}
 		}
 
+		// Define photo
+		if (! empty($photo))
+		{
+			if (! is_readable($photo)) $photo='';
+		}
+
 		// Define background image
 		$backgroundimage='';
 
-- 
GitLab