FIX jump to direct record on member search was broken
This commit is contained in:
parent
8d75d7b466
commit
8a5a9223e6
@ -188,7 +188,8 @@ $result = restrictedArea($user, 'adherent');
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel', 'alpha')) {
|
if (GETPOST('cancel', 'alpha')) {
|
||||||
$action = 'list'; $massaction = '';
|
$action = 'list';
|
||||||
|
$massaction = '';
|
||||||
}
|
}
|
||||||
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
|
||||||
$massaction = '';
|
$massaction = '';
|
||||||
@ -324,14 +325,17 @@ $formother = new FormOther($db);
|
|||||||
$membertypestatic = new AdherentType($db);
|
$membertypestatic = new AdherentType($db);
|
||||||
$memberstatic = new Adherent($db);
|
$memberstatic = new Adherent($db);
|
||||||
|
|
||||||
|
$now = dol_now();
|
||||||
|
|
||||||
// Page Header
|
// Page Header
|
||||||
$title = $langs->trans("Members")." - ".$langs->trans("List");
|
$title = $langs->trans("Members")." - ".$langs->trans("List");
|
||||||
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros|DE:Modul_Mitglieder';
|
||||||
llxHeader('', $title, $help_url);
|
$morejs = array();
|
||||||
|
$morecss = array();
|
||||||
|
|
||||||
|
|
||||||
$now = dol_now();
|
// Build and execute select
|
||||||
|
// --------------------------------------------------------------------
|
||||||
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
if ((!empty($search_categ) && $search_categ > 0) || !empty($catid)) {
|
||||||
$sql = "SELECT DISTINCT";
|
$sql = "SELECT DISTINCT";
|
||||||
} else {
|
} else {
|
||||||
@ -356,7 +360,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
|||||||
|
|
||||||
// Add fields from hooks
|
// Add fields from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
$sql = preg_replace('/,\s*$/', '', $sql);
|
$sql = preg_replace('/,\s*$/', '', $sql);
|
||||||
|
|
||||||
@ -487,16 +491,14 @@ if ($search_country) {
|
|||||||
if ($search_import_key) {
|
if ($search_import_key) {
|
||||||
$sql .= natural_search("d.import_key", $search_import_key);
|
$sql .= natural_search("d.import_key", $search_import_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add where from extra fields
|
// Add where from extra fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||||
|
|
||||||
// Add where from hooks
|
// Add where from hooks
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
|
||||||
$sql .= $hookmanager->resPrint;
|
$sql .= $hookmanager->resPrint;
|
||||||
|
|
||||||
// Count total nb of records with no order and no limits
|
// Count total nb of records
|
||||||
$nbtotalofrecords = '';
|
$nbtotalofrecords = '';
|
||||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||||
@ -510,7 +512,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
|||||||
dol_print_error($db);
|
dol_print_error($db);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0
|
||||||
$page = 0;
|
$page = 0;
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
}
|
}
|
||||||
@ -533,8 +535,7 @@ if (!$resql) {
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
|
||||||
$arrayofselected = is_array($toselect) ? $toselect : array();
|
// Direct jump if only one record found
|
||||||
|
|
||||||
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
|
if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
@ -542,6 +543,13 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Output page
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); // Can use also classforhorizontalscrolloftabs instead of bodyforlist for no horizontal scroll
|
||||||
|
|
||||||
|
$arrayofselected = is_array($toselect) ? $toselect : array();
|
||||||
|
|
||||||
|
|
||||||
if ($search_type > 0) {
|
if ($search_type > 0) {
|
||||||
$membertype = new AdherentType($db);
|
$membertype = new AdherentType($db);
|
||||||
@ -1351,7 +1359,7 @@ if ($num == 0) {
|
|||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->free($resql);
|
$db->free($resql);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user