Enhance search / filter
This commit is contained in:
parent
2d30d33303
commit
05ac3de2f0
@ -780,26 +780,26 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||||||
|
|
||||||
if (!is_object($weblangs)) $weblangs = $langs;
|
if (!is_object($weblangs)) $weblangs = $langs;
|
||||||
|
|
||||||
if (empty($searchstring))
|
if (empty($searchstring) && empty($type) && empty($langcode) && empty($otherfilters))
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$arrayresult['code'] = 'KO';
|
$arrayresult['code'] = 'KO';
|
||||||
$arrayresult['message'] = $weblangs->trans("EmptySearchString");
|
$arrayresult['message'] = $weblangs->trans("EmptySearchString");
|
||||||
} elseif (dol_strlen($searchstring) < 2) {
|
} elseif ($searchstring && dol_strlen($searchstring) < 2) {
|
||||||
$weblangs->load("errors");
|
$weblangs->load("errors");
|
||||||
$error++;
|
$error++;
|
||||||
$arrayresult['code'] = 'KO';
|
$arrayresult['code'] = 'KO';
|
||||||
$arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall");
|
$arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall");
|
||||||
} else {
|
} else {
|
||||||
$tmparrayoftype = explode(',', $type);
|
$tmparrayoftype = explode(',', $type);
|
||||||
foreach ($tmparrayoftype as $tmptype) {
|
/*foreach ($tmparrayoftype as $tmptype) {
|
||||||
if (!in_array($tmptype, array('', 'page', 'blogpost'))) {
|
if (!in_array($tmptype, array('', 'page', 'blogpost'))) {
|
||||||
$error++;
|
$error++;
|
||||||
$arrayresult['code'] = 'KO';
|
$arrayresult['code'] = 'KO';
|
||||||
$arrayresult['message'] = 'Bad value for parameter type';
|
$arrayresult['message'] = 'Bad value for parameter type';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$searchdone = 0;
|
$searchdone = 0;
|
||||||
@ -819,7 +819,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so
|
|||||||
$tmparrayoftype = explode(',', $type);
|
$tmparrayoftype = explode(',', $type);
|
||||||
$typestring = '';
|
$typestring = '';
|
||||||
foreach ($tmparrayoftype as $tmptype) {
|
foreach ($tmparrayoftype as $tmptype) {
|
||||||
$typestring .= ($typestring ? ", " : "")."'".trim($tmptype)."'";
|
$typestring .= ($typestring ? ", " : "")."'".$db->escape(trim($tmptype))."'";
|
||||||
}
|
}
|
||||||
$sql .= " AND wp.type_container IN (".$typestring.")";
|
$sql .= " AND wp.type_container IN (".$typestring.")";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -374,9 +374,10 @@ if ($action == 'unsetshowsubcontainers')
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($action == 'replacesite' || $action == 'replacesiteconfirm') && !$searchkey)
|
if ($massaction == 'replace' && GETPOST('confirmmassaction', 'alpha') && !$searchkey)
|
||||||
{
|
{
|
||||||
$action = 'replacesite';
|
$action = 'replacesite';
|
||||||
|
$massaction = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replacement of string into pages
|
// Replacement of string into pages
|
||||||
@ -3648,9 +3649,10 @@ if ($action == 'replacesite' || $action == 'replacesiteconfirm' || $massaction =
|
|||||||
|
|
||||||
// List of mass actions available
|
// List of mass actions available
|
||||||
$arrayofmassactions = array();
|
$arrayofmassactions = array();
|
||||||
if ($user->rights->website->writephp) $arrayofmassactions['replace'] = $langs->trans("Replace");
|
if ($user->rights->website->writephp && $searchkey) $arrayofmassactions['replace'] = $langs->trans("Replace");
|
||||||
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
if ($permissiontodelete) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||||
|
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
$massactionbutton .= '<div class="massactionother hidden">';
|
$massactionbutton .= '<div class="massactionother hidden">';
|
||||||
$massactionbutton .= $langs->trans("ReplaceString");
|
$massactionbutton .= $langs->trans("ReplaceString");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user