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.
' ';
142 $code = (!empty($this->civility_code) ? $this->civility_code : (!empty($this->civility_id) ? $this->civility : (!empty($this->civilite) ? $this->civilite :
'')));
147 $langs->load(
"dict");
148 return $langs->getLabelFromKey($this->db,
"Civility".$code,
"c_civility",
"code",
"label", $code);
162 global
$conf, $langs, $form, $extralanguages;
164 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
168 $elementforaltlanguage = $this->element;
169 if ($this->element ===
'societe' && $this instanceof
Societe) {
172 if ($this->element ===
'contact' && $this instanceof
Contact) {
174 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
176 if ($this->element ==
'member' && $this instanceof
Adherent) {
178 $thirdpartyid = empty($this->socid) ? 0 : $this->socid;
180 if ($this->element ===
'user' && $this instanceof
User) {
181 $contactid = $this->contact_id;
193 if (!empty(
$conf->use_javascript_ajax)) {
196 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
197 $namecoords .=
$object->name.
'<br>';
199 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
201 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
202 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
205 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
212 // List of extra languages
213 $arrayoflangcode = array();
214 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
215 $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
218 if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) {
219 if (!is_object($extralanguages)) {
220 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
221 $extralanguages = new ExtraLanguages($this->db);
223 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
225 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
226 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".implode(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
227 $this->fetchValuesForExtraLanguages();
228 if (!is_object($form)) {
229 $form = new Form($this->db);
232 // If there is extra languages
233 foreach ($arrayoflangcode as $extralangcode) {
234 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
235 // This also call dol_format_address()
236 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
237 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
239 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
244 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
245 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
246 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
247 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
248 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
250 $out .= ($outdone ? ' - ' : '').$this->state;
256 $out = '<div class="address inline-block
">'.$out.'</div>';
259 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)) {
260 $out .= ($outdone ? '<br>' : '');
265 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
266 // $out .= ($outphonedone ? ' ' : '');
267 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
271 if (!empty($this->phone_pro)) {
272 $out .= ($outphonedone ? ' ' : '');
273 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
277 if (!empty($this->phone_mobile)) {
278 $out .= ($outphonedone ? ' ' : '');
279 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
283 if (!empty($this->phone_perso)) {
284 $out .= ($outphonedone ? ' ' : '');
285 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
289 if (!empty($this->office_phone)) {
290 $out .= ($outphonedone ? ' ' : '');
291 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
295 if (!empty($this->user_mobile)) {
296 $out .= ($outphonedone ? ' ' : '');
297 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
301 if (!empty($this->fax)) {
302 $out .= ($outphonedone ? ' ' : '');
303 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
307 if (!empty($this->office_fax)) {
308 $out .= ($outphonedone ? ' ' : '');
309 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
315 $out .= '<div style="clear: both;
"></div>';
318 if (!empty($this->email)) {
319 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1);
322 if (!empty($this->url)) {
323 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
324 if (!empty($this->email)) {
327 $out .= dol_print_url($this->url, '_blank', 0, 1);
331 if (isModEnabled('socialnetworks')) {
332 $outsocialnetwork = '';
334 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
335 $socialnetworksdict = getArrayOfSocialNetworks();
336 foreach ($this->socialnetworks as $key => $value) {
338 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
344 if ($outsocialnetwork) {
345 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
350 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
361 public function setUpperOrLowerCase()
363 if (getDolGlobalString('MAIN_TE_PRIVATE_FIRST_AND_LASTNAME_TO_UPPER')) {
364 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
365 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
366 if (empty($this->typent_code) || $this->typent_code != "TE_PRIVATE
") {
367 $this->name = dol_ucwords(dol_strtolower($this->name));
369 if (!empty($this->firstname)) {
370 $this->lastname = dol_strtoupper($this->lastname);
372 if (property_exists($this, 'name_alias')) {
373 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
376 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
377 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
378 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
379 $this->name = dol_ucwords(dol_strtolower($this->name));
380 if (property_exists($this, 'name_alias')) {
381 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
384 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
385 $this->lastname = dol_strtoupper($this->lastname);
386 $this->name = dol_strtoupper($this->name);
387 if (property_exists($this, 'name_alias')) {
388 $this->name_alias = dol_strtoupper($this->name_alias);
391 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
392 $this->address = dol_strtoupper($this->address ?? '');
393 $this->town = dol_strtoupper($this->town ?? '');
395 if (!empty($this->email)) {
396 $this->email = dol_strtolower($this->email);
398 if (isset($this->personal_email)) {
399 $this->personal_email = dol_strtolower($this->personal_email);
404 // Methods used by this Trait that must be implemented in the parent class.
405 // Note: this helps static type checking
416 abstract public function getFullAddress($withcountry = 0, $sep = "\n
", $withregion = 0, $extralangcode = '');
426 abstract public function fetchValuesForExtraLanguages();
$id
Support class for third parties, contacts, members, users or resources.
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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.
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
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.