diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 6c4ff6e30f1..7117b2b8a2a 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1328,7 +1328,7 @@ class FormFile
if ($file['name'] != '.'
&& $file['name'] != '..'
&& !preg_match('/\.meta$/i', $file['name'])) {
- if ($filearray[$key]['rowid'] > 0) {
+ if (!empty($filearray[$key]['rowid']) && $filearray[$key]['rowid'] > 0) {
$lastrowid = $filearray[$key]['rowid'];
}
$filepath = $relativepath.$file['name'];
@@ -1337,8 +1337,8 @@ class FormFile
$nboflines++;
print ''."\n";
// Do we have entry into database ?
- print ''."\n";
- print '
';
// File name
print '| ';
@@ -1481,7 +1481,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 e776388ac53..5c40e56ff10 100644
--- a/htdocs/core/tpl/filemanager.tpl.php
+++ b/htdocs/core/tpl/filemanager.tpl.php
@@ -51,7 +51,7 @@ if ($module == 'medias') {
$permtoupload = ($user->rights->mailing->creer || $user->rights->website->write);
$showroot = 1;
}
-
+$section = 0;
// Confirm remove file (for non javascript users)
@@ -102,12 +102,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/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php
index 623d626935d..b93d3d563fb 100644
--- a/htdocs/ecm/class/htmlecm.form.class.php
+++ b/htdocs/ecm/class/htmlecm.form.class.php
@@ -80,7 +80,7 @@ class FormEcm
$cate_arbo = dol_dir_list($path, 'directories', 1, '', array('(\.meta|_preview.*\.png)$', '^\.'), 'relativename', SORT_ASC);
}
- $output = ' |