NEW Add attached document on bank account visible in automatic ECM.
This commit is contained in:
parent
734b1ca7c1
commit
6da42941a8
@ -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';
|
||||
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -1464,7 +1464,7 @@ class FormFile
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="middle">';
|
||||
print '<td class="liste_titre center">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -1474,10 +1474,10 @@ class FormFile
|
||||
print '<tr class="liste_titre">';
|
||||
$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 '</tr>'."\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]); }
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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})
|
||||
{
|
||||
|
||||
@ -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'];
|
||||
|
||||
@ -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"));
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user