62 public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
65 $lastname = $this->lastname;
66 $firstname = $this->firstname;
67 if (empty($lastname)) {
68 $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->
name) ? $this->
name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company :
'')))));
72 if (!empty($option) && !empty($this->civility_code)) {
73 if ($langs->transnoentitiesnoconv(
"Civility".$this->civility_code) !=
"Civility".$this->civility_code) {
74 $ret .= $langs->transnoentitiesnoconv(
"Civility".$this->civility_code).
' ';
76 $ret .= $this->civility_code.
' ';
92 public function getBannerAddress($htmlkey, $object)
94 global $conf, $langs, $form, $extralanguages;
96 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
100 $elementforaltlanguage = $this->element;
101 if ($this->element ==
'societe') {
103 $thirdpartyid = $this->id;
105 if ($this->element ==
'contact') {
107 $contactid = $this->id;
108 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
110 if ($this->element ==
'user') {
112 $contactid = $this->contact_id;
113 $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc;
119 $coords = $this->getFullAddress(1,
', ',
getDolGlobalInt(
'MAIN_SHOW_REGION_IN_STATE_SELECT'));
121 if (!empty($conf->use_javascript_ajax)) {
124 if ($this->element ==
'contact' && !empty($conf->global->MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS)) {
125 $namecoords .= $object->name.
'<br>';
127 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
129 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
130 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
133 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
140 // List of extra languages
141 $arrayoflangcode = array();
142 if (!empty($conf->global->PDF_USE_ALSO_LANGUAGE_CODE)) {
143 $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
146 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
147 if (!is_object($extralanguages)) {
148 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
149 $extralanguages = new ExtraLanguages($this->db);
151 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
153 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
154 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".join(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
155 $this->fetchValuesForExtraLanguages();
156 if (!is_object($form)) {
157 $form = new Form($this->db);
160 // If there is extra languages
161 foreach ($arrayoflangcode as $extralangcode) {
162 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
163 // This also call dol_format_address()
164 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
165 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
167 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
172 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
173 if (!in_array($this->country_code, $countriesusingstate) && empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)
174 && empty($conf->global->SOCIETE_DISABLE_STATE) && $this->state) {
175 if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 && $this->region) {
176 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
178 $out .= ($outdone ? ' - ' : '').$this->state;
184 $out = '<div class="address
inline-block
">'.$out.'</div>';
187 if (!empty($this->phone) || !empty($this->phone_pro) || !empty($this->phone_mobile) || !empty($this->phone_perso) || !empty($this->fax) || !empty($this->office_phone) || !empty($this->user_mobile) || !empty($this->office_fax)) {
188 $out .= ($outdone ? '<br>' : '');
190 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
191 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
194 if (!empty($this->phone_pro)) {
195 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
198 if (!empty($this->phone_mobile)) {
199 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
202 if (!empty($this->phone_perso)) {
203 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
206 if (!empty($this->office_phone)) {
207 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
210 if (!empty($this->user_mobile)) {
211 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
214 if (!empty($this->fax)) {
215 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
218 if (!empty($this->office_fax)) {
219 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
224 $out .= '<div style="clear: both;
"></div>';
227 if (!empty($this->email)) {
228 $out .= dol_print_email($this->email, $this->id, $object->id, 'AC_EMAIL', 0, 0, 1);
231 if (!empty($this->url)) {
232 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
233 $out .= dol_print_url($this->url, '_blank', 0, 1);
237 if (isModEnabled('socialnetworks')) {
238 $outsocialnetwork = '';
240 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
241 $socialnetworksdict = getArrayOfSocialNetworks();
242 foreach ($this->socialnetworks as $key => $value) {
244 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
250 if ($outsocialnetwork) {
251 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
256 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
267 public function setUpperOrLowerCase()
271 if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) {
272 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
273 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
274 $this->name = dol_ucwords(dol_strtolower($this->name));
275 $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):'';
277 if (!empty($conf->global->MAIN_ALL_TO_UPPER)) {
278 $this->lastname = dol_strtoupper($this->lastname);
279 $this->name = dol_strtoupper($this->name);
280 $this->name_alias = dol_strtoupper($this->name_alias);
282 if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) {
283 $this->address = dol_strtoupper($this->address);
284 $this->town = dol_strtoupper($this->town);
286 if (isset($this->email)) {
287 $this->email = dol_strtolower($this->email);
289 if (isset($this->personal_email)) {
290 $this->personal_email = dol_strtolower($this->personal_email);
trait CommonPeople
Superclass for thirdparties, contacts, members or users.
getFullName($langs, $option=0, $nameorder=-1, $maxlen=0)
Return full name (civility+' '+name+' '+lastname)
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
$conf db name
Only used if Module[ID]Name translation string is not found.