Skip to content
Snippets Groups Projects
Commit 7965e5bc authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Merge pull request #3157 from marcosgdf/bug-3055

FIX #3055 Product image thumbnails were not deleted after deleting the image
parents 36aebb5f cba902c5
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ make a Dolibarr upgrade.
FIX [ bug #2855 ] Wrong translation key in localtax report page
FIX [ bug #1852 ] JS error when editing a customer order line
FIX [ bug #2900 ] Courtesy title is not stored in create thirdparty form
FIX [ bug #3055 ] Product image thumbnails were not deleted after deleting the image
***** ChangeLog for 3.7.1 compared to 3.7.* *****
FIX Bug in the new photo system
......
......@@ -387,7 +387,6 @@ function dol_is_url($url)
return false;
}
/**
* Test if a folder is empty
*
......
<?php
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -58,7 +59,27 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($urlfile)
{
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image d'origine
$dirthumb = $dir.'/thumbs/'; // Chemin du dossier contenant la vignette
$ret = dol_delete_file($file, 0, 0, 0, $object);
// Si elle existe, on efface la vignette
if (preg_match('/(\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff)$/i',$file,$regs))
{
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_small'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
{
dol_delete_file($dirthumb.$photo_vignette);
}
$photo_vignette=basename(preg_replace('/'.$regs[0].'/i','',$file).'_mini'.$regs[0]);
if (file_exists(dol_osencode($dirthumb.$photo_vignette)))
{
dol_delete_file($dirthumb.$photo_vignette);
}
}
if ($ret) {
setEventMessage($langs->trans("FileWasRemoved", $urlfile));
} else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment