Fix on search all (trim search + search from smartphone).

This commit is contained in:
Laurent Destailleur 2017-12-12 11:31:30 +01:00
parent 1251807f54
commit af1028576d
31 changed files with 37 additions and 41 deletions

View File

@ -61,9 +61,10 @@ $search_type=GETPOST("search_type");
$search_email=GETPOST("search_email");
$search_categ = GETPOST("search_categ",'int');
$catid = GETPOST("catid",'int');
$sall=GETPOST('sall', 'alphanohtml');
$optioncss = GETPOST('optioncss','alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
if ($statut < -1) $statut = '';
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;

View File

@ -41,7 +41,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="m.date_creat";
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sref=GETPOST("sref", "alpha");
$filteremail=GETPOST('filteremail','alpha');

View File

@ -81,7 +81,7 @@ $viewstatut=GETPOST('viewstatut','alpha');
$optioncss = GETPOST('optioncss','alpha');
$object_statut=GETPOST('propal_statut','alpha');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));

View File

@ -67,7 +67,7 @@ $search_zip=GETPOST('search_zip','alpha');
$search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$socid=GETPOST('socid','int');
$search_user=GETPOST('search_user','int');
$search_sale=GETPOST('search_sale','int');

View File

@ -52,7 +52,7 @@ $action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
$sref = GETPOST('sref');
$sref_client = GETPOST('sref_client');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$socid = GETPOST('socid','int');
$selected = GETPOST('orders_to_invoice');
$sortfield = GETPOST("sortfield",'alpha');

View File

@ -53,7 +53,7 @@ $langs->load('bills');
$langs->load('companies');
$langs->load('products');
$sall=trim(GETPOST('sall', 'alphanohtml'));
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$projectid=(GETPOST('projectid')?GETPOST('projectid','int'):0);
$id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility

View File

@ -47,7 +47,7 @@ $ref = ''; // There is no ref for contacts
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,'');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
$search_phone=GETPOST("search_phone");

View File

@ -56,7 +56,7 @@ $search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_contract=GETPOST('search_contract');
$search_ref_customer=GETPOST('search_ref_customer','alpha');
$search_ref_supplier=GETPOST('search_ref_supplier','alpha');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_status=GETPOST('search_status');
$socid=GETPOST('socid');
$search_user=GETPOST('search_user','int');

View File

@ -130,11 +130,11 @@ if (! empty($conf->user->enabled) && empty($conf->global->MAIN_SEARCHFORM_USER_D
}
if (! empty($conf->expensereport->enabled) && empty($conf->global->MAIN_SEARCHFORM_EXPENSEREPORT_DISABLED) && $user->rights->expensereport->lire)
{
$arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):''));
$arrayresult['searchintoexpensereport']=array('position'=>210, 'img'=>'object_trip', 'label'=>$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'text'=>img_picto('','object_trip').' '.$langs->trans("SearchIntoExpenseReports", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
}
if (! empty($conf->holiday->enabled) && empty($conf->global->MAIN_SEARCHFORM_HOLIDAY_DISABLED) && $user->rights->holiday->read)
{
$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&'.($search_boxvalue?'sall='.urlencode($search_boxvalue):''));
$arrayresult['searchintoleaves']=array('position'=>220, 'img'=>'object_holiday', 'label'=>$langs->trans("SearchIntoLeaves", $search_boxvalue), 'text'=>img_picto('','object_holiday').' '.$langs->trans("SearchIntoLeaves", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm'.($search_boxvalue?'&sall='.urlencode($search_boxvalue):''));
}

View File

@ -766,7 +766,7 @@ class Form
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
}
$out.= '<select id="'.$htmlname.'" class="flat selectincoterm noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
$out.= '<select id="'.$htmlname.'" class="flat selectincoterm minwidth100imp noenlargeonsmartphone" name="'.$htmlname.'" '.$htmloption.'>';
$out.= '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($resql);
$i = 0;

View File

@ -86,9 +86,8 @@ else
{
$tmp=explode('?', $val['url']);
$urlaction=$tmp[0];
$keysearch=$tmp[1];
$keysearch=preg_replace('/mainmenu=(.*)&/','',$keysearch);
$keysearch=preg_replace('/=/','',$keysearch);
$keysearch='search_all';
$accesskey='';
if (! $accesskeyalreadyassigned[$val['label'][0]])
{

View File

@ -43,7 +43,7 @@ if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="d.datedon";
$statut=(GETPOST("statut",'intcomma')!='')?GETPOST("statut",'intcomma'):"-1";
$search_all=GETPOST('sall', 'alphanohtml');
$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha');
$search_name=GETPOST('search_name','alpha');

View File

@ -50,7 +50,7 @@ $search_state=trim(GETPOST("search_state"));
$search_country=GETPOST("search_country",'int');
$search_type_thirdparty=GETPOST("search_type_thirdparty",'int');
$search_billed=GETPOST("search_billed",'int');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$optioncss = GETPOST('optioncss','alpha');
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;

View File

@ -66,7 +66,7 @@ if (!$sortfield) $sortfield="d.date_debut";
$id = GETPOST('id', 'int');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST('search_ref');
$search_user = GETPOST('search_user','int');
$search_amount_ht = GETPOST('search_amount_ht','alpha');
@ -77,7 +77,7 @@ $month_start = GETPOST("month_start","int");
$year_start = GETPOST("year_start","int");
$month_end = GETPOST("month_end","int");
$year_end = GETPOST("year_end","int");
$optioncss = GETPOST('optioncss','alpha');
$optioncss = GETPOST('optioncss','alpha');
if ($search_status == '') $search_status=-1;
if ($search_user == '') $search_user=-1;

View File

@ -46,7 +46,7 @@ $search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_
$search_company=GETPOST('search_company','alpha');
$search_desc=GETPOST('search_desc','alpha');
$search_status=GETPOST('search_status');
$sall=GETPOST('sall');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$optioncss = GETPOST('optioncss','alpha');
$socid=GETPOST('socid','int');
@ -75,7 +75,7 @@ if (! $sortfield)
// Initialize technical object to manage context to save list fields
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'interventionlist';
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST('search_ref')?GETPOST('search_ref','alpha'):GETPOST('search_inter','alpha');
$search_company=GETPOST('search_company','alpha');
$search_desc=GETPOST('search_desc','alpha');

View File

@ -53,7 +53,7 @@ $action = GETPOST('action', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$sref = GETPOST('sref');
$sref_client = GETPOST('sref_client');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$socid = GETPOST('socid', 'int');
$selected = GETPOST('orders_to_invoice');
$sortfield = GETPOST("sortfield", 'alpha');

View File

@ -68,7 +68,7 @@ if ($user->societe_id > 0)
$mode=GETPOST("mode");
$search_all = GETPOST('sall', 'alphanohtml');
$search_all = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_label = GETPOST("search_label","alpha");
$search_company = GETPOST("search_company","alpha");
$search_amount_no_tax = GETPOST("search_amount_no_tax","alpha");

View File

@ -73,7 +73,7 @@ if (! $sortorder) $sortorder="DESC";
$id = GETPOST('id','int');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref = GETPOST('search_ref');
$month_create = GETPOST('month_create');
$year_create = GETPOST('year_create');

View File

@ -1829,10 +1829,6 @@ function printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinpu
{
global $conf,$langs,$user;
if (empty($htmlinputid)) {
$htmlinputid = $htmlinputname;
}
$ret='';
$ret.='<form action="'.$urlaction.'" method="post" class="searchform">';
$ret.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -327,7 +327,7 @@ class ActionsCardProduct
$this->list_datas = array();
// Clean parameters
$sall=trim(GETPOST('sall', 'alphanohtml'));
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
foreach($this->field_list as $field)
{

View File

@ -51,7 +51,7 @@ $show_files=GETPOST('show_files','int');
$confirm=GETPOST('confirm','alpha');
$toselect = GETPOST('toselect', 'array');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST("search_ref");
$search_barcode=GETPOST("search_barcode");
$search_label=GETPOST("search_label");

View File

@ -42,7 +42,7 @@ $result=restrictedArea($user,'produit|service');
$action=GETPOST('action','alpha');
$sref=GETPOST("sref");
$snom=GETPOST("snom");
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$type=GETPOST("type","int");
$search_barcode=GETPOST("search_barcode");
$catid=GETPOST('catid','int');

View File

@ -45,7 +45,7 @@ $result=restrictedArea($user,'produit|service');
$action=GETPOST('action','alpha');
$sref=GETPOST("sref");
$snom=GETPOST("snom");
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$type=GETPOST("type","int");
$search_barcode=GETPOST("search_barcode",'alpha');
$search_warehouse=GETPOST('search_warehouse','alpha');

View File

@ -32,7 +32,7 @@ $langs->load("stocks");
// Security check
$result=restrictedArea($user,'stock');
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_ref=GETPOST("sref","alpha")?GETPOST("sref","alpha"):GETPOST("search_ref","alpha");
$search_label=GETPOST("snom","alpha")?GETPOST("snom","alpha"):GETPOST("search_label","alpha");
$search_status=GETPOST("search_status","int");

View File

@ -48,7 +48,7 @@ $result=restrictedArea($user,'produit|service');
$action = GETPOST('action','alpha');
$sref = GETPOST('sref', 'alpha');
$snom = GETPOST('snom', 'alpha');
$sall = GETPOST('sall', 'alphanohtml');
$sall = trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$type = GETPOST('type','int');
$tobuy = GETPOST('tobuy', 'int');
$salert = GETPOST('salert', 'alpha');

View File

@ -31,9 +31,9 @@ $langs->load("stocks");
// Security check
$result=restrictedArea($user,'stock');
$sref=GETPOST("sref");
$snom=GETPOST("snom");
$sall=GETPOST('sall', 'alphanohtml');
$sref=GETPOST("sref",'alpha');
$snom=GETPOST("snom",'alpha');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$sortfield = GETPOST("sortfield");
$sortorder = GETPOST("sortorder");

View File

@ -49,7 +49,7 @@ $socid = GETPOST('socid','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user,'societe',$socid,'');
$search_all=trim(GETPOST('sall', 'alphanohtml'));
$search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars
$search_id=trim(GETPOST("search_id","int"));

View File

@ -74,7 +74,7 @@ $search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('viewstatut','alpha')?GETPOST('viewstatut','alpha'):GETPOST('search_status','int');
$object_statut=$db->escape(GETPOST('supplier_proposal_statut'));
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
$year=GETPOST("year");
$month=GETPOST("month");

View File

@ -40,7 +40,7 @@ if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global-
$langs->load("users");
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_group=GETPOST('search_group');
$optioncss = GETPOST('optioncss','alpha');

View File

@ -39,7 +39,7 @@ $socid=0;
if ($user->societe_id > 0)
$socid = $user->societe_id;
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_user=GETPOST('search_user','alpha');
$userstatic=new User($db);

View File

@ -107,7 +107,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab
}
// Init search fields
$sall=GETPOST('sall', 'alphanohtml');
$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml'));
$search_user=GETPOST('search_user','alpha');
$search_login=GETPOST('search_login','alpha');
$search_lastname=GETPOST('search_lastname','alpha');