Uniformize code. Generalize option MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE.
This commit is contained in:
parent
ef03f59e50
commit
7fa9692458
@ -58,6 +58,7 @@ $action = GETPOST('action','alpha');
|
|||||||
$backtopage = GETPOST('backtopage');
|
$backtopage = GETPOST('backtopage');
|
||||||
$myparam = GETPOST('myparam','alpha');
|
$myparam = GETPOST('myparam','alpha');
|
||||||
|
|
||||||
|
$search_all=trim(GETPOST("sall"));
|
||||||
$search_field1=GETPOST("search_field1");
|
$search_field1=GETPOST("search_field1");
|
||||||
$search_field2=GETPOST("search_field2");
|
$search_field2=GETPOST("search_field2");
|
||||||
$search_myfield=GETPOST('search_myfield');
|
$search_myfield=GETPOST('search_myfield');
|
||||||
@ -247,7 +248,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|||||||
|
|
||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
|
|
||||||
dol_syslog($script_file, LOG_DEBUG);
|
dol_syslog($script_file, LOG_DEBUG);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
@ -259,7 +259,7 @@ if (! $resql)
|
|||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
// Direct jump if only one record found
|
// Direct jump if only one record found
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
|
|||||||
@ -129,21 +129,25 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
if (! GETPOST('confirmmassaction')) { $massaction=''; }
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge search criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search="";
|
$search="";
|
||||||
$search_ref="";
|
$search_ref="";
|
||||||
@ -168,6 +172,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$statut='';
|
$statut='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -179,8 +184,6 @@ $formother=new FormOther($db);
|
|||||||
$membertypestatic=new AdherentType($db);
|
$membertypestatic=new AdherentType($db);
|
||||||
$memberstatic=new Adherent($db);
|
$memberstatic=new Adherent($db);
|
||||||
|
|
||||||
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
|
|
||||||
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
|
$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,";
|
||||||
@ -259,10 +262,23 @@ $sql.= $db->plimit($limit+1, $offset);
|
|||||||
|
|
||||||
dol_syslog("get list", LOG_DEBUG);
|
dol_syslog("get list", LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
$i = 0;
|
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->rowid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/adherents/card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros');
|
||||||
|
|
||||||
$titre=$langs->trans("MembersList");
|
$titre=$langs->trans("MembersList");
|
||||||
if (isset($_GET["statut"]))
|
if (isset($_GET["statut"]))
|
||||||
@ -287,7 +303,9 @@ if ($resql)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
|
if ($sall != "") $param.="&sall=".urlencode($sall);
|
||||||
if ($statut != "") $param.="&statut=".urlencode($statut);
|
if ($statut != "") $param.="&statut=".urlencode($statut);
|
||||||
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
if ($search_ref) $param.="&search_ref=".urlencode($search_ref);
|
||||||
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
|
if ($search_nom) $param.="&search_nom=".urlencode($search_nom);
|
||||||
@ -577,6 +595,7 @@ if ($resql)
|
|||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$var=True;
|
$var=True;
|
||||||
|
$i = 0;
|
||||||
while ($i < $num && $i < $conf->liste_limit)
|
while ($i < $num && $i < $conf->liste_limit)
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
@ -826,13 +845,7 @@ if ($resql)
|
|||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
|
if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -385,7 +385,7 @@ if (! $result)
|
|||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
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->cidp;
|
$id = $obj->cidp;
|
||||||
|
|||||||
@ -175,9 +175,20 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array();
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
// Purge search criteria
|
||||||
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$sall="";
|
$sall="";
|
||||||
$sref="";
|
$sref="";
|
||||||
@ -191,6 +202,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$search_accountancy_code_buy='';
|
$search_accountancy_code_buy='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -305,12 +317,11 @@ else
|
|||||||
{
|
{
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
$i = 0;
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||||
|
|
||||||
if ($num == 1 && ($sall || $snom || $sref || $sbarcode) && $action != 'list')
|
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
header("Location: card.php?id=".$objp->rowid);
|
$id = $obj->rowid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/product/card.php?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -585,6 +596,7 @@ else
|
|||||||
$product_fourn =new ProductFournisseur($db);
|
$product_fourn =new ProductFournisseur($db);
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
$i = 0;
|
||||||
while ($i < min($num,$limit))
|
while ($i < min($num,$limit))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
|
|||||||
@ -142,9 +142,19 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Do we click on purge search criteria ?
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_all='';
|
$search_all='';
|
||||||
@ -169,7 +179,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$year="";
|
$year="";
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -185,8 +195,6 @@ $formproject = new FormProjets($db);
|
|||||||
$title=$langs->trans("Projects");
|
$title=$langs->trans("Projects");
|
||||||
if ($search_user == $user->id) $title=$langs->trans("MyProjects");
|
if ($search_user == $user->id) $title=$langs->trans("MyProjects");
|
||||||
|
|
||||||
llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
|
||||||
|
|
||||||
// Get list of project id allowed to user (in a string list separated by coma)
|
// Get list of project id allowed to user (in a string list separated by coma)
|
||||||
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
|
||||||
|
|
||||||
@ -320,11 +328,25 @@ $sql.= $db->plimit($limit + 1,$offset);
|
|||||||
dol_syslog("list allowed project", LOG_DEBUG);
|
dol_syslog("list allowed project", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->projectid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/projet/card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader("",$title,"EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos");
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
@ -846,12 +868,6 @@ if ($resql)
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|||||||
@ -129,9 +129,19 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
// Purge criteria
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_all="";
|
$search_all="";
|
||||||
@ -152,6 +162,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
|
|||||||
$year='';
|
$year='';
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;
|
if (empty($search_projectstatus) && $search_projectstatus == '') $search_projectstatus=1;
|
||||||
|
|
||||||
|
|
||||||
@ -174,8 +186,6 @@ if ($search_task_user > 0) $tuser->fetch($search_task_user);
|
|||||||
$title=$langs->trans("Activities");
|
$title=$langs->trans("Activities");
|
||||||
if ($search_task_user == $user->id) $title=$langs->trans("MyActivities");
|
if ($search_task_user == $user->id) $title=$langs->trans("MyActivities");
|
||||||
|
|
||||||
llxHeader("",$title,"Projet");
|
|
||||||
|
|
||||||
if ($id)
|
if ($id)
|
||||||
{
|
{
|
||||||
$projectstatic->fetch($id);
|
$projectstatic->fetch($id);
|
||||||
@ -311,11 +321,25 @@ $sql.= $db->plimit($limit + 1,$offset);
|
|||||||
dol_syslog("list allowed project", LOG_DEBUG);
|
dol_syslog("list allowed project", LOG_DEBUG);
|
||||||
//print $sql;
|
//print $sql;
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->id;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/projet/tasks/task.php?id='.$id.'&withprojet=1');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader("",$title,"Projet");
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||||
@ -804,13 +828,6 @@ if ($resql)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -444,7 +444,7 @@ if (! $resql)
|
|||||||
|
|
||||||
$num = $db->num_rows($resql);
|
$num = $db->num_rows($resql);
|
||||||
|
|
||||||
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE))
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && $action != 'list')
|
||||||
{
|
{
|
||||||
$obj = $db->fetch_object($resql);
|
$obj = $db->fetch_object($resql);
|
||||||
$id = $obj->rowid;
|
$id = $obj->rowid;
|
||||||
|
|||||||
@ -135,12 +135,19 @@ if ($mode == 'employee') $search_employee=1;
|
|||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (GETPOST('cancel')) { $action='list'; $massaction=''; }
|
||||||
|
if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction=''; }
|
||||||
|
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
// Selection of new fields
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||||
|
|
||||||
|
// Purge search criteria
|
||||||
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All test are required to be compatible with all browsers
|
||||||
{
|
{
|
||||||
$search_user="";
|
$search_user="";
|
||||||
@ -160,14 +167,13 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPO
|
|||||||
$search_date_update="";
|
$search_date_update="";
|
||||||
$search_array_options=array();
|
$search_array_options=array();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
llxHeader('',$langs->trans("ListOfUsers"));
|
|
||||||
|
|
||||||
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
|
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
|
||||||
|
|
||||||
@ -239,10 +245,23 @@ if ($result)
|
|||||||
$sql.= $db->plimit($limit+1, $offset);
|
$sql.= $db->plimit($limit+1, $offset);
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$result = $db->query($sql);
|
||||||
if ($result)
|
if (! $result)
|
||||||
{
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$num = $db->num_rows($result);
|
$num = $db->num_rows($result);
|
||||||
$i = 0;
|
|
||||||
|
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
$id = $obj->rowid;
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/user/card.php?id='.$id);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("ListOfUsers"));
|
||||||
|
|
||||||
$param='';
|
$param='';
|
||||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||||
@ -638,12 +657,7 @@ if ($result)
|
|||||||
print "</table>";
|
print "</table>";
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
$db->free($result);
|
$db->free($result);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user