Update list.php

This commit is contained in:
Anthony Berton 2021-01-16 23:41:06 +01:00
parent a4109d3fd0
commit 57f4ac2072

View File

@ -93,6 +93,7 @@ $search_categ_cus = trim(GETPOST("search_categ_cus", 'int'));
$search_categ_sup = trim(GETPOST("search_categ_sup", 'int'));
$search_country = GETPOST("search_country", 'intcomma');
$search_type_thirdparty = GETPOST("search_type_thirdparty", 'int');
$search_price_level = GETPOST('search_prive_level', 'int');
$search_staff = GETPOST("search_staff", 'int');
$search_status = GETPOST("search_status", 'int');
$search_type = GETPOST('search_type', 'alpha');
@ -188,8 +189,8 @@ $arrayfields = array(
'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'=>0),
's.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>0),
's.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>1),
's.zip'=>array('label'=>"Zip", 'position'=>20, 'checked'=>1),
's.town'=>array('label'=>"Town", 'position'=>21, 'checked'=>0),
'state.nom'=>array('label'=>"State", 'position'=>22, 'checked'=>0),
'region.nom'=>array('label'=>"Region", 'position'=>23, 'checked'=>0),
'country.code_iso'=>array('label'=>"Country", 'position'=>24, 'checked'=>0),
@ -198,7 +199,7 @@ $arrayfields = array(
's.phone'=>array('label'=>"Phone", 'position'=>27, 'checked'=>1),
's.fax'=>array('label'=>"Fax", 'position'=>28, 'checked'=>0),
'typent.code'=>array('label'=>"ThirdPartyType", 'position'=>29, 'checked'=>$checkedtypetiers),
'staff.code'=>array('label'=>"Staff", 'position'=>30, 'checked'=>0),
'staff.code'=>array('label'=>"Staff", 'position'=>31, 'checked'=>0),
's.siren'=>array('label'=>"ProfId1Short", 'position'=>40, 'checked'=>$checkedprofid1),
's.siret'=>array('label'=>"ProfId2Short", 'position'=>41, 'checked'=>$checkedprofid2),
's.ape'=>array('label'=>"ProfId3Short", 'position'=>42, 'checked'=>$checkedprofid3),
@ -215,6 +216,12 @@ $arrayfields = array(
's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100),
);
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
$arrayfields['s.price_level'] =array('label'=>"PriceLevel", 'position'=>30, 'checked'=>0);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
@ -308,6 +315,7 @@ if (empty($reshook))
$search_idprof6 = '';
$search_vat = '';
$search_type = '';
$search_prive_level = '';
$search_type_thirdparty = '';
$search_staff = '';
$search_status = -1;
@ -395,7 +403,7 @@ $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,";
$sql .= " s.tms as date_update, s.datec as date_creation,";
$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,";
$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,s.price_level,";
$sql .= " s2.nom as name2,";
$sql .= " typent.code as typent_code,";
$sql .= " staff.code as staff_code,";
@ -475,6 +483,7 @@ if ($search_type > 0 && in_array($search_type, array('4'))) $sql .= " AN
if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0";
if ($search_status != '' && $search_status >= 0) $sql .= natural_search("s.status", $search_status, 2);
if (!empty($conf->barcode->enabled) && $search_barcode) $sql .= natural_search("s.barcode", $search_barcode);
if ($search_prive_level && $search_prive_level != '-1') $sql .= natural_search("s.price_level", $search_prive_level, 2);
if ($search_type_thirdparty && $search_type_thirdparty != '-1') $sql .= natural_search("s.fk_typent", $search_type_thirdparty, 2);
if (!empty($search_staff) && $search_staff != '-1') $sql .= natural_search("s.fk_effectif", $search_staff, 2);
if ($search_level) $sql .= natural_search("s.fk_prospectlevel", join(',', $search_level), 3);
@ -571,6 +580,7 @@ if ($search_idprof4 != '') $param .= '&search_idprof4='.urlencode($search_idprof
if ($search_idprof5 != '') $param .= '&search_idprof5='.urlencode($search_idprof5);
if ($search_idprof6 != '') $param .= '&search_idprof6='.urlencode($search_idprof6);
if ($search_vat != '') $param .= '&search_vat='.urlencode($search_vat);
if ($search_prive_level != '') $param .= '&search_prive_level='.urlencode($search_prive_level);
if ($search_type_thirdparty != '') $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($search_type != '') $param .= '&search_type='.urlencode($search_type);
if (is_array($search_level) && count($search_level)) foreach ($search_level as $slevel) $param .= '&search_level[]='.urlencode($slevel);
@ -779,13 +789,6 @@ if (!empty($arrayfields['s.address']['checked']))
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_address" value="'.dol_escape_htmltag($search_address).'">';
print '</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
print '</td>';
}
// Zip
if (!empty($arrayfields['s.zip']['checked']))
{
@ -793,6 +796,13 @@ if (!empty($arrayfields['s.zip']['checked']))
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).'">';
print '</td>';
}
// Town
if (!empty($arrayfields['s.town']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).'">';
print '</td>';
}
// State
if (!empty($arrayfields['state.nom']['checked']))
{
@ -821,6 +831,16 @@ if (!empty($arrayfields['typent.code']['checked']))
print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1);
print '</td>';
}
// Multiprice level
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
if (!empty($arrayfields['s.price_level']['checked']))
{
print '<td class="liste_titre">';
print '<input class="flat searchstring maxwidth50imp" type="text" name="search_prive_level" value="'.dol_escape_htmltag($search_prive_level).'">';
print '</td>';
}
}
// Staff
if (!empty($arrayfields['staff.code']['checked']))
{
@ -989,8 +1009,8 @@ if (!empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_fi
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['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], "s.town", "", $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);
if (!empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'], $_SERVER["PHP_SELF"], "region.nom", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
@ -998,7 +1018,7 @@ if (!empty($arrayfields['typent.code']['checked'])) print_liste_field_titre
if (!empty($arrayfields['staff.code']['checked'])) print_liste_field_titre($arrayfields['staff.code']['label'], $_SERVER["PHP_SELF"], "staff.code", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'], $_SERVER["PHP_SELF"], "s.email", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'], $_SERVER["PHP_SELF"], "s.phone", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.fax']['checked'])) print_liste_field_titre($arrayfields['s.fax']['label'], $_SERVER["PHP_SELF"], "s.fax", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'], $_SERVER["PHP_SELF"], "s.url", "", $param, '', $sortfield, $sortorder);
if (!empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"), $textprofid[1], 1, 0), $_SERVER["PHP_SELF"], "s.siren", "", $param, '', $sortfield, $sortorder, 'nowrap ');
if (!empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"), $textprofid[2], 1, 0), $_SERVER["PHP_SELF"], "s.siret", "", $param, '', $sortfield, $sortorder, 'nowrap ');
@ -1011,6 +1031,12 @@ if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_fi
if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center ');
if (!empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center ');
// Multiprice level
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
if (!empty($arrayfields['s.price_level']['checked'])) print_liste_field_titre($arrayfields['s.price_level']['label'], $_SERVER["PHP_SELF"], "s.price_level", "", $param, '', $sortfield, $sortorder);
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
@ -1123,18 +1149,18 @@ while ($i < min($num, $limit))
print '<td>'.$obj->address.'</td>';
if (!$i) $totalarray['nbfield']++;
}
// Town
if (!empty($arrayfields['s.town']['checked']))
{
print "<td>".$obj->town."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Zip
if (!empty($arrayfields['s.zip']['checked']))
{
print "<td>".$obj->zip."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// Town
if (!empty($arrayfields['s.town']['checked']))
{
print "<td>".$obj->town."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
// State
if (!empty($arrayfields['state.nom']['checked']))
{
@ -1165,6 +1191,15 @@ while ($i < min($num, $limit))
print '</td>';
if (!$i) $totalarray['nbfield']++;
}
// Multiprice level
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES))
{
if (!empty($arrayfields['s.price_level']['checked']))
{
print "<td>".$obj->price_level."</td>\n";
if (!$i) $totalarray['nbfield']++;
}
}
// Staff
if (!empty($arrayfields['staff.code']['checked']))
{