Merge pull request #21567 from emheyarssi/15.0

FIX #21518
This commit is contained in:
Laurent Destailleur 2022-07-24 20:08:11 +02:00 committed by GitHub
commit 96b7735bbe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -554,9 +554,8 @@ if (empty($reshook)) {
}
//var_dump($object->array_languages);exit;
if (GETPOST('deletephoto')) {
$object->logo = '';
} elseif (!empty($_FILES['photo']['name'])) {
if (!empty($_FILES['photo']['name'])) {
$current_logo = $object->logo;
$object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
}
@ -786,6 +785,13 @@ if (empty($reshook)) {
}
if ($file_OK) {
if (image_format_supported($_FILES['photo']['name']) > 0) {
if ($current_logo != $object->logo) {
$fileimg = $dir.'/'.$current_logo;
$dirthumbs = $dir.'/thumbs';
dol_delete_file($fileimg);
dol_delete_dir_recursive($dirthumbs);
}
dol_mkdir($dir);
if (@is_dir($dir)) {