27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/core/lib/ecm.lib.php';
30require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/treeview.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmdirectory.class.php';
35$langs->loadLangs(array(
"ecm",
"companies",
"other",
"users",
"orders",
"propal",
"bills",
"contracts"));
39 $socid = $user->socid;
44$user->loadRights(
'ecm');
48$action =
GETPOST(
'action',
'aZ09');
54$module =
GETPOST(
'module',
'alpha');
55$website =
GETPOST(
'website',
'alpha');
61$upload_dir = $conf->ecm->dir_output.
'/'.$section;
64$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
65$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
67if (empty($page) || $page == -1) {
70$offset = $limit * $page;
81if (!empty($section)) {
82 $result = $ecmdir->fetch($section);
89$permissiontoread = $user->hasRight(
'ecm',
'read');
91if (!$permissiontoread) {
108llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-ecm page-search');
110$form =
new Form($db);
112$userstatic =
new User($db);
117$sectionauto = array();
118if (isModEnabled(
"product") || isModEnabled(
"service")) {
119 $langs->load(
"products");
121 $sectionauto[] = array(
'level' => 1,
'module' =>
'product',
'test' => (isModEnabled(
"product") || isModEnabled(
"service")),
'label' => $langs->trans(
"ProductsAndServices"),
'desc' => $langs->trans(
"ECMDocsByProducts"));
123if (isModEnabled(
"societe")) {
125 $sectionauto[] = array(
'level' => 1,
'module' =>
'company',
'test' => isModEnabled(
'societe'),
'label' => $langs->trans(
"ThirdParties"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ThirdParties")));
127if (isModEnabled(
"propal")) {
129 $sectionauto[] = array(
'level' => 1,
'module' =>
'propal',
'test' => isModEnabled(
'propal'),
'label' => $langs->trans(
"Proposals"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Proposals")));
131if (isModEnabled(
'contract')) {
133 $sectionauto[] = array(
'level' => 1,
'module' =>
'contract',
'test' => isModEnabled(
'contract'),
'label' => $langs->trans(
"Contracts"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Contracts")));
135if (isModEnabled(
'order')) {
137 $sectionauto[] = array(
'level' => 1,
'module' =>
'order',
'test' => isModEnabled(
'order'),
'label' => $langs->trans(
"CustomersOrders"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Orders")));
139if (isModEnabled(
'invoice')) {
141 $sectionauto[] = array(
'level' => 1,
'module' =>
'invoice',
'test' => isModEnabled(
'invoice'),
'label' => $langs->trans(
"CustomersInvoices"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Invoices")));
143if (isModEnabled(
'supplier_proposal')) {
144 $langs->load(
"supplier_proposal");
146 $sectionauto[] = array(
'level' => 1,
'module' =>
'supplier_proposal',
'test' => isModEnabled(
'supplier_proposal'),
'label' => $langs->trans(
"SupplierProposals"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SupplierProposals")));
148if (isModEnabled(
"supplier_order")) {
150 $sectionauto[] = array(
'level' => 1,
'module' =>
'order_supplier',
'test' => isModEnabled(
"supplier_order"),
'label' => $langs->trans(
"SuppliersOrders"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"PurchaseOrders")));
152if (isModEnabled(
"supplier_invoice")) {
154 $sectionauto[] = array(
'level' => 1,
'module' =>
'invoice_supplier',
'test' => isModEnabled(
"supplier_invoice"),
'label' => $langs->trans(
"SuppliersInvoices"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SupplierInvoices")));
156if (isModEnabled(
'tax')) {
157 $langs->load(
"compta");
159 $sectionauto[] = array(
'level' => 1,
'module' =>
'tax',
'test' => isModEnabled(
'tax'),
'label' => $langs->trans(
"SocialContributions"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"SocialContributions")));
161if (isModEnabled(
'project')) {
163 $sectionauto[] = array(
'level' => 1,
'module' =>
'project',
'test' => isModEnabled(
'project'),
'label' => $langs->trans(
"Projects"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Projects")));
165if (isModEnabled(
'intervention')) {
166 $langs->load(
"interventions");
168 $sectionauto[] = array(
'level' => 1,
'module' =>
'fichinter',
'test' => isModEnabled(
'intervention'),
'label' => $langs->trans(
"Interventions"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Interventions")));
170if (isModEnabled(
'expensereport')) {
171 $langs->load(
"trips");
173 $sectionauto[] = array(
'level' => 1,
'module' =>
'expensereport',
'test' => isModEnabled(
'expensereport'),
'label' => $langs->trans(
"ExpenseReports"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ExpenseReports")));
175if (isModEnabled(
'holiday')) {
176 $langs->load(
"holiday");
178 $sectionauto[] = array(
'level' => 1,
'module' =>
'holiday',
'test' => isModEnabled(
'holiday'),
'label' => $langs->trans(
"Holidays"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"Holidays")));
180if (isModEnabled(
"bank")) {
181 $langs->load(
"banks");
183 $sectionauto[] = array(
'level' => 1,
'module' =>
'banque',
'test' => isModEnabled(
'bank'),
'label' => $langs->trans(
"BankAccount"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"BankAccount")));
185if (isModEnabled(
'mrp')) {
188 $sectionauto[] = array(
'level' => 1,
'module' =>
'mrp-mo',
'test' => isModEnabled(
'mrp'),
'label' => $langs->trans(
"MOs"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"ManufacturingOrders")));
190if (isModEnabled(
'recruitment')) {
191 $langs->load(
"recruitment");
193 $sectionauto[] = array(
'level' => 1,
'module' =>
'recruitment-recruitmentcandidature',
'test' => isModEnabled(
'recruitment'),
'label' => $langs->trans(
"Candidatures"),
'desc' => $langs->trans(
"ECMDocsBy", $langs->transnoentitiesnoconv(
"JobApplications")));
200print
load_fiche_titre($langs->trans(
"ECMArea").
' - '.$langs->trans(
"Search"));
202print $langs->trans(
"FeatureNotYetAvailable").
'.<br><br>';
209print
'<table class="border centpercent"><tr><td width="40%" valign="top">';
216print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
217print
'<input type="hidden" name="token" value="'.newToken().
'">';
218print
'<table class="nobordernopadding" width="100%">';
219print
"<tr class=\"liste_titre\">";
220print
'<td colspan="2">'.$langs->trans(
"ECMSearchByKeywords").
'</td></tr>';
221print
'<tr class="impair"><td>'.$langs->trans(
"Ref").
':</td><td class="right"><input type="text" name="search_ref" class="flat" size="10"></td></tr>';
222print
'<tr class="impair"><td>'.$langs->trans(
"Title").
':</td><td class="right"><input type="text" name="search_title" class="flat" size="10"></td></tr>';
223print
'<tr class="impair"><td>'.$langs->trans(
"Keyword").
':</td><td class="right"><input type="text" name="search_keyword" class="flat" size="10"></td></tr>';
224print
'<tr class="impair"><td colspan="2" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
225print
"</table></form>";
230print
'<form method="post" action="'.DOL_URL_ROOT.
'/ecm/search.php">';
231print
'<input type="hidden" name="token" value="'.newToken().
'">';
232print
'<table class="nobordernopadding" width="100%">';
233print
"<tr class=\"liste_titre\">";
234print
'<td colspan="4">'.$langs->trans(
"ECMSearchByEntity").
'</td></tr>';
236$buthtml =
'<td rowspan="'.$rowspan.
'"><input type="submit" value="'.$langs->trans(
"Search").
'" class="button"></td>';
238foreach ($sectionauto as $sectioncur) {
239 if (!$sectioncur[
'test']) {
242 print
'<tr class="impair">';
243 print
"<td>".$sectioncur[
'label'].
':</td>';
245 print
' class="right"';
247 print
'<input type="text" name="search_'.$sectioncur[
'module'].
'" class="flat" size="14">';
253print
'<tr '.$bc[
false].
'><td colspan="4" class="center"><input type="submit" class="button" value="'.$langs->trans(
"Search").
'"></td></tr>';
254print
"</table></form>";
259print
'</td><td class="tdtop">';
262$relativepath = $ecmdir->getRelativePath();
263$upload_dir = $conf->ecm->dir_output.
'/'.$relativepath;
264$filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ? SORT_DESC : SORT_ASC), 1);
267$param =
'§ion='.urlencode($section);
268$textifempty = ($section ? $langs->trans(
"NoFileFound") : $langs->trans(
"ECMSelectASection"));
269$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...
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.