forked from Wavyzz/dolibarr
FIX ECM module was mixing contributions and vat and not showing salaries
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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') {
|
||||
|
||||
@@ -310,59 +310,73 @@ $rowspan = 0;
|
||||
$sectionauto = array();
|
||||
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"));
|
||||
$langs->load("products");
|
||||
$rowspan++; $sectionauto[] = array('position'=>10, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>20, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>30, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>40, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>50, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>60, '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")));
|
||||
$langs->load("supplier_proposal");
|
||||
$rowspan++; $sectionauto[] = array('position'=>70, '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) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>80, 'level'=>1, 'module'=>'order_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled)), 'label'=>$langs->trans("SuppliersOrders"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("PurchaseOrders")));
|
||||
}
|
||||
if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)) {
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->enabled)), 'label'=>$langs->trans("SuppliersInvoices"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SupplierInvoices")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>90, 'level'=>1, 'module'=>'invoice_supplier', 'test'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_invoice->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")));
|
||||
$langs->load("compta");
|
||||
$rowspan++; $sectionauto[] = array('position'=>100, 'level'=>1, 'module'=>'tax', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("SocialContributions"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("SocialContributions")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>110, 'level'=>1, 'module'=>'tax-vat', 'test'=>$conf->tax->enabled, 'label'=>$langs->trans("VAT"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("VAT")));
|
||||
}
|
||||
if (!empty($conf->salaries->enabled)) {
|
||||
$langs->load("compta");
|
||||
$rowspan++; $sectionauto[] = array('position'=>120, 'level'=>1, 'module'=>'salaries', 'test'=>$conf->salaries->enabled, 'label'=>$langs->trans("Salaries"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Salaries")));
|
||||
}
|
||||
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")));
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>130, 'level'=>1, 'module'=>'project', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Projects"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Projects")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>140, 'level'=>1, 'module'=>'project_task', 'test'=>$conf->projet->enabled, 'label'=>$langs->trans("Tasks"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Tasks")));
|
||||
}
|
||||
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")));
|
||||
$langs->load("interventions");
|
||||
$rowspan++; $sectionauto[] = array('position'=>150, '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")));
|
||||
$langs->load("trips");
|
||||
$rowspan++; $sectionauto[] = array('position'=>160, '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")));
|
||||
$langs->load("holiday");
|
||||
$rowspan++; $sectionauto[] = array('position'=>170, '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")));
|
||||
$rowspan++; $sectionauto[] = array('level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
|
||||
$langs->load("banks");
|
||||
$rowspan++; $sectionauto[] = array('position'=>180, 'level'=>1, 'module'=>'banque', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("BankAccount"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("BankAccount")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>190, 'level'=>1, 'module'=>'chequereceipt', 'test'=>$conf->banque->enabled, 'label'=>$langs->trans("CheckReceipt"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("CheckReceipt")));
|
||||
}
|
||||
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")));
|
||||
$langs->load("mrp");
|
||||
$rowspan++; $sectionauto[] = array('position'=>200, '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")));
|
||||
$langs->load("recruitment");
|
||||
$rowspan++; $sectionauto[] = array('position'=>210, '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")));
|
||||
$rowspan++; $sectionauto[] = array('position'=>220, 'level'=>1, 'module'=>'user', 'test'=>1, 'label'=>$langs->trans("Users"), 'desc'=>$langs->trans("ECMDocsBy", $langs->transnoentitiesnoconv("Users")));
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters);
|
||||
@@ -439,7 +453,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act
|
||||
$oldvallevel = 0;
|
||||
foreach ($sectionauto as $key => $val) {
|
||||
if (empty($val['test'])) {
|
||||
continue; // If condition to show is ok
|
||||
continue; // If condition to show the ECM auto directory is ok
|
||||
}
|
||||
|
||||
print '<li class="directory collapsed">';
|
||||
@@ -482,7 +496,6 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act
|
||||
<?php
|
||||
// Start right panel
|
||||
|
||||
|
||||
$mode = 'noajax';
|
||||
$url = DOL_URL_ROOT.'/ecm/index_auto.php';
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php';
|
||||
|
||||
Reference in New Issue
Block a user