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"));
36 if ($user->socid) $socid = $user->socid;
40 $user->getrights(
'ecm');
43 $socid =
GETPOST(
'socid',
'int');
44 $action =
GETPOST(
'action',
'aZ09');
46 if (!$section) $section = 0;
48 $module =
GETPOST(
'module',
'alpha');
49 $website =
GETPOST(
'website',
'alpha');
50 $pageid =
GETPOST(
'pageid',
'int');
51 if (empty($module)) $module =
'ecm';
53 $upload_dir = $conf->ecm->dir_output.
'/'.$section;
55 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
56 $sortfield =
GETPOST(
"sortfield",
'alpha');
57 $sortorder =
GETPOST(
"sortorder",
'alpha');
59 if (empty($page) || $page == -1) { $page = 0; }
60 $offset = $limit * $page;
61 $pageprev = $page - 1;
62 $pagenext = $page + 1;
63 if (!$sortorder) $sortorder =
"ASC";
64 if (!$sortfield) $sortfield =
"label";
69 $result = $ecmdir->fetch($section);
92 $form =
new Form($db);
94 $userstatic =
new User($db);
99 $sectionauto = array();
100 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")); }
101 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"))); }
102 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"))); }
103 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"))); }
104 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"))); }
105 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"))); }
106 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"))); }
107 if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'order_supplier',
'test'=>$conf->fournisseur->enabled,
'label'=>$langs->trans(
"SuppliersOrders"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"PurchaseOrders"))); }
108 if (!empty($conf->fournisseur->enabled)) { $rowspan++; $sectionauto[] = array(
'level'=>1,
'module'=>
'invoice_supplier',
'test'=>$conf->fournisseur->enabled,
'label'=>$langs->trans(
"SuppliersInvoices"),
'desc'=>$langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SupplierInvoices"))); }
109 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"))); }
110 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"))); }
111 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"))); }
112 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"))); }
113 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"))); }
114 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"))); }
115 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"))); }
116 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"))); }
127 print $langs->trans(
"FeatureNotYetAvailable").
'.<br><br>';
134 print '<table class="border centpercent"><tr><td width="40%" valign="top">';
141 print '<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
142 print '<input type="hidden" name="token" value="'.newToken().
'">';
143 print '<table class="nobordernopadding" width="100%">';
144 print "<tr class=\"liste_titre\">";
145 print '<td colspan="2">'.$langs->trans(
"ECMSearchByKeywords").
'</td></tr>';
146 print '<tr class="impair"><td>'.$langs->trans(
"Ref").
':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
147 print '<tr class="impair"><td>'.$langs->trans(
"Title").
':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
148 print '<tr class="impair"><td>'.$langs->trans(
"Keyword").
':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
149 print '<tr class="impair"><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
150 print "</table></form>";
155 print '<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
156 print '<input type="hidden" name="token" value="'.newToken().
'">';
157 print '<table class="nobordernopadding" width="100%">';
158 print "<tr class=\"liste_titre\">";
159 print '<td colspan="4">'.$langs->trans(
"ECMSearchByEntity").
'</td></tr>';
161 $buthtml =
'<td rowspan="'.$rowspan.
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
163 foreach ($sectionauto as $sectioncur)
165 if (!$sectioncur[
'test'])
continue;
166 print '<tr class="impair">';
167 print "<td>".$sectioncur[
'label'].
':</td>';
169 print ' class="right"';
171 print '<input type="text" name="search_'.$sectioncur[
'module'].
'" class="flat" size="14">';
177 print '<tr '.$bc[
false].
'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
178 print "</table></form>";
183 print '</td><td class="tdtop">';
186 $relativepath = $ecmdir->getRelativePath();
187 $upload_dir = $conf->ecm->dir_output.
'/'.$relativepath;
188 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
191 $param =
'&section='.$section;
192 $textifempty = ($section ? $langs->trans(
"NoFileFound") : $langs->trans(
"ECMSelectASection"));
193 $formfile->list_of_documents($filearray,
'',
'ecm', $param, 1, $relativepath, $user->rights->ecm->upload, 1, $textifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage Dolibarr users.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
ecm_prepare_head_fm($object)
Prepare array with list of tabs.
Class to manage ECM directories.