diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php
index cdb7a64a998..ed86a61d7bd 100644
--- a/htdocs/comm/propal/list.php
+++ b/htdocs/comm/propal/list.php
@@ -548,6 +548,9 @@ $companystatic = new Societe($db);
$projectstatic = new Project($db);
$formcompany = new FormCompany($db);
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$title = $langs->trans('ListOfProposals');
$help_url = 'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos';
llxHeader('', $title, $help_url);
@@ -656,11 +659,15 @@ if ($search_project) {
if ($search_availability) {
$sql .= " AND p.fk_availability IN (".$db->sanitize($db->escape($search_availability)).')';
}
-if ($search_societe) {
- $sql .= natural_search('s.nom', $search_societe);
-}
-if ($search_societe_alias) {
- $sql .= natural_search('s.name_alias', $search_societe_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
+} else {
+ if ($search_societe) {
+ $sql .= natural_search('s.nom', $search_societe);
+ }
+ if ($search_societe_alias) {
+ $sql .= natural_search('s.name_alias', $search_societe_alias);
+ }
}
if ($search_login) {
$sql .= natural_search(array("u.login", "u.firstname", "u.lastname"), $search_login);
@@ -1777,7 +1784,7 @@ if ($resql) {
// Thirdparty
if (!empty($arrayfields['s.nom']['checked'])) {
print '
';
- print $companystatic->getNomUrl(1, 'customer');
+ print $companystatic->getNomUrl(1, 'customer', 0, 0, 1, empty($arrayfields['s.name_alias']['checked']) ? 0 : 1);
print ' | ';
if (!$i) {
$totalarray['nbfield']++;
diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php
index b4c9fd6772f..4257d1414b1 100644
--- a/htdocs/commande/list.php
+++ b/htdocs/commande/list.php
@@ -789,6 +789,9 @@ $company_url_list = array();
$formcompany = new FormCompany($db);
$projectstatic = new Project($db);
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$title = $langs->trans("Orders");
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
@@ -935,11 +938,15 @@ if ($search_country) {
if ($search_type_thirdparty && $search_type_thirdparty != '-1') {
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
+} else {
+ if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
+ }
+ if ($search_company_alias) {
+ $sql .= natural_search('s.name_alias', $search_company_alias);
+ }
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 540722e8c49..348897369ee 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -558,6 +558,9 @@ $companystatic = new Societe($db);
$companyparent = new Societe($db);
$company_url_list = array();
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$sql = 'SELECT';
if ($sall || $search_user > 0) {
$sql = 'SELECT DISTINCT';
@@ -670,11 +673,15 @@ if ($search_project_ref) {
if ($search_project) {
$sql .= natural_search('p.title', $search_project);
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
+} else {
+ if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
+ }
+ if ($search_company_alias) {
+ $sql .= natural_search('s.name_alias', $search_company_alias);
+ }
}
if ($search_parent_name) {
$sql .= natural_search('s2.nom', $search_parent_name);
diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 89df5cac1d2..4a6c5795602 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -67,7 +67,7 @@ $search_date_order_endyear = GETPOST('search_date_order_endyear', 'int');
$search_date_order_start = dol_mktime(0, 0, 0, $search_date_order_startmonth, $search_date_order_startday, $search_date_order_startyear); // Use tzserver
$search_date_order_end = dol_mktime(23, 59, 59, $search_date_order_endmonth, $search_date_order_endday, $search_date_order_endyear);
-$search_date_delivery_startday = GETPOST('search_date_delivery_startday', 'int');
+$search_date_delivery_starvtday = GETPOST('search_date_delivery_startday', 'int');
$search_date_delivery_startmonth = GETPOST('search_date_delivery_startmonth', 'int');
$search_date_delivery_startyear = GETPOST('search_date_delivery_startyear', 'int');
$search_date_delivery_endday = GETPOST('search_date_delivery_endday', 'int');
@@ -751,6 +751,9 @@ if ($search_billed > 0) {
//$help_url="EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
$help_url = '';
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$sql = 'SELECT';
if ($sall) {
$sql = 'SELECT DISTINCT';
@@ -814,11 +817,15 @@ if ($search_refsupp) {
if ($sall) {
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
+} else {
+ if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
+ }
+ if ($search_company_alias) {
+ $sql .= natural_search('s.name_alias', $search_company_alias);
+ }
}
if ($search_request_author) {
$sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_request_author);
@@ -872,12 +879,6 @@ if ($search_country) {
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
$sql .= " AND s.fk_typent IN (".$db->sanitize($db->escape($search_type_thirdparty)).')';
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
-}
if ($search_sale > 0) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
}
diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php
index e69addd34fc..be215e891eb 100644
--- a/htdocs/fourn/facture/list.php
+++ b/htdocs/fourn/facture/list.php
@@ -404,6 +404,9 @@ $facturestatic = new FactureFournisseur($db);
$formcompany = new FormCompany($db);
$thirdparty = new Societe($db);
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$sql = "SELECT";
if ($search_all) {
$sql = 'SELECT DISTINCT';
@@ -506,11 +509,15 @@ if ($search_type != '' && $search_type >= 0) {
if ($search_project) {
$sql .= natural_search('p.ref', $search_project);
}
-if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
-}
-if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
+} else {
+ if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
+ }
+ if ($search_company_alias) {
+ $sql .= natural_search('s.name_alias', $search_company_alias);
+ }
}
if ($search_town) {
$sql .= natural_search('s.town', $search_town);
diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php
index 9f9fd3f75cb..994f4024b52 100644
--- a/htdocs/projet/list.php
+++ b/htdocs/projet/list.php
@@ -410,6 +410,9 @@ if (count($listofprojectcontacttypeexternal) == 0) {
$listofprojectcontacttypeexternal[0] = '0'; // To avoid sql syntax error if not found
}
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once.
$sql = "SELECT ".$distinct." p.rowid as id, p.ref, p.title, p.fk_statut as status, p.fk_opp_status, p.public, p.fk_user_creat,";
$sql .= " p.datec as date_creation, p.dateo as date_start, p.datee as date_end, p.opp_amount, p.opp_percent, (p.opp_amount*p.opp_percent/100) as opp_weighted_amount, p.tms as date_update, p.budget_amount,";
@@ -469,11 +472,15 @@ if ($search_ref) {
if ($search_label) {
$sql .= natural_search('p.title', $search_label);
}
-if ($search_societe) {
- $sql .= natural_search('s.nom', $search_societe);
-}
-if ($search_societe_alias) {
- $sql .= natural_search('s.name_alias', $search_societe_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
+} else {
+ if ($search_societe) {
+ $sql .= natural_search('s.nom', $search_societe);
+ }
+ if ($search_societe_alias) {
+ $sql .= natural_search('s.name_alias', $search_societe_alias);
+ }
}
if ($search_opp_amount) {
$sql .= natural_search('p.opp_amount', $search_opp_amount, 1);
diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php
index f7ba2cc89f4..72c5eb25874 100644
--- a/htdocs/projet/tasks/list.php
+++ b/htdocs/projet/tasks/list.php
@@ -408,11 +408,15 @@ if ($search_task_progress) {
if ($search_task_budget_amount) {
$sql .= natural_search('t.budget_amount', $search_task_budget_amount, 1);
}
-if ($search_societe) {
- $sql .= natural_search('s.nom', $search_societe);
-}
-if ($search_societe_alias) {
- $sql .= natural_search('s.name_alias', $search_societe_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
+} else {
+ if ($search_societe) {
+ $sql .= natural_search('s.nom', $search_societe);
+ }
+ if ($search_societe_alias) {
+ $sql .= natural_search('s.name_alias', $search_societe_alias);
+ }
}
if ($search_date_start) {
$sql .= " AND t.dateo >= '".$db->idate($search_date_start)."'";
diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php
index fce9813987c..c06a4574928 100644
--- a/htdocs/projet/tasks/time.php
+++ b/htdocs/projet/tasks/time.php
@@ -1510,6 +1510,9 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
*/
$tasks = array();
+ $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+ $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
+
$sql = "SELECT t.rowid, t.fk_task, t.task_date, t.task_datehour, t.task_date_withhour, t.task_duration, t.fk_user, t.note, t.thm,";
$sql .= " t.fk_product,";
$sql .= " pt.ref, pt.label, pt.fk_projet,";
@@ -1555,11 +1558,15 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0 || $allprojectforuser
if ($search_task_ref) {
$sql .= natural_search('pt.ref', $search_task_ref);
}
- if ($search_company) {
- $sql .= natural_search('s.nom', $search_company);
- }
- if ($search_company_alias) {
- $sql .= natural_search('s.name_alias', $search_company_alias);
+ if (empty($arrayfields['s.name_alias']['checked']) && $search_company) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_company);
+ } else {
+ if ($search_company) {
+ $sql .= natural_search('s.nom', $search_company);
+ }
+ if ($search_company_alias) {
+ $sql .= natural_search('s.name_alias', $search_company_alias);
+ }
}
if ($search_project_ref) {
$sql .= natural_search('p.ref', $search_project_ref);
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 28523fa720c..bb36d023bd5 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -442,6 +442,9 @@ if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) {
$title = $langs->trans("Suppliers");
}
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
// Select every potentiels, and note each potentiels which fit in search parameters
$tab_level = array();
$sql = "SELECT code, label, sortorder";
@@ -598,11 +601,16 @@ if (strlen($search_cti)) {
if ($search_id > 0) {
$sql .= natural_search("s.rowid", $search_id, 1);
}
-if ($search_nom) {
- $sql .= natural_search("s.nom", $search_nom);
-}
-if ($search_alias) {
- $sql .= natural_search("s.name_alias", $search_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_nom) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_nom);
+} else {
+ if ($search_nom) {
+ $sql .= natural_search("s.nom", $search_nom);
+ }
+
+ if ($search_alias) {
+ $sql .= natural_search("s.name_alias", $search_alias);
+ }
}
if ($search_nom_only) {
$sql .= natural_search("s.nom", $search_nom_only);
diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php
index 3439c3ee11d..add084e91ab 100644
--- a/htdocs/supplier_proposal/list.php
+++ b/htdocs/supplier_proposal/list.php
@@ -288,6 +288,9 @@ $formpropal = new FormPropal($db);
$companystatic = new Societe($db);
$formcompany = new FormCompany($db);
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
+
$title = $langs->trans('ListOfSupplierProposals');
$help_url = 'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur';
@@ -362,11 +365,15 @@ if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
if ($search_ref) {
$sql .= natural_search('sp.ref', $search_ref);
}
-if ($search_societe) {
- $sql .= natural_search('s.nom', $search_societe);
-}
-if ($search_societe_alias) {
- $sql .= natural_search('s.name_alias', $search_societe_alias);
+if (empty($arrayfields['s.name_alias']['checked']) && $search_societe) {
+ $sql .= natural_search(array("s.nom", "s.name_alias"), $search_societe);
+} else {
+ if ($search_societe) {
+ $sql .= natural_search('s.nom', $search_societe);
+ }
+ if ($search_societe_alias) {
+ $sql .= natural_search('s.name_alias', $search_societe_alias);
+ }
}
if ($search_login) {
$sql .= natural_search(array('u.lastname', 'u.firstname', 'u.login'), $search_login);