108 public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
111 $lastname = $this->lastname;
112 $firstname = $this->firstname;
113 if (empty($lastname)) {
115 $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->
name) ? $this->
name : (property_exists($this,
'nom') && isset($this->nom) ? $this->nom : (property_exists($this,
'societe') && isset($this->societe) ? $this->societe : (property_exists($this,
'company') && isset($this->company) ? $this->company :
'')))));
119 if (!empty($option) && !empty($this->civility_code)) {
120 if ($langs->transnoentitiesnoconv(
"Civility".$this->civility_code) !=
"Civility".$this->civility_code) {
121 $ret .= $langs->transnoentitiesnoconv(
"Civility".$this->civility_code).
' ';
123 $ret .= $this->civility_code.
' ';
146 return $this->
getFullName($langs, $option, $nameorder, $maxlen);
158 $code = (!empty($this->civility_code) ? $this->civility_code : (!empty($this->civility_id) ? $this->civility : (!empty($this->civilite) ? $this->civilite :
'')));
163 $langs->load(
"dict");
164 return $langs->getLabelFromKey($this->db,
"Civility".$code,
"c_civility",
"code",
"label", $code);
178 global
$conf, $langs, $form, $extralanguages;
180 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
184 $elementforaltlanguage = $this->element;
185 if ($this->element ===
'societe' && $this instanceof
Societe) {
188 if ($this->element ===
'contact' && $this instanceof
Contact) {
190 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
192 if ($this->element ==
'member' && $this instanceof
Adherent) {
194 $thirdpartyid = empty($this->socid) ? 0 : $this->socid;
196 if ($this->element ===
'user' && $this instanceof
User) {
197 $contactid = $this->contact_id;
209 if (!empty(
$conf->use_javascript_ajax)) {
212 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
213 $namecoords .=
$object->name.
'<br>';
215 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
217 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\', \
''.dol_escape_js(
'<span class="opacitymedium">'.$langs->trans(
"HelpCopyToClipboard").
'</span>').
'\', \
''.dol_escape_js($langs->trans(
"Copy").
' / '.$langs->trans(
"Paste")).
'\');
">';
218 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
221 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
228 // List of extra languages
229 $arrayoflangcode = array();
230 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
231 $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
234 if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) {
235 if (!is_object($extralanguages)) {
236 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
237 $extralanguages = new ExtraLanguages($this->db);
239 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
241 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
242 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".implode(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
243 $this->fetchValuesForExtraLanguages();
244 if (!is_object($form)) {
245 $form = new Form($this->db);
248 // If there is extra languages
249 foreach ($arrayoflangcode as $extralangcode) {
250 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
251 // This also call dol_format_address()
252 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
253 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
255 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
260 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
261 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
262 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
263 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
264 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
266 $out .= ($outdone ? ' - ' : '').$this->state;
272 $out = '<div class="address inline-block
">'.$out.'</div>';
275 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)) {
276 $out .= ($outdone ? '<br>' : '');
281 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
282 // $out .= ($outphonedone ? ' ' : '');
283 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
287 if (!empty($this->phone_pro)) {
288 $out .= ($outphonedone ? ' ' : '');
289 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
293 if (!empty($this->phone_mobile)) {
294 $out .= ($outphonedone ? ' ' : '');
295 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
299 if (!empty($this->phone_perso)) {
300 $out .= ($outphonedone ? ' ' : '');
301 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
305 if (!empty($this->office_phone)) {
306 $out .= ($outphonedone ? ' ' : '');
307 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
311 if (!empty($this->user_mobile)) {
312 $out .= ($outphonedone ? ' ' : '');
313 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
317 if (!empty($this->fax)) {
318 $out .= ($outphonedone ? ' ' : '');
319 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
323 if (!empty($this->office_fax)) {
324 $out .= ($outphonedone ? ' ' : '');
325 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
331 $out .= '<div style="clear: both;
"></div>';
334 if (!empty($this->email)) {
335 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 1, 1);
338 if (!empty($this->url)) {
339 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
340 if (!empty($this->email)) {
343 $out .= dol_print_url($this->url, '_blank', 0, 1);
347 if (isModEnabled('socialnetworks')) {
348 $outsocialnetwork = '';
350 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
351 $socialnetworksdict = getArrayOfSocialNetworks();
352 foreach ($this->socialnetworks as $key => $value) {
354 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
360 if ($outsocialnetwork) {
361 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
366 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
377 public function setUpperOrLowerCase()
379 if (getDolGlobalString('MAIN_TE_PRIVATE_FIRST_AND_LASTNAME_TO_UPPER')) {
380 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
381 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
382 if (empty($this->typent_code) || $this->typent_code != "TE_PRIVATE
") {
383 $this->name = dol_ucwords(dol_strtolower($this->name));
385 if (!empty($this->firstname)) {
386 $this->lastname = dol_strtoupper($this->lastname);
388 if (property_exists($this, 'name_alias')) {
389 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
392 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
393 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
394 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
395 $this->name = dol_ucwords(dol_strtolower($this->name));
396 if (property_exists($this, 'name_alias')) {
397 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
400 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
401 $this->lastname = dol_strtoupper($this->lastname);
402 $this->name = dol_strtoupper($this->name);
403 if (property_exists($this, 'name_alias')) {
404 $this->name_alias = dol_strtoupper($this->name_alias);
407 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
408 $this->address = dol_strtoupper($this->address ?? '');
409 $this->town = dol_strtoupper($this->town ?? '');
411 if (!empty($this->email)) {
412 $this->email = dol_strtolower($this->email);
414 if (isset($this->personal_email)) {
415 $this->personal_email = dol_strtolower($this->personal_email);
420 // Methods used by this Trait that must be implemented in the parent class.
421 // Note: this helps static type checking
432 abstract public function getFullAddress($withcountry = 0, $sep = "\n
", $withregion = 0, $extralangcode = '');
442 abstract public function fetchValuesForExtraLanguages();
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
Class to manage members of a foundation.
Class for RecruitmentCandidature.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getBannerAddress($htmlkey, $object)
Return full address for banner.
getCivilityLabel()
Return civility label of object.
getAnonymisableFullName($langs, $option=0, $nameorder=-1, $maxlen=0)
Return full name (civility+' '+name+' '+lastname) or anonymous string.
getFullAddress($withcountry=0, $sep="\n", $withregion=0, $extralangcode='')
Return full address of contact.
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 a 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.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
div refaddress div address
$conf db name
Only used if Module[ID]Name translation string is not found.