Merge pull request #22472 from Easya-Solutions/new-order-list-parent-company
NEW parent company column and filter in order list
This commit is contained in:
commit
88f38c7117
@ -80,6 +80,7 @@ $search_ref = GETPOST('search_ref', 'alpha') != '' ?GETPOST('search_ref', 'alpha
|
||||
$search_ref_customer = GETPOST('search_ref_customer', 'alpha');
|
||||
$search_company = GETPOST('search_company', 'alpha');
|
||||
$search_company_alias = GETPOST('search_company_alias', 'alpha');
|
||||
$search_parent_name = trim(GETPOST('search_parent_name', 'alphanohtml'));
|
||||
$search_town = GETPOST('search_town', 'alpha');
|
||||
$search_zip = GETPOST('search_zip', 'alpha');
|
||||
$search_state = GETPOST('search_state', 'alpha');
|
||||
@ -178,6 +179,7 @@ $arrayfields = array(
|
||||
'p.title'=>array('label'=>"ProjectLabel", 'checked'=>0, 'enabled'=>(!isModEnabled('project') ? 0 : 1), 'position'=>25),
|
||||
's.nom'=>array('label'=>"ThirdParty", 'checked'=>1, 'position'=>30),
|
||||
's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>-1, 'position'=>31),
|
||||
's2.nom'=>array('label'=>'ParentCompany', 'position'=>32, 'checked'=>0),
|
||||
's.town'=>array('label'=>"Town", 'checked'=>-1, 'position'=>35),
|
||||
's.zip'=>array('label'=>"Zip", 'checked'=>-1, 'position'=>40),
|
||||
'state.nom'=>array('label'=>"StateShort", 'checked'=>0, 'position'=>45),
|
||||
@ -253,6 +255,7 @@ if (empty($reshook)) {
|
||||
$search_ref_customer = '';
|
||||
$search_company = '';
|
||||
$search_company_alias = '';
|
||||
$search_parent_name = '';
|
||||
$search_town = '';
|
||||
$search_zip = "";
|
||||
$search_state = "";
|
||||
@ -782,6 +785,7 @@ if (!empty($conf->margin->enabled)) {
|
||||
$formmargin = new FormMargin($db);
|
||||
}
|
||||
$companystatic = new Societe($db);
|
||||
$company_url_list = array();
|
||||
$formcompany = new FormCompany($db);
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
@ -793,6 +797,8 @@ if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,';
|
||||
$sql .= " s.parent as fk_parent,";
|
||||
$sql .= " s2.nom as name2,";
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= " country.code as country_code,";
|
||||
@ -820,6 +826,7 @@ $parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s2 ON s2.rowid = s.parent";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
@ -937,6 +944,9 @@ if ($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);
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
|
||||
}
|
||||
@ -1121,6 +1131,9 @@ if ($resql) {
|
||||
if ($search_company_alias) {
|
||||
$param .= '&search_company_alias='.urlencode($search_company_alias);
|
||||
}
|
||||
if ($search_parent_name != '') {
|
||||
$param .= '&search_parent_name='.urlencode($search_parent_name);
|
||||
}
|
||||
if ($search_ref_customer) {
|
||||
$param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
||||
}
|
||||
@ -1451,6 +1464,12 @@ if ($resql) {
|
||||
print '<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Parent company
|
||||
if (!empty($arrayfields['s2.nom']['checked'])) {
|
||||
print '<td class="liste_titre center">';
|
||||
print '<input class="flat searchstring maxwidth75imp" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).'"></td>';
|
||||
@ -1707,6 +1726,9 @@ if ($resql) {
|
||||
if (!empty($arrayfields['s.name_alias']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"], 's.name_alias', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($arrayfields['s2.nom']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER['PHP_SELF'], 's2.nom', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
}
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
}
|
||||
@ -2008,6 +2030,27 @@ if ($resql) {
|
||||
}
|
||||
}
|
||||
|
||||
// Parent company
|
||||
if (!empty($arrayfields['s2.nom']['checked'])) {
|
||||
print '<td class="center tdoverflowmax100">';
|
||||
if ($obj->fk_parent > 0) {
|
||||
if (!isset($company_url_list[$obj->fk_parent])) {
|
||||
$companyparent = new Societe($db);
|
||||
$res = $companyparent->fetch($obj->fk_parent);
|
||||
if ($res > 0) {
|
||||
$company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
|
||||
}
|
||||
}
|
||||
if (isset($company_url_list[$obj->fk_parent])) {
|
||||
print $company_url_list[$obj->fk_parent];
|
||||
}
|
||||
}
|
||||
print "</td>";
|
||||
if (!$i) {
|
||||
$totalarray['nbfield']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Town
|
||||
if (!empty($arrayfields['s.town']['checked'])) {
|
||||
print '<td class="nocellnopadd">';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user