25 require
'../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/ecm.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmdirectory.class.php';
33 $langs->loadLangs(array(
"ecm",
"companies",
"other",
"users",
"orders",
"propal",
"bills",
"contracts"));
37 $socid = $user->socid;
42 $user->getrights(
'ecm');
45 $socid =
GETPOST(
'socid',
'int');
46 $action =
GETPOST(
'action',
'aZ09');
52 $module =
GETPOST(
'module',
'alpha');
53 $website =
GETPOST(
'website',
'alpha');
54 $pageid =
GETPOST(
'pageid',
'int');
59 $upload_dir = $conf->ecm->dir_output.
'/'.$section;
61 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
62 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
63 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
65 if (empty($page) || $page == -1) {
68 $offset = $limit * $page;
69 $pageprev = $page - 1;
70 $pagenext = $page + 1;
79 if (!empty($section)) {
80 $result = $ecmdir->fetch($section);
87 $permtoread = $user->rights->ecm->read;
110 $userstatic =
new User($db);
115 $sectionauto = array();
116 if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
117 $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"));
119 if (!empty($conf->societe->enabled)) {
120 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'company',
'test'=>$conf->societe->enabled,
'label'=>$langs->trans(
"ThirdParties"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ThirdParties")));
122 if (!empty($conf->propal->enabled)) {
123 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'propal',
'test'=>$conf->propal->enabled,
'label'=>$langs->trans(
"Proposals"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Proposals")));
125 if (!empty($conf->contrat->enabled)) {
126 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'contract',
'test'=>$conf->contrat->enabled,
'label'=>$langs->trans(
"Contracts"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Contracts")));
128 if (!empty($conf->commande->enabled)) {
129 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'order',
'test'=>$conf->commande->enabled,
'label'=>$langs->trans(
"CustomersOrders"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Orders")));
132 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'invoice',
'test'=>$conf->facture->enabled,
'label'=>$langs->trans(
"CustomersInvoices"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Invoices")));
134 if (!empty($conf->supplier_proposal->enabled)) {
135 $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")));
137 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_order->enabled)) {
138 $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")));
140 if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || !empty($conf->supplier_invoice->enabled)) {
141 $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")));
143 if (!empty($conf->tax->enabled)) {
144 $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")));
146 if (!empty($conf->project->enabled)) {
147 $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'project',
'test'=>$conf->project->enabled,
'label'=>$langs->trans(
"Projects"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Projects")));
149 if (!empty($conf->ficheinter->enabled)) {
150 $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")));
152 if (!empty($conf->expensereport->enabled)) {
153 $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")));
155 if (!empty($conf->holiday->enabled)) {
156 $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")));
158 if (!empty($conf->banque->enabled)) {
159 $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")));
161 if (!empty($conf->mrp->enabled)) {
162 $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")));
164 if (!empty($conf->recruitment->enabled)) {
165 $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")));
172 print
load_fiche_titre($langs->trans(
"ECMArea").
' - '.$langs->trans(
"Search"));
177 print $langs->trans(
"FeatureNotYetAvailable").
'.<br><br>';
184 print
'<table class="border centpercent"><tr><td width="40%" valign="top">';
191 print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
192 print
'<input type="hidden" name="token" value="'.newToken().
'">';
193 print
'<table class="nobordernopadding" width="100%">';
194 print
"<tr class=\"liste_titre\">";
195 print
'<td colspan="2">'.$langs->trans(
"ECMSearchByKeywords").
'</td></tr>';
196 print
'<tr class="impair"><td>'.$langs->trans(
"Ref").
':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
197 print
'<tr class="impair"><td>'.$langs->trans(
"Title").
':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
198 print
'<tr class="impair"><td>'.$langs->trans(
"Keyword").
':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
199 print
'<tr class="impair"><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
200 print
"</table></form>";
205 print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
206 print
'<input type="hidden" name="token" value="'.newToken().
'">';
207 print
'<table class="nobordernopadding" width="100%">';
208 print
"<tr class=\"liste_titre\">";
209 print
'<td colspan="4">'.$langs->trans(
"ECMSearchByEntity").
'</td></tr>';
211 $buthtml =
'<td rowspan="'.$rowspan.
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
213 foreach ($sectionauto as $sectioncur) {
214 if (!$sectioncur[
'test']) {
217 print
'<tr class="impair">';
218 print
"<td>".$sectioncur[
'label'].
':</td>';
220 print
' class="right"';
222 print
'<input type="text" name="search_'.$sectioncur[
'module'].
'" class="flat" size="14">';
228 print
'<tr '.$bc[
false].
'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
229 print
"</table></form>";
234 print
'</td><td class="tdtop">';
237 $relativepath = $ecmdir->getRelativePath();
238 $upload_dir = $conf->ecm->dir_output.
'/'.$relativepath;
239 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
242 $param =
'§ion='.urlencode($section);
243 $textifempty = ($section ? $langs->trans(
"NoFileFound") : $langs->trans(
"ECMSelectASection"));
244 $formfile->list_of_documents($filearray,
'',
'ecm', $param, 1, $relativepath, $user->rights->ecm->upload, 1, $textifempty);