Add VAT number into thirdparty list

This commit is contained in:
Laurent Destailleur 2017-09-03 17:50:38 +02:00
parent 75b8462c03
commit ead7810ee7

View File

@ -74,6 +74,7 @@ $search_idprof3=trim(GETPOST('search_idprof3'));
$search_idprof4=trim(GETPOST('search_idprof4'));
$search_idprof5=trim(GETPOST('search_idprof5'));
$search_idprof6=trim(GETPOST('search_idprof6'));
$search_vat=trim(GETPOST('search_vat'));
$search_sale=trim(GETPOST("search_sale",'int'));
$search_categ_cus=trim(GETPOST("search_categ_cus",'int'));
$search_categ_sup=trim(GETPOST("search_categ_sup",'int'));
@ -182,8 +183,9 @@ $arrayfields=array(
's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4),
's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5),
's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6),
'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1),
's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel),
's.tva_intra'=>array('label'=>"VATIntra", 'checked'=>0),
'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1),
's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel),
's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm),
's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500),
's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
@ -245,6 +247,7 @@ if (empty($reshook))
$search_idprof4='';
$search_idprof5='';
$search_idprof6='';
$search_vat='';
$search_type='';
$search_type_thirdparty='';
$search_status=-1;
@ -386,7 +389,7 @@ 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, ";
$sql.= " st.libelle as stcomm, 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.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.fk_pays,";
$sql.= " s.email, s.phone, 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,";
$sql.= " typent.code as typent_code,";
@ -452,6 +455,7 @@ if (strlen($search_idprof3)) $sql.= natural_search("s.ape",$search_idprof3);
if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4",$search_idprof4);
if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5",$search_idprof5);
if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6",$search_idprof6);
if (strlen($search_vat)) $sql.= natural_search("s.tva_intra",$search_vat);
// Filter on type of thirdparty
if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")";
if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1";
@ -543,6 +547,7 @@ if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3
if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4);
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_country != '') $param.='&search_country='.urlencode($search_country);
if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty);
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
@ -813,11 +818,18 @@ if (! empty($arrayfields['s.idprof5']['checked']))
}
if (! empty($arrayfields['s.idprof6']['checked']))
{
// IdProf6
// IdProf6
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_idprof6" value="'.dol_escape_htmltag($search_idprof6).'">';
print '</td>';
}
if (! empty($arrayfields['s.tva_intra']['checked']))
{
// Vat number
print '<td class="liste_titre">';
print '<input class="flat searchstring" size="4" type="text" name="search_vat" value="'.dol_escape_htmltag($search_vat).'">';
print '</td>';
}
// Type (customer/prospect/supplier)
if (! empty($arrayfields['customerorsupplier']['checked']))
@ -950,7 +962,7 @@ if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_f
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);
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['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,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder);
@ -962,6 +974,7 @@ if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titr
if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'],$_SERVER["PHP_SELF"],"s.tva_intra","",$param,'class="nowrap"',$sortfield,$sortorder);
if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer
if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder);
@ -1151,6 +1164,11 @@ while ($i < min($num, $limit))
print "<td>".$obj->idprof6."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['s.tva_intra']['checked']))
{
print "<td>".$obj->tva_intra."</td>\n";
if (! $i) $totalarray['nbfield']++;
}
// Type
if (! empty($arrayfields['customerorsupplier']['checked']))
{