28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/ecm.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmdirectory.class.php';
44$langs->loadLangs(array(
"ecm",
"companies",
"other",
"users",
"orders",
"propal",
"bills",
"contracts"));
48 $socid = $user->socid;
53$user->loadRights(
'ecm');
57$action =
GETPOST(
'action',
'aZ09');
63$module =
GETPOST(
'module',
'alpha');
64$website =
GETPOST(
'website',
'alpha');
70$upload_dir =
$conf->ecm->dir_output.
'/'.$section;
73$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
74$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
76if (empty($page) || $page == -1) {
79$offset = $limit * $page;
90if (!empty($section)) {
91 $result = $ecmdir->fetch($section);
98$permissiontoread = $user->hasRight(
'ecm',
'read');
100if (!$permissiontoread) {
117llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-ecm page-search');
119$form =
new Form($db);
121$userstatic =
new User($db);
126$sectionauto = array();
127if (isModEnabled(
"product") || isModEnabled(
"service")) {
128 $langs->load(
"products");
130 $sectionauto[] = array(
'level' => 1,
'module' =>
'product',
'test' => (isModEnabled(
"product") || isModEnabled(
"service")),
'label' => $langs->trans(
"ProductsAndServices"),
'desc' => $langs->trans(
"ECMDocsByProducts"));
132if (isModEnabled(
"societe")) {
134 $sectionauto[] = array(
'level' => 1,
'module' =>
'company',
'test' => isModEnabled(
'societe'),
'label' => $langs->trans(
"ThirdParties"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ThirdParties")));
136if (isModEnabled(
"propal")) {
138 $sectionauto[] = array(
'level' => 1,
'module' =>
'propal',
'test' => isModEnabled(
'propal'),
'label' => $langs->trans(
"Proposals"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Proposals")));
140if (isModEnabled(
'contract')) {
142 $sectionauto[] = array(
'level' => 1,
'module' =>
'contract',
'test' => isModEnabled(
'contract'),
'label' => $langs->trans(
"Contracts"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Contracts")));
144if (isModEnabled(
'order')) {
146 $sectionauto[] = array(
'level' => 1,
'module' =>
'order',
'test' => isModEnabled(
'order'),
'label' => $langs->trans(
"CustomersOrders"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Orders")));
148if (isModEnabled(
'invoice')) {
150 $sectionauto[] = array(
'level' => 1,
'module' =>
'invoice',
'test' => isModEnabled(
'invoice'),
'label' => $langs->trans(
"CustomersInvoices"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Invoices")));
152if (isModEnabled(
'supplier_proposal')) {
153 $langs->load(
"supplier_proposal");
155 $sectionauto[] = array(
'level' => 1,
'module' =>
'supplier_proposal',
'test' => isModEnabled(
'supplier_proposal'),
'label' => $langs->trans(
"SupplierProposals"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SupplierProposals")));
157if (isModEnabled(
"supplier_order")) {
159 $sectionauto[] = array(
'level' => 1,
'module' =>
'order_supplier',
'test' => isModEnabled(
"supplier_order"),
'label' => $langs->trans(
"SuppliersOrders"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"PurchaseOrders")));
161if (isModEnabled(
"supplier_invoice")) {
163 $sectionauto[] = array(
'level' => 1,
'module' =>
'invoice_supplier',
'test' => isModEnabled(
"supplier_invoice"),
'label' => $langs->trans(
"SuppliersInvoices"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SupplierInvoices")));
165if (isModEnabled(
'tax')) {
166 $langs->load(
"compta");
168 $sectionauto[] = array(
'level' => 1,
'module' =>
'tax',
'test' => isModEnabled(
'tax'),
'label' => $langs->trans(
"SocialContributions"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SocialContributions")));
170if (isModEnabled(
'project')) {
172 $sectionauto[] = array(
'level' => 1,
'module' =>
'project',
'test' => isModEnabled(
'project'),
'label' => $langs->trans(
"Projects"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Projects")));
174if (isModEnabled(
'intervention')) {
175 $langs->load(
"interventions");
177 $sectionauto[] = array(
'level' => 1,
'module' =>
'fichinter',
'test' => isModEnabled(
'intervention'),
'label' => $langs->trans(
"Interventions"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Interventions")));
179if (isModEnabled(
'expensereport')) {
180 $langs->load(
"trips");
182 $sectionauto[] = array(
'level' => 1,
'module' =>
'expensereport',
'test' => isModEnabled(
'expensereport'),
'label' => $langs->trans(
"ExpenseReports"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ExpenseReports")));
184if (isModEnabled(
'holiday')) {
185 $langs->load(
"holiday");
187 $sectionauto[] = array(
'level' => 1,
'module' =>
'holiday',
'test' => isModEnabled(
'holiday'),
'label' => $langs->trans(
"Holidays"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Holidays")));
189if (isModEnabled(
"bank")) {
190 $langs->load(
"banks");
192 $sectionauto[] = array(
'level' => 1,
'module' =>
'banque',
'test' => isModEnabled(
'bank'),
'label' => $langs->trans(
"BankAccount"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"BankAccount")));
194if (isModEnabled(
'mrp')) {
197 $sectionauto[] = array(
'level' => 1,
'module' =>
'mrp-mo',
'test' => isModEnabled(
'mrp'),
'label' => $langs->trans(
"MOs"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ManufacturingOrders")));
199if (isModEnabled(
'recruitment')) {
200 $langs->load(
"recruitment");
202 $sectionauto[] = array(
'level' => 1,
'module' =>
'recruitment-recruitmentcandidature',
'test' => isModEnabled(
'recruitment'),
'label' => $langs->trans(
"Candidatures"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"JobApplications")));
209print
load_fiche_titre($langs->trans(
"ECMArea").
' - '.$langs->trans(
"Search"));
211print $langs->trans(
"FeatureNotYetAvailable").
'.<br><br>';
218print
'<table class="border centpercent"><tr><td width="40%" valign="top">';
225print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
226print
'<input type="hidden" name="token" value="'.newToken().
'">';
227print
'<table class="nobordernopadding" width="100%">';
228print
"<tr class=\"liste_titre\">";
229print
'<td colspan="2">'.$langs->trans(
"ECMSearchByKeywords").
'</td></tr>';
230print
'<tr class="impair"><td>'.$langs->trans(
"Ref").
':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
231print
'<tr class="impair"><td>'.$langs->trans(
"Title").
':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
232print
'<tr class="impair"><td>'.$langs->trans(
"Keyword").
':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
233print
'<tr class="impair"><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
234print
"</table></form>";
239print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
240print
'<input type="hidden" name="token" value="'.newToken().
'">';
241print
'<table class="nobordernopadding" width="100%">';
242print
"<tr class=\"liste_titre\">";
243print
'<td colspan="4">'.$langs->trans(
"ECMSearchByEntity").
'</td></tr>';
245$buthtml =
'<td rowspan="'.$rowspan.
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
247foreach ($sectionauto as $sectioncur) {
248 if (!$sectioncur[
'test']) {
251 print
'<tr class="impair">';
252 print
"<td>".$sectioncur[
'label'].
':</td>';
254 print
' class="right"';
256 print
'<input type="text" name="search_'.$sectioncur[
'module'].
'" class="flat" size="14">';
262print
'<tr '.$bc[
false].
'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
263print
"</table></form>";
268print
'</td><td class="tdtop">';
271$relativepath = $ecmdir->getRelativePath();
272$upload_dir =
$conf->ecm->dir_output.
'/'.$relativepath;
273$filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
276$param =
'§ion='.urlencode($section);
277$textifempty = ($section ? $langs->trans(
"NoFileFound") : $langs->trans(
"ECMSelectASection"));
278$formfile->list_of_documents($filearray,
null,
'ecm', $param, 1, $relativepath, $user->hasRight(
'ecm',
'upload'), 1, $textifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage ECM directories.
Class to manage Dolibarr users.
ecm_prepare_head_fm($object)
Prepare array with list of tabs.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.