107 public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
110 $lastname = $this->lastname;
111 $firstname = $this->firstname;
112 if (empty($lastname)) {
114 $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 :
'')))));
118 if (!empty($option) && !empty($this->civility_code)) {
119 if ($langs->transnoentitiesnoconv(
"Civility".$this->civility_code) !=
"Civility".$this->civility_code) {
120 $ret .= $langs->transnoentitiesnoconv(
"Civility".$this->civility_code).
' ';
122 $ret .= $this->civility_code.
' ';
141 $code = (!empty($this->civility_code) ? $this->civility_code : (!empty($this->civility_id) ? $this->civility : (!empty($this->civilite) ? $this->civilite :
'')));
146 $langs->load(
"dict");
147 return $langs->getLabelFromKey($this->db,
"Civility".$code,
"c_civility",
"code",
"label", $code);
161 global
$conf, $langs, $form, $extralanguages;
163 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
167 $elementforaltlanguage = $this->element;
168 if ($this->element ===
'societe' && $this instanceof
Societe) {
171 if ($this->element ===
'contact' && $this instanceof
Contact) {
173 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
175 if ($this->element ==
'member' && $this instanceof
Adherent) {
177 $thirdpartyid = empty($this->socid) ? 0 : $this->socid;
179 if ($this->element ===
'user' && $this instanceof
User) {
180 $contactid = $this->contact_id;
192 if (!empty(
$conf->use_javascript_ajax)) {
195 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
196 $namecoords .=
$object->name.
'<br>';
198 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
200 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
201 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
204 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
211 // List of extra languages
212 $arrayoflangcode = array();
213 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
214 $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
217 if (/* is_array($arrayoflangcode) && */count($arrayoflangcode)) {
218 if (!is_object($extralanguages)) {
219 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
220 $extralanguages = new ExtraLanguages($this->db);
222 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
224 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
225 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".implode(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
226 $this->fetchValuesForExtraLanguages();
227 if (!is_object($form)) {
228 $form = new Form($this->db);
231 // If there is extra languages
232 foreach ($arrayoflangcode as $extralangcode) {
233 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
234 // This also call dol_format_address()
235 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
236 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
238 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
243 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
244 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
245 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
246 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
247 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
249 $out .= ($outdone ? ' - ' : '').$this->state;
255 $out = '<div class="address inline-block
">'.$out.'</div>';
258 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)) {
259 $out .= ($outdone ? '<br>' : '');
264 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
265 // $out .= ($outphonedone ? ' ' : '');
266 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
270 if (!empty($this->phone_pro)) {
271 $out .= ($outphonedone ? ' ' : '');
272 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
276 if (!empty($this->phone_mobile)) {
277 $out .= ($outphonedone ? ' ' : '');
278 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
282 if (!empty($this->phone_perso)) {
283 $out .= ($outphonedone ? ' ' : '');
284 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
288 if (!empty($this->office_phone)) {
289 $out .= ($outphonedone ? ' ' : '');
290 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
294 if (!empty($this->user_mobile)) {
295 $out .= ($outphonedone ? ' ' : '');
296 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
300 if (!empty($this->fax)) {
301 $out .= ($outphonedone ? ' ' : '');
302 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
306 if (!empty($this->office_fax)) {
307 $out .= ($outphonedone ? ' ' : '');
308 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
314 $out .= '<div style="clear: both;
"></div>';
317 if (!empty($this->email)) {
318 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1);
321 if (!empty($this->url)) {
322 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
323 if (!empty($this->email)) {
326 $out .= dol_print_url($this->url, '_blank', 0, 1);
330 if (isModEnabled('socialnetworks')) {
331 $outsocialnetwork = '';
333 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
334 $socialnetworksdict = getArrayOfSocialNetworks();
335 foreach ($this->socialnetworks as $key => $value) {
337 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
343 if ($outsocialnetwork) {
344 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
349 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
360 public function setUpperOrLowerCase()
362 if (getDolGlobalString('MAIN_TE_PRIVATE_FIRST_AND_LASTNAME_TO_UPPER')) {
363 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
364 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
365 if (empty($this->typent_code) || $this->typent_code != "TE_PRIVATE
") {
366 $this->name = dol_ucwords(dol_strtolower($this->name));
368 if (!empty($this->firstname)) {
369 $this->lastname = dol_strtoupper($this->lastname);
371 if (property_exists($this, 'name_alias')) {
372 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
375 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
376 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
377 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
378 $this->name = dol_ucwords(dol_strtolower($this->name));
379 if (property_exists($this, 'name_alias')) {
380 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
383 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
384 $this->lastname = dol_strtoupper($this->lastname);
385 $this->name = dol_strtoupper($this->name);
386 if (property_exists($this, 'name_alias')) {
387 $this->name_alias = dol_strtoupper($this->name_alias);
390 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
391 $this->address = dol_strtoupper($this->address);
392 $this->town = dol_strtoupper($this->town);
394 if (!empty($this->email)) {
395 $this->email = dol_strtolower($this->email);
397 if (isset($this->personal_email)) {
398 $this->personal_email = dol_strtolower($this->personal_email);
403 // Methods used by this Trait that must be implemented in the parent class.
404 // Note: this helps static type checking
415 abstract public function getFullAddress($withcountry = 0, $sep = "\n
", $withregion = 0, $extralangcode = '');
425 abstract public function fetchValuesForExtraLanguages();
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.