Fix: bad merge.
Fix: Restore backward compatibility. Add option hideifdisabled for call that does not need disabled users.
This commit is contained in:
parent
3a4896609a
commit
b150e03b06
@ -1581,17 +1581,18 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of contacts emails or mobile existing for third party
|
* Return list of contacts emails or mobile existing for third party
|
||||||
*
|
*
|
||||||
* @param string $mode 'email' or 'mobile'
|
* @param string $mode 'email' or 'mobile'
|
||||||
* @return array Array of contacts emails or mobile
|
* @param int $hidedisabled 1=Hide contact if disabled
|
||||||
|
* @return array Array of contacts emails or mobile
|
||||||
*/
|
*/
|
||||||
function contact_property_array($mode='email')
|
function contact_property_array($mode='email', $hidedisabled=0)
|
||||||
{
|
{
|
||||||
$contact_property = array();
|
$contact_property = array();
|
||||||
|
|
||||||
|
|
||||||
$sql = "SELECT rowid, email, phone_mobile, lastname, poste, firstname";
|
$sql = "SELECT rowid, email, statut, phone_mobile, lastname, poste, firstname";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
|
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople";
|
||||||
$sql.= " WHERE fk_soc = '".$this->id."'";
|
$sql.= " WHERE fk_soc = '".$this->id."'";
|
||||||
|
|
||||||
@ -1608,18 +1609,18 @@ class Societe extends CommonObject
|
|||||||
if ($mode == 'email') $property=$obj->email;
|
if ($mode == 'email') $property=$obj->email;
|
||||||
else if ($mode == 'mobile') $property=$obj->phone_mobile;
|
else if ($mode == 'mobile') $property=$obj->phone_mobile;
|
||||||
|
|
||||||
|
// Show all contact. If hidedisabled is 1, showonly contacts with status = 1
|
||||||
if ($obj->statut == 1)
|
if ($obj->statut == 1 || empty($hidedisabled))
|
||||||
{
|
{
|
||||||
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";
|
if (!empty($obj->poste))
|
||||||
|
{
|
||||||
if(!empty($obj->poste)){
|
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">";
|
||||||
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">";
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";
|
||||||
$contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">";
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user