diff --git a/htdocs/core/search.php b/htdocs/core/search.php index 321fc94a925..333cb218e58 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -50,6 +50,7 @@ if (!defined('NOREQUIREMENU')) { require_once '../main.inc.php'; + /* * Actions */ @@ -128,11 +129,11 @@ if (GETPOST('search_task') != '') { } if (GETPOST('search_user') != '') { - header("Location: ".DOL_URL_ROOT.'/user/list.php?mode=search&sall='.urlencode(GETPOST('search_user'))); + header("Location: ".DOL_URL_ROOT.'/user/list.php?search_all='.urlencode(GETPOST('search_user'))); exit; } if (GETPOST('search_group') != '') { - header("Location: ".DOL_URL_ROOT.'/user/group/list.php?mode=search&sall='.urlencode(GETPOST('search_group'))); + header("Location: ".DOL_URL_ROOT.'/user/group/list.php?search_all='.urlencode(GETPOST('search_group'))); exit; } diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 9f7505c3de1..7e707b6b4fc 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -43,7 +43,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page $optioncss = GETPOST('optioncss', 'aZ09'); // Option for the css output (always '' except when 'print') $mode = GETPOST('mode', 'aZ'); -$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_group = GETPOST('search_group'); // Load variable for pagination @@ -152,12 +152,15 @@ if (empty($reshook)) { * View */ -$help_url=""; +$form = new Form($db); + +$help_url = ''; $title = $langs->trans("UserGroups"); $morejs = array(); $morecss = array(); - +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT g.rowid, g.nom as name, g.note, g.entity, g.datec, g.tms as datem, COUNT(DISTINCT ugu.fk_user) as nb, COUNT(DISTINCT ugr.fk_id) as nbpermissions"; $sql .= " FROM ".MAIN_DB_PREFIX."usergroup as g"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ugu ON ugu.fk_usergroup = g.rowid"; @@ -230,6 +233,27 @@ foreach ($search as $key => $val) { if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; + +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '
'."\n"; if ($optioncss != '') { @@ -262,21 +286,43 @@ if ($search_all) { $setupstring .= $key."=".$val.";"; } print ''."\n"; - print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; -//$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -//$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$arrayfields = array(); +$selectedfields = ''; +if (!empty($arrayfields)) { + $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields + $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +} print '
'; -print ''."\n"; +print '
'."\n"; // Fields title search // -------------------------------------------------------------------- // ... +$totalarray = array(); +$totalarray['nbfield'] = 0; + // Fields title label // -------------------------------------------------------------------- print ''; @@ -298,12 +344,26 @@ print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "g.datec", $p $totalarray['nbfield']++; print_liste_field_titre("DateLastModification", $_SERVER["PHP_SELF"], "g.tms", $param, "", '', $sortfield, $sortorder, 'center '); $totalarray['nbfield']++; -print_liste_field_titre("", $_SERVER["PHP_SELF"]); +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +/*if (!empty($arrayfields['anotherfield']['checked'])) { + print ''; + $totalarray['nbfield']++; + }*/ +// Action column +if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} $totalarray['nbfield']++; // For the column action -print "\n"; - +print ''."\n"; +// Loop on record +// -------------------------------------------------------------------- $i = 0; $savnbfield = $totalarray['nbfield']; $totalarray = array(); @@ -357,17 +417,41 @@ while ($i < $imaxinloop) { print img_picto($langs->trans("GlobalGroup"), 'redstar'); } print ""; + if (!$i) { + $totalarray['nbfield']++; + } //multicompany if (isModEnabled('multicompany') && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1) { $mc->getInfo($obj->entity); print ''; + if (!$i) { + $totalarray['nbfield']++; + } } print ''; + if (!$i) { + $totalarray['nbfield']++; + } print ''; + if (!$i) { + $totalarray['nbfield']++; + } print ''; + if (!$i) { + $totalarray['nbfield']++; + } print ''; + if (!$i) { + $totalarray['nbfield']++; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; // Action column if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { print '\n"; + print ''."\n"; } $i++; } -print "
'.$langs->trans("AnotherField").'
'.dol_escape_htmltag($mc->label).''.$obj->nb.''; print ''.$obj->nbpermissions.''; print ''.dol_print_date($db->jdate($obj->datec), "dayhour").''.dol_print_date($db->jdate($obj->datem), "dayhour").''; @@ -384,17 +468,33 @@ while ($i < $imaxinloop) { $totalarray['nbfield']++; } - print "
"; -print '
'; -print "
\n"; +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) { + /*$colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + }*/ + $colspan = $savnbfield; + print ''.$langs->trans("NoRecordFound").''; +} $db->free($resql); +print ''."\n"; +print ''."\n"; + +print ''."\n"; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index d3139b438e2..3cac5d06c56 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -542,7 +542,7 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($sall != '') { - $param .= '&sall='.urlencode($sall); + $param .= '&search_all='.urlencode($sall); } if ($search_user != '') { $param .= "&search_user=".urlencode($search_user);