commit
2b7c2a9040
@ -640,6 +640,7 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
|||||||
// Init and check authentication
|
// Init and check authentication
|
||||||
$objectresp=array();
|
$objectresp=array();
|
||||||
$arraythirdparties=array();
|
$arraythirdparties=array();
|
||||||
|
|
||||||
$errorcode='';$errorlabel='';
|
$errorcode='';$errorlabel='';
|
||||||
$error=0;
|
$error=0;
|
||||||
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
|
$fuser=check_authentication($authentication,$error,$errorcode,$errorlabel);
|
||||||
@ -647,9 +648,11 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
$sql ="SELECT s.rowid, s.nom as ref, s.ref_ext, s.address, s.zip, s.town, p.libelle as country, s.phone, s.fax, s.url";
|
$sql ="SELECT s.rowid as socRowid, s.nom as ref, s.ref_ext, s.address, s.zip, s.town, p.libelle as country, s.phone, s.fax, s.url, extra.*";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."societe as s";
|
$sql.=" FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid';
|
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_pays as p ON s.fk_pays = p.rowid';
|
||||||
|
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as extra ON s.rowid=fk_object";
|
||||||
|
|
||||||
$sql.=" WHERE entity=".$conf->entity;
|
$sql.=" WHERE entity=".$conf->entity;
|
||||||
foreach($filterthirdparty as $key => $val)
|
foreach($filterthirdparty as $key => $val)
|
||||||
{
|
{
|
||||||
@ -658,6 +661,11 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
|||||||
if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") ";
|
if ($key == 'category' && $val != '') $sql.=" AND s.rowid IN (SELECT fk_societe FROM ".MAIN_DB_PREFIX."categorie_societe WHERE fk_categorie=".$db->escape($val).") ";
|
||||||
}
|
}
|
||||||
dol_syslog("Function: getListOfThirdParties sql=".$sql);
|
dol_syslog("Function: getListOfThirdParties sql=".$sql);
|
||||||
|
|
||||||
|
$extrafields=new ExtraFields($db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
|
||||||
|
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -666,8 +674,13 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
|||||||
$i=0;
|
$i=0;
|
||||||
while ($i < $num)
|
while ($i < $num)
|
||||||
{
|
{
|
||||||
|
$extrafieldsOptions=array();
|
||||||
$obj=$db->fetch_object($resql);
|
$obj=$db->fetch_object($resql);
|
||||||
$arraythirdparties[]=array('id'=>$obj->rowid,
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
|
{
|
||||||
|
$extrafieldsOptions['options_'.$key] = $obj->{$key};
|
||||||
|
}
|
||||||
|
$arraythirdparties[]=array('id'=>$obj->socRowid,
|
||||||
'ref'=>$obj->ref,
|
'ref'=>$obj->ref,
|
||||||
'ref_ext'=>$obj->ref_ext,
|
'ref_ext'=>$obj->ref_ext,
|
||||||
'adress'=>$obj->adress,
|
'adress'=>$obj->adress,
|
||||||
@ -678,6 +691,8 @@ function getListOfThirdParties($authentication,$filterthirdparty)
|
|||||||
'fax'=>$obj->fax,
|
'fax'=>$obj->fax,
|
||||||
'url'=>$obj->url
|
'url'=>$obj->url
|
||||||
);
|
);
|
||||||
|
$arraythirdparties[$i] = array_merge($arraythirdparties[$i],$extrafieldsOptions);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user