Date: Tue, 1 Dec 2020 09:58:55 +0100
Subject: [PATCH 2/2] NEW address column in company list
---
htdocs/societe/list.php | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php
index 5a843e9856a..48a01a94390 100644
--- a/htdocs/societe/list.php
+++ b/htdocs/societe/list.php
@@ -72,6 +72,7 @@ $search_customer_code = trim(GETPOST('search_customer_code', 'alpha'));
$search_supplier_code = trim(GETPOST('search_supplier_code', 'alpha'));
$search_account_customer_code = trim(GETPOST('search_account_customer_code', 'alpha'));
$search_account_supplier_code = trim(GETPOST('search_account_supplier_code', 'alpha'));
+$search_address = trim(GETPOST('search_address', 'alpha'));
$search_town = trim(GETPOST("search_town", 'alpha'));
$search_zip = trim(GETPOST("search_zip", 'alpha'));
$search_state = trim(GETPOST("search_state", 'alpha'));
@@ -186,6 +187,7 @@ $arrayfields = array(
's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'position'=>11, 'checked'=>$checkedsuppliercode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'position'=>13, 'checked'=>$checkedcustomeraccountcode),
's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'position'=>14, 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled) || !empty($conf->supplier_invoice->enabled))),
+ 's.address'=>array('label'=>"Address", 'position'=>19, 'checked'=>1),
's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1),
'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0),
@@ -289,6 +291,7 @@ if (empty($reshook))
$search_supplier_code = '';
$search_account_customer_code = '';
$search_account_supplier_code = '';
+ $search_address = '';
$search_town = "";
$search_zip = "";
$search_state = "";
@@ -386,7 +389,7 @@ if ($resql)
}
} else dol_print_error($db);
-$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
+$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.address, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
$sql .= " s.entity,";
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
$sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
@@ -448,6 +451,7 @@ if ($search_customer_code) $sql .= natural_search("s.code_client", $search_custo
if ($search_supplier_code) $sql .= natural_search("s.code_fournisseur", $search_supplier_code);
if ($search_account_customer_code) $sql .= natural_search("s.code_compta", $search_account_customer_code);
if ($search_account_supplier_code) $sql .= natural_search("s.code_compta_fournisseur", $search_account_supplier_code);
+if ($search_address) $sql.= natural_search('s.address', $search_address);
if ($search_town) $sql .= natural_search("s.town", $search_town);
if (strlen($search_zip)) $sql .= natural_search("s.zip", $search_zip);
if ($search_state) $sql .= natural_search("state.nom", $search_state);
@@ -545,6 +549,7 @@ if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
if ($search_id > 0) $param .= "&search_id=".urlencode($search_id);
if ($search_nom != '') $param .= "&search_nom=".urlencode($search_nom);
if ($search_alias != '') $param .= "&search_alias=".urlencode($search_alias);
+if ($search_address != '') $param .= '&search_address=' . urlencode($search_address);
if ($search_town != '') $param .= "&search_town=".urlencode($search_town);
if ($search_zip != '') $param .= "&search_zip=".urlencode($search_zip);
if ($search_phone != '') $param .= "&search_phone=".urlencode($search_phone);
@@ -766,6 +771,13 @@ if (!empty($arrayfields['s.code_compta_fournisseur']['checked']))
print '';
print '';
}
+// Address
+if (!empty($arrayfields['s.address']['checked']))
+{
+ print '| ';
+ print '';
+ print ' | ';
+}
// Town
if (!empty($arrayfields['s.town']['checked']))
{
@@ -975,6 +987,7 @@ if (!empty($arrayfields['s.code_client']['checked'])) print_liste_fi
if (!empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_fournisseur", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'], $_SERVER["PHP_SELF"], "s.code_compta", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'], $_SERVER["PHP_SELF"], "s.code_compta_fournisseur", "", $param, '', $sortfield, $sortorder);
+if (!empty($arrayfields['s.address']['checked'])) print_liste_field_titre($arrayfields['s.address']['label'], $_SERVER['PHP_SELF'], 's.address', '', $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], "s.zip", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
@@ -1103,6 +1116,12 @@ while ($i < min($num, $limit))
print ''.$obj->code_compta_fournisseur.' | ';
if (!$i) $totalarray['nbfield']++;
}
+ // Address
+ if (!empty($arrayfields['s.address']['checked']))
+ {
+ print ''.$obj->address.' | ';
+ if (!$i) $totalarray['nbfield']++;
+ }
// Town
if (!empty($arrayfields['s.town']['checked']))
{