Fix error when removing dir with some subdirs
This commit is contained in:
parent
5ada5c18f9
commit
9230c6757b
@ -160,23 +160,28 @@ if ($action == 'confirm_deletedir' && $confirm == 'yes')
|
|||||||
{
|
{
|
||||||
// Fetch was already done
|
// Fetch was already done
|
||||||
$result=$ecmdir->delete($user);
|
$result=$ecmdir->delete($user);
|
||||||
|
if ($result <= 0)
|
||||||
|
{
|
||||||
|
$langs->load('errors');
|
||||||
|
setEventMessages($langs->trans($ecmdir->error,$ecmdir->label), null, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$resbool = dol_delete_dir($upload_dir);
|
$resbool = dol_delete_dir($upload_dir, 1);
|
||||||
if ($resbool) $result = 1;
|
if ($resbool) $result = 1;
|
||||||
else $result = 0;
|
else
|
||||||
|
{
|
||||||
|
$langs->load('errors');
|
||||||
|
setEventMessages($langs->trans("ErrorFailToDeleteDir", $upload_dir), null, 'errors');
|
||||||
|
$result = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
header("Location: ".$backtourl);
|
header("Location: ".$backtourl);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$langs->load('errors');
|
|
||||||
setEventMessages($langs->trans($ecmdir->error,$ecmdir->label), null, 'errors');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update dirname or description
|
// Update dirname or description
|
||||||
@ -281,6 +286,7 @@ if ($module == 'ecm')
|
|||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
// Built the file List
|
// Built the file List
|
||||||
|
$filearrayall=dol_dir_list($upload_dir,"all",0,'','',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||||
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview.*\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||||
$totalsize=0;
|
$totalsize=0;
|
||||||
foreach($filearray as $key => $file)
|
foreach($filearray as $key => $file)
|
||||||
@ -469,7 +475,7 @@ if ($action != 'edit' && $action != 'delete')
|
|||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotAllowed").'">'.$langs->trans('ECMAddSection').'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($filearray) == 0)
|
if (count($filearrayall) == 0)
|
||||||
{
|
{
|
||||||
if ($permtoadd)
|
if ($permtoadd)
|
||||||
{
|
{
|
||||||
@ -482,7 +488,10 @@ if ($action != 'edit' && $action != 'delete')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a class="butActionRefused" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFiles").'">'.$langs->trans('Delete').'</a>';
|
if (count($filearray) > 0)
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFiles").'">'.$langs->trans('Delete').'</a>';
|
||||||
|
else
|
||||||
|
print '<a class="butActionRefused" href="#" title="'.$langs->trans("CannotRemoveDirectoryContainsFilesOrDirs").'">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
print '</div>';
|
print '</div>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,6 +39,7 @@ ShowECMSection=Show directory
|
|||||||
DeleteSection=Remove directory
|
DeleteSection=Remove directory
|
||||||
ConfirmDeleteSection=Can you confirm you want to delete the directory <b>%s</b>?
|
ConfirmDeleteSection=Can you confirm you want to delete the directory <b>%s</b>?
|
||||||
ECMDirectoryForFiles=Relative directory for files
|
ECMDirectoryForFiles=Relative directory for files
|
||||||
|
CannotRemoveDirectoryContainsFilesOrDirs=Removed not possible because it contains some files or sub-directories
|
||||||
CannotRemoveDirectoryContainsFiles=Removed not possible because it contains some files
|
CannotRemoveDirectoryContainsFiles=Removed not possible because it contains some files
|
||||||
ECMFileManager=File manager
|
ECMFileManager=File manager
|
||||||
ECMSelectASection=Select a directory in the tree...
|
ECMSelectASection=Select a directory in the tree...
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user