mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-09 02:58:23 +01:00
WIP Dir statement in ECM
This commit is contained in:
@@ -233,6 +233,7 @@ if ($type == 'directory') {
|
||||
'holiday',
|
||||
'recruitment-recruitmentcandidature',
|
||||
'banque',
|
||||
'bank-statement',
|
||||
'chequereceipt',
|
||||
'mrp-mo'
|
||||
);
|
||||
@@ -286,6 +287,8 @@ if ($type == 'directory') {
|
||||
$upload_dir = $conf->recruitment->dir_output.'/recruitmentcandidature';
|
||||
} elseif ($module == 'banque') {
|
||||
$upload_dir = $conf->bank->dir_output;
|
||||
} elseif ($module == 'bank-statement') {
|
||||
$upload_dir = $conf->bank->dir_output.'/*/statement';
|
||||
} elseif ($module == 'chequereceipt') {
|
||||
$upload_dir = $conf->bank->dir_output.'/checkdeposits';
|
||||
} elseif ($module == 'mrp-mo') {
|
||||
@@ -300,7 +303,7 @@ if ($type == 'directory') {
|
||||
|
||||
// Automatic list
|
||||
if (in_array($module, $automodules)) {
|
||||
$param .= '&module='.$module;
|
||||
$param .= '&module='.urlencode($module);
|
||||
if (isset($search_doc_ref) && $search_doc_ref != '') {
|
||||
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
|
||||
}
|
||||
@@ -309,6 +312,7 @@ if ($type == 'directory') {
|
||||
|
||||
$filter = preg_quote((string) $search_doc_ref, '/');
|
||||
$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);
|
||||
//var_dump($filearray);
|
||||
|
||||
// To allow external users,we must restrict $filearray to entries the user is a thirdparty.
|
||||
// This can be done by filtering on entries found into llx_ecm
|
||||
|
||||
@@ -1837,7 +1837,7 @@ class FormFile
|
||||
}
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table width="100%" class="noborder">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
|
||||
if (!empty($addfilterfields)) {
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
@@ -1927,6 +1927,9 @@ class FormFile
|
||||
} elseif ($modulepart == 'banque') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$object_instance = new Account($this->db);
|
||||
} elseif ($modulepart == 'bank-statement') {
|
||||
//include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
$object_instance = null;
|
||||
} elseif ($modulepart == 'chequereceipt') {
|
||||
include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
|
||||
$object_instance = new RemiseCheque($this->db);
|
||||
|
||||
@@ -62,7 +62,7 @@ function dol_basename($pathfile)
|
||||
*/
|
||||
function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "", $excludefilter = null, $sortcriteria = "name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename = "", $donotfollowsymlinks = 0, $nbsecondsold = 0)
|
||||
{
|
||||
global $db, $hookmanager;
|
||||
global $hookmanager;
|
||||
global $object;
|
||||
|
||||
if ($recursive <= 1) { // Avoid too verbose log
|
||||
@@ -97,14 +97,22 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
||||
$loadsize = ($mode == 1 || $mode == 3 || $sortcriteria == 'size');
|
||||
$loadperm = ($mode == 1 || $mode == 4 || $sortcriteria == 'perm');
|
||||
|
||||
// Clean parameters
|
||||
$utf8_path = preg_replace('/([\\/]+)$/', '', $utf8_path);
|
||||
$os_path = dol_osencode($utf8_path);
|
||||
$now = dol_now();
|
||||
|
||||
$reshook = 0;
|
||||
$file_list = array();
|
||||
|
||||
// Clean parameters
|
||||
$utf8_path = preg_replace('/([\\/]+)$/', '', $utf8_path);
|
||||
|
||||
if (preg_match('/\*/', $utf8_path)) {
|
||||
$utf8_path_array = glob($utf8_path, GLOB_ONLYDIR); // This scan dir for files. If file does not exists, return empty.
|
||||
//$os_path_array = dol_dir_list($utf8_path);
|
||||
} else {
|
||||
$utf8_path_array = array($utf8_path);
|
||||
}
|
||||
|
||||
foreach ($utf8_path_array as $utf8_path_cursor) {
|
||||
$os_path = dol_osencode($utf8_path_cursor);
|
||||
if (!$nohook && $hookmanager instanceof HookManager) {
|
||||
$hookmanager->resArray = array();
|
||||
|
||||
@@ -128,12 +136,13 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
||||
// $hookmanager->resArray may contain array stacked by other modules
|
||||
if (empty($reshook)) {
|
||||
if (!is_dir($os_path)) {
|
||||
return array();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($dir = opendir($os_path)) === false) {
|
||||
return array();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filedate = '';
|
||||
$filesize = '';
|
||||
$fileperm = '';
|
||||
@@ -149,7 +158,7 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
||||
|
||||
$qualified = 1;
|
||||
|
||||
$utf8_fullpathfile = "$utf8_path/$utf8_file"; // Temp variable for speed
|
||||
$utf8_fullpathfile = $utf8_path_cursor."/".$utf8_file; // Temp variable for speed
|
||||
|
||||
// Check if file is qualified
|
||||
foreach ($excludefilterarray as $filt) {
|
||||
@@ -230,13 +239,13 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
}
|
||||
|
||||
// Obtain a list of columns
|
||||
if (!empty($sortcriteria) && $sortorder) {
|
||||
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($hookmanager instanceof HookManager && is_array($hookmanager->resArray)) {
|
||||
$file_list = array_merge($file_list, $hookmanager->resArray);
|
||||
@@ -250,7 +259,7 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
|
||||
* Scan a directory and return a list of files/directories.
|
||||
* Content for string is UTF8 and dir separator is "/".
|
||||
*
|
||||
* @param string $path Starting path from which to search. Example: 'produit/MYPROD'
|
||||
* @param string $path Starting path from which to search. Example: 'produit/MYPROD' or 'produit/%'
|
||||
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
|
||||
* @param string[]|null $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.'))
|
||||
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
|
||||
@@ -272,9 +281,9 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
|
||||
$sql .= ", description";
|
||||
}
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
|
||||
$sql .= " WHERE entity = ".$conf->entity;
|
||||
$sql .= " WHERE entity = ".((int) $conf->entity);
|
||||
if (preg_match('/%$/', $path)) {
|
||||
$sql .= " AND filepath LIKE '".$db->escape($path)."'";
|
||||
$sql .= " AND (filepath LIKE '".$db->escape($path)."' OR filepath = '".$db->escape(preg_replace('/\/%$/', '', $path))."')";
|
||||
} else {
|
||||
$sql .= " AND filepath = '".$db->escape($path)."'";
|
||||
}
|
||||
@@ -3577,7 +3586,6 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
||||
if ($fuser->hasRight($tmpmodule, $read) || preg_match('/^specimen/i', $original_file)) {
|
||||
$accessallowed = 1;
|
||||
}
|
||||
|
||||
$original_file = $conf->$tmpmodule->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file;
|
||||
} else {
|
||||
if (empty($conf->$modulepart->dir_output)) { // modulepart not supported
|
||||
|
||||
@@ -393,6 +393,9 @@ if (!getDolGlobalString('ECM_AUTO_TREE_HIDEN')) {
|
||||
$langs->load("banks");
|
||||
$rowspan++;
|
||||
$sectionauto[] = array('position' => 180, 'level' => 1, 'module' => 'banque', 'test' => isModEnabled('bank'), 'label' => $langs->trans("BankAccount"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
|
||||
// TODO Enable this
|
||||
//$rowspan++;
|
||||
//$sectionauto[] = array('position' => 182, 'level' => 1, 'module' => 'bank-statement', 'test' => isModEnabled('bank'), 'label' => $langs->trans("BankAccount").' - '.$langs->trans("Statement"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount").' - '.$langs->transnoentitiesnoconv("Statement")));
|
||||
$rowspan++;
|
||||
$sectionauto[] = array('position' => 190, 'level' => 1, 'module' => 'chequereceipt', 'test' => isModEnabled('bank'), 'label' => $langs->trans("CheckReceipt"), 'desc' => $langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user