From ccb467f0e37eec2fd68ea779c3509e225ae3e4f3 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Thu, 25 May 2006 17:00:00 +0000
Subject: [PATCH] =?UTF-8?q?New:=20Possibilit=E9=20de=20supprimer=20le=20lo?=
 =?UTF-8?q?go=20soci=E9t=E9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 htdocs/admin/index.php                        | 19 ++++++++++++++++---
 .../modules/commande/pdf_einstein.modules.php |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php
index c27ec52072a..89dfa00dc80 100644
--- a/htdocs/admin/index.php
+++ b/htdocs/admin/index.php
@@ -88,8 +88,19 @@ if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
     }
 }
 
+if ($_GET["action"] == 'removelogo')
+{
+	$logofile=$conf->societe->dir_logos.'/'.$mysoc->logo;
+	@unlink($logofile);
+    dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO");
+}
+
 
 
+/*
+ * Affichage page
+ */
+
 llxHeader();
 
 $form = new Form($db);
@@ -178,9 +189,11 @@ if ((isset($_GET["action"]) && $_GET["action"] == 'edit')
     print '<tr '.$bc[$var].'><td>'.$langs->trans("Logo").' (png,jpg)</td><td>';
     print '<table width="100%" class="notopnoleftnoright"><tr><td valign="center">';
     print '<input type="file" class="flat" name="logo" size="30">';
-    print '</td><td valign="center" align="right">';
-    if (file_exists($conf->societe->dir_logos.'/'.$mysoc->logo))
+    print '</td><td valign="middle" align="right">';
+    if ($mysoc->logo && file_exists($conf->societe->dir_logos.'/'.$mysoc->logo))
     {
+        print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
+        print ' &nbsp; ';
         print '<img height="30" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.$mysoc->logo.'">';
     }
     else
@@ -410,7 +423,7 @@ else
     print '<table width="100%" class="notopnoleftnoright"><tr><td valign="center">';
     print $mysoc->logo;
     print '</td><td valign="center" align="right">';
-    if (file_exists($conf->societe->dir_logos.'/'.$mysoc->logo))
+    if ($mysoc->logo && file_exists($conf->societe->dir_logos.'/'.$mysoc->logo))
     {
         print '<img height="30" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=companylogo&file='.$mysoc->logo.'">';
     }
diff --git a/htdocs/includes/modules/commande/pdf_einstein.modules.php b/htdocs/includes/modules/commande/pdf_einstein.modules.php
index fbdd6e18cb0..ad18150c28f 100644
--- a/htdocs/includes/modules/commande/pdf_einstein.modules.php
+++ b/htdocs/includes/modules/commande/pdf_einstein.modules.php
@@ -641,7 +641,7 @@ class pdf_einstein extends ModelePDFCommandes
 
 		// Logo
         $logo=$conf->societe->dir_logos.'/'.$mysoc->logo;
-        if ($logo)
+        if ($mysoc->logo)
         {
             if (is_readable($logo))
             {
-- 
GitLab