2
0
forked from Wavyzz/dolibarr

FIX ECM module was mixing contributions and vat and not showing salaries

This commit is contained in:
Laurent Destailleur
2021-12-07 02:00:34 +01:00
parent ba507e7735
commit 5efa31204b
4 changed files with 53 additions and 29 deletions

View File

@@ -204,6 +204,8 @@ if ($type == 'directory') {
'contract',
'product',
'tax',
'tax-vat',
'salaries',
'project',
'project_task',
'fichinter',
@@ -225,6 +227,7 @@ if ($type == 'directory') {
// TODO change for multicompany sharing
if ($module == 'company') {
$upload_dir = $conf->societe->dir_output;
$excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts.
} elseif ($module == 'invoice') {
$upload_dir = $conf->facture->dir_output;
} elseif ($module == 'invoice_supplier') {
@@ -243,6 +246,11 @@ if ($type == 'directory') {
$upload_dir = $conf->product->dir_output;
} elseif ($module == 'tax') {
$upload_dir = $conf->tax->dir_output;
$excludefiles[] = '^vat$'; // The subdir 'vat' contains files of vats.
} elseif ($module == 'tax-vat') {
$upload_dir = $conf->tax->dir_output.'/vat';
} elseif ($module == 'salaries') {
$upload_dir = $conf->salaries->dir_output;
} elseif ($module == 'project') {
$upload_dir = $conf->projet->dir_output;
} elseif ($module == 'project_task') {
@@ -280,10 +288,6 @@ if ($type == 'directory') {
$textifempty = ($section ? $langs->trans("NoFileFound") : ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("NoFileFound")));
if ($module == 'company') {
$excludefiles[] = '^contact$'; // The subdir 'contact' contains files of contacts with no id of thirdparty.
}
$filter = preg_quote($search_doc_ref, '/');
$filearray = dol_dir_list($upload_dir, "files", 1, $filter, $excludefiles, $sortfield, $sorting, 1);

View File

@@ -125,7 +125,7 @@ $userstatic = new User($db);
$form = new Form($db);
$ecmdirstatic = new EcmDirectory($db);
// Load full tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
// Load full manual tree of ECM module from database. We will use it to define nbofsubdir and nboffilesinsubdir
if (empty($sqltree)) {
$sqltree = $ecmdirstatic->get_full_arbo(0);
}
@@ -169,7 +169,7 @@ if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_
if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_JS)) {
print '<ul class="ecmjqft">';
// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
// Load full manual tree from database. We will use it to define nbofsubdir and nboffilesinsubdir
if (empty($sqltree)) {
$sqltree = $ecmdirstatic->get_full_arbo(0); // Slow
}

View File

@@ -1676,6 +1676,12 @@ class FormFile
} elseif ($modulepart == 'tax') {
include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php';
$object_instance = new ChargeSociales($this->db);
} elseif ($modulepart == 'tax-vat') {
include_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php';
$object_instance = new Tva($this->db);
} elseif ($modulepart == 'salaries') {
include_once DOL_DOCUMENT_ROOT.'/salaries/class/salary.class.php';
$object_instance = new Salary($this->db);
} elseif ($modulepart == 'project') {
include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$object_instance = new Project($this->db);
@@ -1723,6 +1729,7 @@ class FormFile
}
//var_dump($filearray);
//var_dump($object_instance);
// Get list of files stored into database for same relative directory
$relativepathfromroot = preg_replace('/'.preg_quote(DOL_DATA_ROOT.'/', '/').'/', '', $upload_dir);
@@ -1752,7 +1759,7 @@ class FormFile
// To show ref or specific information according to view to show (defined by $modulepart)
// $modulepart can be $object->table_name (that is 'mymodule_myobject') or $object->element.'-'.$module (for compatibility purpose)
$reg = array();
if ($modulepart == 'company' || $modulepart == 'tax') {
if ($modulepart == 'company' || $modulepart == 'tax' || $modulepart == 'tax-vat' || $modulepart == 'salaries') {
preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg);
$id = (isset($reg[1]) ? $reg[1] : '');
} elseif ($modulepart == 'invoice_supplier') {