diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 6e8b1cd6340..677efccfdee 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1236,7 +1236,7 @@ class FormFile
print "";
print '';
- if (! $editline && $nboflines > 1) {
+ if (! $editline && $nboflines > 1 && is_object($object)) {
if (! empty($conf->use_javascript_ajax) && $permtoeditline) {
$table_element_line = 'ecm_files';
include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php
index 4399b62851a..826c32a57d6 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -21,7 +21,7 @@
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
- print "Error, template page can't be called as URL";
+ print "Error, template page filemanager.tpl.php can't be called as URL";
exit;
}
@@ -204,7 +204,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg
$mode='noajax';
if (empty($url)) $url=DOL_URL_ROOT.'/ecm/index.php';
-include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
+include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
// End right panel
diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php
index ba935676e1e..f17c061f36a 100644
--- a/htdocs/ecm/dir_add_card.php
+++ b/htdocs/ecm/dir_add_card.php
@@ -111,6 +111,7 @@ if ($action == 'add' && $user->rights->ecm->setup)
$label = trim(GETPOST("label", 'alpha'));
$desc = trim(GETPOST("desc", 'alpha'));
$catParent = GETPOST("catParent", 'alpha'); // Can be an int (with ECM) or a string (with generic filemanager)
+ if ($catParent == '-1') $catParent=0;
$error=0;
diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php
index ce403469107..27d1c8b7683 100644
--- a/htdocs/ecm/dir_card.php
+++ b/htdocs/ecm/dir_card.php
@@ -139,11 +139,23 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
// Remove dir
if ($action == 'confirm_deletedir' && $confirm == 'yes')
{
- // Fetch was already done
- $result=$ecmdir->delete($user);
+ $backtourl = DOL_URL_ROOT."/ecm/index.php";
+ if ($module == 'medias') $backtourl = DOL_URL_ROOT."/website/index.php?file_manager=1";
+
+ if ($module == 'ecm')
+ {
+ // Fetch was already done
+ $result=$ecmdir->delete($user);
+ }
+ else
+ {
+ $resbool = dol_delete_dir($upload_dir);
+ if ($resbool) $result = 1;
+ else $result = 0;
+ }
if ($result > 0)
{
- header("Location: ".DOL_URL_ROOT."/ecm/index.php");
+ header("Location: ".$backtourl);
exit;
}
else
diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
index 278cc8afe3e..0a51e8cc73d 100644
--- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
+++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php
@@ -20,7 +20,7 @@
// Protection to avoid direct call of template
if (empty($conf) || ! is_object($conf))
{
- print "Error, template page can't be called as URL";
+ print "Error, template enablefiletreeajax.tpl.php can't be called as URL";
exit;
}
diff --git a/htdocs/website/index.php b/htdocs/website/index.php
index 505bfdc9a6a..61455836ef1 100644
--- a/htdocs/website/index.php
+++ b/htdocs/website/index.php
@@ -2020,6 +2020,7 @@ if ($action == 'editfile' || $action == 'file_manager')
include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php';
print '';
+
}
if ($action == 'editmenu')