';
+ if ($user->rights->ecm->setup)
+ {
+ print '
'.$langs->trans('Edit').'';
+ }
+ /*
if ($user->rights->ecm->setup)
{
- print '
'.$langs->trans('Edit').'';
- }
- /*
- if ($user->rights->ecm->setup)
- {
- print '
'.$langs->trans('Delete').'';
+ print '
'.$langs->trans('Delete').'';
}
else
{
--- /tmp/dsg/dolibarr/htdocs/ecm/github_index.php
+++ /tmp/dsg/dolibarr/htdocs/ecm/client_index.php
@@ -83,10 +83,10 @@
//include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
// Upload file (code similar but different than actions_linkedfiles.inc.php)
-if (GETPOST("sendit", 'alphanohtml') && !empty($conf->global->MAIN_UPLOAD_DOC))
+if (GETPOST("sendit", 'none') && !empty($conf->global->MAIN_UPLOAD_DOC))
{
// Define relativepath and upload_dir
- $relativepath = '';
+ $relativepath = '';
if ($ecmdir->id) $relativepath = $ecmdir->getRelativePath();
else $relativepath = $section_dir;
$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
@@ -101,7 +101,8 @@
$error++;
if ($_FILES['userfile']['error'][$key] == 1 || $_FILES['userfile']['error'][$key] == 2) {
setEventMessages($langs->trans('ErrorFileSizeTooLarge'), null, 'errors');
- } else {
+ }
+ else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors');
}
}
@@ -111,10 +112,10 @@
{
$generatethumbs = 0;
$res = dol_add_file_process($upload_dir, 0, 1, 'userfile', '', null, '', $generatethumbs);
- if ($res > 0)
- {
- $result = $ecmdir->changeNbOfFiles('+');
- }
+ if ($res > 0)
+ {
+ $result = $ecmdir->changeNbOfFiles('+');
+ }
}
}
@@ -127,6 +128,7 @@
$upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
$file = $upload_dir."/".GETPOST('urlfile', 'alpha');
+
$ret = dol_delete_file($file); // This include also the delete from file index in database.
if ($ret)
{
@@ -134,7 +136,9 @@
$urlfiletoshow = preg_replace('/\.noexe$/', '', $urlfiletoshow);
setEventMessages($langs->trans("FileWasRemoved", $urlfiletoshow), null, 'mesgs');
$result = $ecmdir->changeNbOfFiles('-');
- } else {
+ }
+ else
+ {
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors');
}
@@ -155,7 +159,9 @@
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
- } else {
+ }
+ else
+ {
setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
$action = "create";
}
@@ -169,7 +175,7 @@
$result = $ecmdir->delete($user);
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
- clearstatcache();
+ clearstatcache();
}
// Refresh directory view
@@ -177,130 +183,137 @@
// To refresh content of dir with cache, just open the dir in edit mode.
if ($action == 'refreshmanual')
{
- $ecmdirtmp = new EcmDirectory($db);
+ $ecmdirtmp = new EcmDirectory($db);
// This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
clearstatcache();
- $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
- $diroutputslash .= '/';
-
- // Scan directory tree on disk
- $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
-
- // Scan directory tree in database
- $sqltree = $ecmdirstatic->get_full_arbo(0);
-
- $adirwascreated = 0;
-
- // Now we compare both trees to complete missing trees into database
- //var_dump($disktree);
- //var_dump($sqltree);
- foreach ($disktree as $dirdesc) // Loop on tree onto disk
- {
- $dirisindatabase = 0;
- foreach ($sqltree as $dirsqldesc)
- {
- if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname'])
- {
- $dirisindatabase = 1;
- break;
- }
- }
-
- if (!$dirisindatabase)
- {
- $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
- dol_syslog($txt);
- //print $txt."
\n";
-
- // We must first find the fk_parent of directory to create $dirdesc['fullname']
- $fk_parent = -1;
- $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
- $relativepathtosearchparent = $relativepathmissing;
- //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
- if (preg_match('/\//', $relativepathtosearchparent))
- //while (preg_match('/\//',$relativepathtosearchparent))
- {
- $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
- $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
- dol_syslog($txt);
- //print $txt." -> ";
- $parentdirisindatabase = 0;
- foreach ($sqltree as $dirsqldesc)
+ $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
+ $diroutputslash .= '/';
+
+ // Scan directory tree on disk
+ $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
+
+ // Scan directory tree in database
+ $sqltree = $ecmdirstatic->get_full_arbo(0);
+
+ $adirwascreated = 0;
+
+ // Now we compare both trees to complete missing trees into database
+ //var_dump($disktree);
+ //var_dump($sqltree);
+ foreach ($disktree as $dirdesc) // Loop on tree onto disk
+ {
+ $dirisindatabase = 0;
+ foreach ($sqltree as $dirsqldesc)
+ {
+ if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname'])
+ {
+ $dirisindatabase = 1;
+ break;
+ }
+ }
+
+ if (!$dirisindatabase)
+ {
+ $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
+ dol_syslog($txt);
+ //print $txt."
\n";
+
+ // We must first find the fk_parent of directory to create $dirdesc['fullname']
+ $fk_parent = -1;
+ $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
+ $relativepathtosearchparent = $relativepathmissing;
+ //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
+ if (preg_match('/\//', $relativepathtosearchparent))
+ //while (preg_match('/\//',$relativepathtosearchparent))
+ {
+ $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
+ $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
+ dol_syslog($txt);
+ //print $txt." -> ";
+ $parentdirisindatabase = 0;
+ foreach ($sqltree as $dirsqldesc)
+ {
+ if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent)
+ {
+ $parentdirisindatabase = $dirsqldesc['id'];
+ break;
+ }
+ }
+ if ($parentdirisindatabase > 0)
+ {
+ dol_syslog("Yes with id ".$parentdirisindatabase);
+ //print "Yes with id ".$parentdirisindatabase."
\n";
+ $fk_parent = $parentdirisindatabase;
+ //break; // We found parent, we can stop the while loop
+ }
+ else
{
- if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent)
- {
- $parentdirisindatabase = $dirsqldesc['id'];
- break;
- }
- }
- if ($parentdirisindatabase > 0)
- {
- dol_syslog("Yes with id ".$parentdirisindatabase);
- //print "Yes with id ".$parentdirisindatabase."
\n";
- $fk_parent = $parentdirisindatabase;
- //break; // We found parent, we can stop the while loop
- } else {
- dol_syslog("No");
- //print "No
\n";
- }
- } else {
- dol_syslog("Parent is root");
- $fk_parent = 0; // Parent is root
- }
-
- if ($fk_parent >= 0)
- {
- $ecmdirtmp->ref = 'NOTUSEDYET';
- $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
- $ecmdirtmp->description = '';
- $ecmdirtmp->fk_parent = $fk_parent;
-
- $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
- dol_syslog($txt);
- //print $ecmdirtmp->cachenbofdoc."
\n";exit;
- $id = $ecmdirtmp->create($user);
- if ($id > 0)
- {
- $newdirsql = array('id'=>$id,
- 'id_mere'=>$ecmdirtmp->fk_parent,
- 'label'=>$ecmdirtmp->label,
- 'description'=>$ecmdirtmp->description,
- 'fullrelativename'=>$relativepathmissing);
- $sqltree[] = $newdirsql; // We complete fulltree for following loops
- //var_dump($sqltree);
- $adirwascreated = 1;
- } else {
- dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
- }
- } else {
- $txt = "Parent of ".$dirdesc['fullname']." not found";
- dol_syslog($txt);
- //print $txt."
\n";
- }
- }
- }
-
- // Loop now on each sql tree to check if dir exists
- foreach ($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
- {
- $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
+ dol_syslog("No");
+ //print "No
\n";
+ }
+ }
+ else
+ {
+ dol_syslog("Parent is root");
+ $fk_parent = 0; // Parent is root
+ }
+
+ if ($fk_parent >= 0)
+ {
+ $ecmdirtmp->ref = 'NOTUSEDYET';
+ $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
+ $ecmdirtmp->description = '';
+ $ecmdirtmp->fk_parent = $fk_parent;
+
+ $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
+ dol_syslog($txt);
+ //print $ecmdirtmp->cachenbofdoc."
\n";exit;
+ $id = $ecmdirtmp->create($user);
+ if ($id > 0)
+ {
+ $newdirsql = array('id'=>$id,
+ 'id_mere'=>$ecmdirtmp->fk_parent,
+ 'label'=>$ecmdirtmp->label,
+ 'description'=>$ecmdirtmp->description,
+ 'fullrelativename'=>$relativepathmissing);
+ $sqltree[] = $newdirsql; // We complete fulltree for following loops
+ //var_dump($sqltree);
+ $adirwascreated = 1;
+ }
+ else
+ {
+ dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
+ }
+ }
+ else {
+ $txt = "Parent of ".$dirdesc['fullname']." not found";
+ dol_syslog($txt);
+ //print $txt."
\n";
+ }
+ }
+ }
+
+ // Loop now on each sql tree to check if dir exists
+ foreach ($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
+ {
+ $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
if (!dol_is_dir($dirtotest))
{
$ecmdirtmp->id = $dirdesc['id'];
$ecmdirtmp->delete($user, 'databaseonly');
//exit;
}
- }
-
- $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
- dol_syslog("sql = ".$sql);
- $db->query($sql);
-
- // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
- // it to be sure that fulltree array is not used without reloading it.
- if ($adirwascreated) $sqltree = null;
+ }
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
+ dol_syslog("sql = ".$sql);
+ $db->query($sql);
+
+ // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
+ // it to be sure that fulltree array is not used without reloading it.
+ if ($adirwascreated) $sqltree = null;
}
@@ -327,7 +340,7 @@
llxHeader($moreheadcss.$moreheadjs, $langs->trans("ECMArea"), '', '', '', '', $morejs, '', 0, 0);
$head = ecm_prepare_dasboard_head('');
-print dol_get_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), -1, '');
+dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), -1, '');
// Add filemanager component
@@ -335,7 +348,7 @@
include DOL_DOCUMENT_ROOT.'/core/tpl/filemanager.tpl.php';
// End of page
-print dol_get_fiche_end();
+dol_fiche_end();
llxFooter();
--- /tmp/dsg/dolibarr/htdocs/ecm/github_index_auto.php
+++ /tmp/dsg/dolibarr/htdocs/ecm/client_index_auto.php
@@ -102,7 +102,9 @@
{
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
- } else {
+ }
+ else
+ {
setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors');
$action = "create";
}
@@ -113,30 +115,31 @@
// Remove file
if ($action == 'confirm_deletefile')
{
- if (GETPOST('confirm') == 'yes')
- {
- $langs->load("other");
- if ($section)
- {
- $result = $ecmdir->fetch($section);
- if (!($result > 0))
- {
- dol_print_error($db, $ecmdir->error);
- exit;
- }
- $relativepath = $ecmdir->getRelativePath();
- } else $relativepath = '';
- $upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
- $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
-
- $ret = dol_delete_file($file);
- if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
- else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
-
- $result = $ecmdir->changeNbOfFiles('-');
-
- clearstatcache();
- }
+ if (GETPOST('confirm') == 'yes')
+ {
+ $langs->load("other");
+ if ($section)
+ {
+ $result = $ecmdir->fetch($section);
+ if (!($result > 0))
+ {
+ dol_print_error($db, $ecmdir->error);
+ exit;
+ }
+ $relativepath = $ecmdir->getRelativePath();
+ }
+ else $relativepath = '';
+ $upload_dir = $conf->ecm->dir_output.($relativepath ? '/'.$relativepath : '');
+ $file = $upload_dir."/".GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_POST are already decoded by PHP).
+
+ $ret = dol_delete_file($file);
+ if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
+ else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
+
+ $result = $ecmdir->changeNbOfFiles('-');
+
+ clearstatcache();
+ }
$action = 'file_manager';
}
@@ -146,7 +149,7 @@
$result = $ecmdir->delete($user);
setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs');
- clearstatcache();
+ clearstatcache();
}
// Refresh directory view
@@ -154,130 +157,137 @@
// To refresh content of dir with cache, just open the dir in edit mode.
if ($action == 'refreshmanual')
{
- $ecmdirtmp = new EcmDirectory($db);
+ $ecmdirtmp = new EcmDirectory($db);
// This part of code is same than into file ecm/ajax/ecmdatabase.php TODO Remove duplicate
clearstatcache();
- $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
- $diroutputslash .= '/';
-
- // Scan directory tree on disk
- $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
-
- // Scan directory tree in database
- $sqltree = $ecmdirstatic->get_full_arbo(0);
-
- $adirwascreated = 0;
-
- // Now we compare both trees to complete missing trees into database
- //var_dump($disktree);
- //var_dump($sqltree);
- foreach ($disktree as $dirdesc) // Loop on tree onto disk
- {
- $dirisindatabase = 0;
- foreach ($sqltree as $dirsqldesc)
- {
- if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname'])
- {
- $dirisindatabase = 1;
- break;
- }
- }
-
- if (!$dirisindatabase)
- {
- $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
- dol_syslog($txt);
- //print $txt."
\n";
-
- // We must first find the fk_parent of directory to create $dirdesc['fullname']
- $fk_parent = -1;
- $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
- $relativepathtosearchparent = $relativepathmissing;
- //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
- if (preg_match('/\//', $relativepathtosearchparent))
- //while (preg_match('/\//',$relativepathtosearchparent))
- {
- $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
- $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
- dol_syslog($txt);
- //print $txt." -> ";
- $parentdirisindatabase = 0;
- foreach ($sqltree as $dirsqldesc)
+ $diroutputslash = str_replace('\\', '/', $conf->ecm->dir_output);
+ $diroutputslash .= '/';
+
+ // Scan directory tree on disk
+ $disktree = dol_dir_list($conf->ecm->dir_output, 'directories', 1, '', '^temp$', '', '', 0);
+
+ // Scan directory tree in database
+ $sqltree = $ecmdirstatic->get_full_arbo(0);
+
+ $adirwascreated = 0;
+
+ // Now we compare both trees to complete missing trees into database
+ //var_dump($disktree);
+ //var_dump($sqltree);
+ foreach ($disktree as $dirdesc) // Loop on tree onto disk
+ {
+ $dirisindatabase = 0;
+ foreach ($sqltree as $dirsqldesc)
+ {
+ if ($conf->ecm->dir_output.'/'.$dirsqldesc['fullrelativename'] == $dirdesc['fullname'])
+ {
+ $dirisindatabase = 1;
+ break;
+ }
+ }
+
+ if (!$dirisindatabase)
+ {
+ $txt = "Directory found on disk ".$dirdesc['fullname'].", not found into database so we add it";
+ dol_syslog($txt);
+ //print $txt."
\n";
+
+ // We must first find the fk_parent of directory to create $dirdesc['fullname']
+ $fk_parent = -1;
+ $relativepathmissing = str_replace($diroutputslash, '', $dirdesc['fullname']);
+ $relativepathtosearchparent = $relativepathmissing;
+ //dol_syslog("Try to find parent id for directory ".$relativepathtosearchparent);
+ if (preg_match('/\//', $relativepathtosearchparent))
+ //while (preg_match('/\//',$relativepathtosearchparent))
+ {
+ $relativepathtosearchparent = preg_replace('/\/[^\/]*$/', '', $relativepathtosearchparent);
+ $txt = "Is relative parent path ".$relativepathtosearchparent." for ".$relativepathmissing." found in sql tree ?";
+ dol_syslog($txt);
+ //print $txt." -> ";
+ $parentdirisindatabase = 0;
+ foreach ($sqltree as $dirsqldesc)
+ {
+ if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent)
+ {
+ $parentdirisindatabase = $dirsqldesc['id'];
+ break;
+ }
+ }
+ if ($parentdirisindatabase > 0)
+ {
+ dol_syslog("Yes with id ".$parentdirisindatabase);
+ //print "Yes with id ".$parentdirisindatabase."
\n";
+ $fk_parent = $parentdirisindatabase;
+ //break; // We found parent, we can stop the while loop
+ }
+ else
{
- if ($dirsqldesc['fullrelativename'] == $relativepathtosearchparent)
- {
- $parentdirisindatabase = $dirsqldesc['id'];
- break;
- }
- }
- if ($parentdirisindatabase > 0)
- {
- dol_syslog("Yes with id ".$parentdirisindatabase);
- //print "Yes with id ".$parentdirisindatabase."
\n";
- $fk_parent = $parentdirisindatabase;
- //break; // We found parent, we can stop the while loop
- } else {
- dol_syslog("No");
- //print "No
\n";
- }
- } else {
- dol_syslog("Parent is root");
- $fk_parent = 0; // Parent is root
- }
-
- if ($fk_parent >= 0)
- {
- $ecmdirtmp->ref = 'NOTUSEDYET';
- $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
- $ecmdirtmp->description = '';
- $ecmdirtmp->fk_parent = $fk_parent;
-
- $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
- dol_syslog($txt);
- //print $ecmdirtmp->cachenbofdoc."
\n";exit;
- $id = $ecmdirtmp->create($user);
- if ($id > 0)
- {
- $newdirsql = array('id'=>$id,
- 'id_mere'=>$ecmdirtmp->fk_parent,
- 'label'=>$ecmdirtmp->label,
- 'description'=>$ecmdirtmp->description,
- 'fullrelativename'=>$relativepathmissing);
- $sqltree[] = $newdirsql; // We complete fulltree for following loops
- //var_dump($sqltree);
- $adirwascreated = 1;
- } else {
- dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
- }
- } else {
- $txt = "Parent of ".$dirdesc['fullname']." not found";
- dol_syslog($txt);
- //print $txt."
\n";
- }
- }
- }
-
- // Loop now on each sql tree to check if dir exists
- foreach ($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
- {
- $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
+ dol_syslog("No");
+ //print "No
\n";
+ }
+ }
+ else
+ {
+ dol_syslog("Parent is root");
+ $fk_parent = 0; // Parent is root
+ }
+
+ if ($fk_parent >= 0)
+ {
+ $ecmdirtmp->ref = 'NOTUSEDYET';
+ $ecmdirtmp->label = dol_basename($dirdesc['fullname']);
+ $ecmdirtmp->description = '';
+ $ecmdirtmp->fk_parent = $fk_parent;
+
+ $txt = "We create directory ".$ecmdirtmp->label." with parent ".$fk_parent;
+ dol_syslog($txt);
+ //print $ecmdirtmp->cachenbofdoc."
\n";exit;
+ $id = $ecmdirtmp->create($user);
+ if ($id > 0)
+ {
+ $newdirsql = array('id'=>$id,
+ 'id_mere'=>$ecmdirtmp->fk_parent,
+ 'label'=>$ecmdirtmp->label,
+ 'description'=>$ecmdirtmp->description,
+ 'fullrelativename'=>$relativepathmissing);
+ $sqltree[] = $newdirsql; // We complete fulltree for following loops
+ //var_dump($sqltree);
+ $adirwascreated = 1;
+ }
+ else
+ {
+ dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR);
+ }
+ }
+ else {
+ $txt = "Parent of ".$dirdesc['fullname']." not found";
+ dol_syslog($txt);
+ //print $txt."
\n";
+ }
+ }
+ }
+
+ // Loop now on each sql tree to check if dir exists
+ foreach ($sqltree as $dirdesc) // Loop on each sqltree to check dir is on disk
+ {
+ $dirtotest = $conf->ecm->dir_output.'/'.$dirdesc['fullrelativename'];
if (!dol_is_dir($dirtotest))
{
$ecmdirtmp->id = $dirdesc['id'];
$ecmdirtmp->delete($user, 'databaseonly');
//exit;
}
- }
-
- $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
- dol_syslog("sql = ".$sql);
- $db->query($sql);
-
- // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
- // it to be sure that fulltree array is not used without reloading it.
- if ($adirwascreated) $sqltree = null;
+ }
+
+ $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories set cachenbofdoc = -1 WHERE cachenbofdoc < 0"; // If pb into cahce counting, we set to value -1 = "unknown"
+ dol_syslog("sql = ".$sql);
+ $db->query($sql);
+
+ // If a directory was added, the fulltree array is not correctly completed and sorted, so we clean
+ // it to be sure that fulltree array is not used without reloading it.
+ if ($adirwascreated) $sqltree = null;
}
@@ -310,27 +320,25 @@
if (!empty($conf->global->ECM_AUTO_TREE_ENABLED))
{
if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $langs->load("products"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'product', 'test'=>(!empty($conf->product->enabled) || !empty($conf->service->enabled)), 'label'=>$langs->trans("ProductsAndServices"), 'desc'=>$langs->trans("ECMDocsByProducts")); }
- if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ThirdParties"))); }
- if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Proposals"))); }
- if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Contracts"))); }
- if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Orders"))); }
- if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Invoices"))); }
- if (!empty($conf->supplier_proposal->enabled)) { $langs->load("supplier_proposal"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierProposals"))); }
- if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders"))); }
- if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices"))); }
- if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions"))); }
- if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects"))); }
- if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Interventions"))); }
- if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ExpenseReports"))); }
- if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Holidays"))); }
- if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount"))); }
- if (!empty($conf->mrp->enabled)) { $langs->load("mrp"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'mrp-mo', 'test'=>$conf->mrp->enabled, 'label'=>$langs->trans("MOs"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("ManufacturingOrders"))); }
- if (!empty($conf->recruitment->enabled)) { $langs->load("recruitment"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'recruitment-recruitmentcandidature', 'test'=>$conf->recruitment->enabled, 'label'=>$langs->trans("Candidatures"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("JobApplications"))); }
- $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
+ if (!empty($conf->societe->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'company', 'test'=>$conf->societe->enabled, 'label'=>$langs->trans("ThirdParties"), 'desc'=>$langs->trans("ECMDocsByThirdParties")); }
+ if (!empty($conf->propal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'propal', 'test'=>$conf->propal->enabled, 'label'=>$langs->trans("Proposals"), 'desc'=>$langs->trans("ECMDocsByProposals")); }
+ if (!empty($conf->contrat->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'contract', 'test'=>$conf->contrat->enabled, 'label'=>$langs->trans("Contracts"), 'desc'=>$langs->trans("ECMDocsByContracts")); }
+ if (!empty($conf->commande->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order', 'test'=>$conf->commande->enabled, 'label'=>$langs->trans("CustomersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
+ if (!empty($conf->facture->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice', 'test'=>$conf->facture->enabled, 'label'=>$langs->trans("CustomersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
+ if (!empty($conf->supplier_proposal->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'supplier_proposal', 'test'=>$conf->supplier_proposal->enabled, 'label'=>$langs->trans("SupplierProposals"), 'desc'=>$langs->trans("ECMDocsBySupplierProposals")); }
+ if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsByOrders")); }
+ if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>$conf->fournisseur->enabled, 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsByInvoices")); }
+ if (!empty($conf->tax->enabled)) { $langs->load("compta"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBySocialContributions")); }
+ if (!empty($conf->projet->enabled)) { $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsByProjects")); }
+ if (!empty($conf->ficheinter->enabled)) { $langs->load("interventions"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'fichinter', 'test'=>$conf->ficheinter->enabled, 'label'=>$langs->trans("Interventions"), 'desc'=>$langs->trans("ECMDocsByInterventions")); }
+ if (!empty($conf->expensereport->enabled)) { $langs->load("trips"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'expensereport', 'test'=>$conf->expensereport->enabled, 'label'=>$langs->trans("ExpenseReports"), 'desc'=>$langs->trans("ECMDocsByExpenseReports")); }
+ if (!empty($conf->holiday->enabled)) { $langs->load("holiday"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'holiday', 'test'=>$conf->holiday->enabled, 'label'=>$langs->trans("Holidays"), 'desc'=>$langs->trans("ECMDocsByHolidays")); }
+ if (!empty($conf->banque->enabled)) { $langs->load("banks"); $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsByBankAccount")); }
+ $rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsByUsers"));
}
$head = ecm_prepare_dasboard_head('');
-print dol_get_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), -1, '');
+dol_fiche_head($head, 'index_auto', $langs->trans("ECMArea").' - '.$langs->trans("ECMFileManager"), -1, '');
@@ -352,7 +360,7 @@
// Toolbar
$url = ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) ? '#' : ($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module ? '&module='.$module : '').($section ? '§ion='.$section : '')));
-print '
';
+print '';
print '
';
print '';
@@ -369,7 +377,7 @@
// Confirmation de la suppression d'une ligne categorie
if ($action == 'delete_section')
{
- print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);
}
// End confirm
@@ -380,12 +388,12 @@
print ''."\n";
print '
'."\n";
- print '';
- print ' '.$langs->trans("ECMSections");
+ print ' | ';
+ print ' '.$langs->trans("ECMSections");
print ' |
';
- $showonrightsize = '';
- // Auto section
+ $showonrightsize = '';
+ // Auto section
if (count($sectionauto))
{
$htmltooltip = $langs->trans("ECMAreaDesc2");
@@ -393,8 +401,8 @@
$sectionauto = dol_sort_array($sectionauto, 'label', 'ASC', true, false);
print '
';
- print '';
- print '';
+ print '';
+ print '';
$nbofentries = 0;
$oldvallevel = 0;
@@ -404,32 +412,34 @@
$var = false;
- print '- ';
+ print '
- ';
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
{
- print '';
- print $val['label'];
- print '';
- } else {
- print '';
- print $val['label'];
- print '';
+ print '';
+ print $val['label'];
+ print '';
}
-
- print '
';
- // Info
- $htmltooltip = ''.$langs->trans("ECMSection").': '.$val['label'].' ';
- $htmltooltip = ''.$langs->trans("Type").': '.$langs->trans("ECMSectionAuto").' ';
- $htmltooltip .= ''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto").' ';
- $htmltooltip .= ''.$langs->trans("Description").': '.$val['desc'];
- print $form->textwithpicto('', $htmltooltip, 1, 'info');
- print ' ';
- print ' ';
-
- $nbofentries++;
+ else
+ {
+ print '';
+ print $val['label'];
+ print '';
+ }
+
+ print '';
+ // Info
+ $htmltooltip = ''.$langs->trans("ECMSection").': '.$val['label'].' ';
+ $htmltooltip = ''.$langs->trans("Type").': '.$langs->trans("ECMSectionAuto").' ';
+ $htmltooltip .= ''.$langs->trans("ECMCreationUser").': '.$langs->trans("ECMTypeAuto").' ';
+ $htmltooltip .= ''.$langs->trans("Description").': '.$val['desc'];
+ print $form->textwithpicto('', $htmltooltip, 1, 'info');
+ print ' ';
+ print '';
+
+ $nbofentries++;
}
- print ' | |
';
+ print '
';
}
print "