Merge pull request #3157 from marcosgdf/bug-3055
FIX #3055 Product image thumbnails were not deleted after deleting the image
This commit is contained in:
commit
7965e5bcfb
@ -12,6 +12,7 @@ make a Dolibarr upgrade.
|
|||||||
FIX [ bug #2855 ] Wrong translation key in localtax report page
|
FIX [ bug #2855 ] Wrong translation key in localtax report page
|
||||||
FIX [ bug #1852 ] JS error when editing a customer order line
|
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 #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.* *****
|
***** ChangeLog for 3.7.1 compared to 3.7.* *****
|
||||||
FIX Bug in the new photo system
|
FIX Bug in the new photo system
|
||||||
|
|||||||
@ -387,7 +387,6 @@ function dol_is_url($url)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if a folder is empty
|
* Test if a folder is empty
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
/* 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
|
* 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
|
* 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)
|
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);
|
$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) {
|
if ($ret) {
|
||||||
setEventMessage($langs->trans("FileWasRemoved", $urlfile));
|
setEventMessage($langs->trans("FileWasRemoved", $urlfile));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user