diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 9ba4ccc7f19..69c349616f5 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1291,6 +1291,7 @@ class FormFile
$nboflines++;
print ''."\n";
// Do we have entry into database ?
+
print ''."\n";
print '
';
@@ -1436,7 +1437,7 @@ class FormFile
if ($permtoeditline) {
// Link to resize
$moreparaminurl = '';
- if ($object->id > 0) {
+ if (!empty($object->id) && $object->id > 0) {
$moreparaminurl = '&id='.$object->id;
} elseif (GETPOST('website', 'alpha')) {
$moreparaminurl = '&website='.GETPOST('website', 'alpha');
diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php
index ddcb23da891..2c4b2f5dea8 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -54,7 +54,9 @@ if ($module == 'medias') {
$showroot = 1;
}
-
+if (!isset($section)) {
+ $section = 0;
+}
// Confirm remove file (for non javascript users)
if (($action == 'delete' || $action == 'file_manager_delete') && empty($conf->use_javascript_ajax)) {
@@ -106,12 +108,26 @@ $('#acreatedir').on('click', function() {
try{
section_dir = $('.directory.expanded')[$('.directory.expanded').length-1].children[0].rel;
section = $('.directory.expanded')[$('.directory.expanded').length-1].children[0].id.split('_')[2];
+ catParent = ";
+if ($module == 'ecm') {
+ print "section;";
+} else {
+ print "section_dir.substring(0, section_dir.length - 1);";
+}
+print "
} catch{
section_dir = '/';
section = 0;
+ catParent = ";
+if ($module == 'ecm') {
+ print "section;";
+} else {
+ print "section_dir;";
+}
+print "
}
console.log('We click to create a new directory, we set current section_dir='+section_dir+' into href url of button acreatedir');
- $('#acreatedir').attr('href', $('#acreatedir').attr('href')+'§ion_dir='+encodeURI(section_dir)+'§ion='+encodeURI(section));
+ $('#acreatedir').attr('href', $('#acreatedir').attr('href')+'%26section_dir%3D'+encodeURI(section_dir)+'%26section%3D'+encodeURI(section)+'§ion_dir='+encodeURI(section_dir)+'§ion='+encodeURI(section)+'&catParent='+encodeURI(catParent));
console.log($('#acreatedir').attr('href'));
});
$('#agenerateimgwebp').on('click', function() {
diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php
index d7de6acc727..e5df264e377 100644
--- a/htdocs/ecm/dir_add_card.php
+++ b/htdocs/ecm/dir_add_card.php
@@ -230,7 +230,7 @@ if ($action == 'create') {
print '