From b150e03b0606489550a6e355164d0632ea02cc89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 2 Sep 2013 00:47:30 +0200 Subject: [PATCH] Fix: bad merge. Fix: Restore backward compatibility. Add option hideifdisabled for call that does not need disabled users. --- htdocs/societe/class/societe.class.php | 35 +++++++++++++------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 9d7084650fb..bd1fae497f2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1441,7 +1441,7 @@ class Societe extends CommonObject $code .= $this->code_fournisseur . ' - '; } $name =$code.' '.$name; - } + } $result=''; $lien=$lienfin=''; @@ -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' - * @return array Array of contacts emails or mobile + * @param string $mode 'email' 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(); - $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.= " WHERE fk_soc = '".$this->id."'"; @@ -1608,18 +1609,18 @@ class Societe extends CommonObject if ($mode == 'email') $property=$obj->email; else if ($mode == 'mobile') $property=$obj->phone_mobile; - - if ($obj->statut == 1) + // Show all contact. If hidedisabled is 1, showonly contacts with status = 1 + if ($obj->statut == 1 || empty($hidedisabled)) { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; - - if(!empty($obj->poste)){ - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">"; - } - else - { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; - } + if (!empty($obj->poste)) + { + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))."(".$obj->poste.")"." <".$property.">"; + } + else + { + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname,$obj->lastname))." <".$property.">"; + } + } $i++; } }