diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php
index 36e8546a897..02c3b331544 100644
--- a/htdocs/compta/bank/various_payment/document.php
+++ b/htdocs/compta/bank/various_payment/document.php
@@ -57,7 +57,7 @@ if (! $sortfield) $sortfield="name";
$object = new PaymentVarious($db);
$object->fetch($id, $ref);
-$upload_dir = $conf->banque->dir_output.'/'.dol_sanitizeFileName($object->id);
+$upload_dir = $conf->bank->dir_output.'/'.dol_sanitizeFileName($object->id);
$modulepart='banque';
diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 4490d7bff3c..538b398296d 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -179,7 +179,7 @@ if ($type == 'directory')
$sorting = (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC);
// Right area. If module is defined here, we are in automatic ecm.
- $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday');
+ $automodules = array('company', 'invoice', 'invoice_supplier', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'tax', 'project', 'fichinter', 'user', 'expensereport', 'holiday', 'banque');
// TODO change for multicompany sharing
// Auto area for suppliers invoices
@@ -212,12 +212,14 @@ if ($type == 'directory')
elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
// Auto area for holiday
elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output;
+ // Auto area for holiday
+ elseif ($module == 'banque') $upload_dir = $conf->bank->dir_output;
// Automatic list
if (in_array($module, $automodules))
{
$param.='&module='.$module;
- if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.$search_doc_ref;
+ if (isset($search_doc_ref) && $search_doc_ref != '') $param.='&search_doc_ref='.urlencode($search_doc_ref);
$textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
@@ -335,8 +337,8 @@ if ($useajax || $action == 'delete')
$formquestion['section_id']=array('type'=>'hidden','value'=>$section_id,'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later
$formquestion['section_dir']=array('type'=>'hidden','value'=>$section_dir,'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later
if (! empty($action) && $action == 'file_manager') $formquestion['file_manager']=array('type'=>'hidden','value'=>1,'name'=>'file_manager');
- if (! empty($websitekey)) $formquestion['website']=array('type'=>'hidden','value'=>$websitekey,'name'=>'website');
- if (! empty($pageid) && $pageid > 0) $formquestion['pageid']=array('type'=>'hidden','value'=>$pageid,'name'=>'pageid');
+ if (! empty($websitekey)) $formquestion['website'] =array('type'=>'hidden','value'=>$websitekey,'name'=>'website');
+ if (! empty($pageid) && $pageid > 0) $formquestion['pageid'] =array('type'=>'hidden','value'=>$pageid,'name'=>'pageid');
print $form->formconfirm($url, $langs->trans("DeleteFile"), $langs->trans("ConfirmDeleteFile"), 'confirm_deletefile', $formquestion, "no", ($useajax?'deletefile':0));
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index ccf5c9de6b2..d161f32d92a 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1464,7 +1464,7 @@ class FormFile
print '
| ';
print ' | ';
// Action column
- print '';
+ print ' | ';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print ' | ';
@@ -1474,10 +1474,10 @@ class FormFile
print '';
$sortref="fullname";
if ($modulepart == 'invoice_supplier') $sortref='level1name';
- print_liste_field_titre("Ref", $url, $sortref, "", $param, 'class="left"', $sortfield, $sortorder);
- print_liste_field_titre("Documents2", $url, "name", "", $param, 'class="left"', $sortfield, $sortorder);
- print_liste_field_titre("Size", $url, "size", "", $param, 'class="right"', $sortfield, $sortorder);
- print_liste_field_titre("Date", $url, "date", "", $param, 'class="center"', $sortfield, $sortorder);
+ print_liste_field_titre("Ref", $url, $sortref, "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("Documents2", $url, "name", "", $param, '', $sortfield, $sortorder);
+ print_liste_field_titre("Size", $url, "size", "", $param, '', $sortfield, $sortorder, 'right ');
+ print_liste_field_titre("Date", $url, "date", "", $param, '', $sortfield, $sortorder, 'center ');
print_liste_field_titre('', '', '');
print '
'."\n";
@@ -1557,6 +1557,11 @@ class FormFile
include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
$object_instance=new Holiday($this->db);
}
+ elseif ($modulepart == 'banque')
+ {
+ include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
+ $object_instance=new Account($this->db);
+ }
foreach($filearray as $key => $file)
{
@@ -1569,17 +1574,20 @@ class FormFile
// Define relative path used to store the file
$relativefile=preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']);
- //var_dump($file);
$id=0; $ref=''; $label='';
// To show ref or specific information according to view to show (defined by $module)
if ($modulepart == 'company' || $modulepart == 'tax') { preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
elseif ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
elseif ($modulepart == 'user' || $modulepart == 'holiday') { preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id=(isset($reg[1])?$reg[1]:''); }
- elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport')))
+ elseif (in_array($modulepart, array('invoice', 'propal', 'supplier_proposal', 'order', 'order_supplier', 'contract', 'product', 'project', 'fichinter', 'expensereport', 'banque')))
{
preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref=(isset($reg[1])?$reg[1]:'');
}
+ else
+ {
+ //print 'Error: Value for modulepart = '.$modulepart.' is not yet implemented in function list_of_autoecmfiles'."\n";
+ }
if (! $id && ! $ref) continue;
$found=0;
@@ -1597,13 +1605,13 @@ class FormFile
//fetchOneLike looks for objects with wildcards in its reference.
//It is useful for those masks who get underscores instead of their actual symbols
//fetchOneLike requires some info in the object. If it doesn't have it, then 0 is returned
- //that's why we look only look fetchOneLike when fetch returns 0
+ //that's why we look only into fetchOneLike when fetch returns 0
if (!$result = $object_instance->fetch('', $ref)) {
$result = $object_instance->fetchOneLike($ref);
}
}
- if ($result > 0) { // Save object into a cache
+ if ($result > 0) { // Save object loaded into a cache
$found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance;
}
if ($result == 0) { $found=1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]='notfound'; unset($filearray[$key]); }
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index 6985c421062..f117bc24daf 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -182,7 +182,7 @@ function various_payment_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
- $upload_dir = $conf->banque->dir_output . "/" . dol_sanitizeFileName($object->ref);
+ $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
$nbLinks=Link::count($db, $object->element, $object->id);
$head[$h][0] = DOL_URL_ROOT.'/compta/bank/various_payment/document.php?id='.$object->id;
diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index dd96cfdb31f..e00f79b27bc 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -2701,7 +2701,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
// Wrapping pour les remises de cheques
- elseif ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output))
+ elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output))
{
if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file))
{
@@ -2712,7 +2712,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
}
// Wrapping for bank
- elseif ($modulepart == 'bank' && !empty($conf->bank->dir_output))
+ elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output))
{
if ($fuser->rights->banque->{$lire})
{
diff --git a/htdocs/document.php b/htdocs/document.php
index e784949c042..57897786f0d 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -169,6 +169,7 @@ $refname=basename(dirname($original_file)."/");
// Security check
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart');
+// Check security and set return info with full path of file
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
$accessallowed = $check_access['accessallowed'];
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php
index 5f43426ae63..f068eed1319 100644
--- a/htdocs/ecm/index_auto.php
+++ b/htdocs/ecm/index_auto.php
@@ -332,6 +332,7 @@ if (! empty($conf->global->ECM_AUTO_TREE_ENABLED))
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"));
}