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.
' ';
138 public function getBannerAddress($htmlkey,
$object)
140 global $conf, $langs, $form, $extralanguages;
142 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
146 $elementforaltlanguage = $this->element;
147 if ($this->element ==
'societe') {
151 if ($this->element ==
'contact') {
154 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
156 if ($this->element ==
'user') {
158 $contactid = $this->contact_id;
167 if (!empty($conf->use_javascript_ajax)) {
170 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
171 $namecoords .=
$object->name.
'<br>';
173 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
175 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
176 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
179 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
186 // List of extra languages
187 $arrayoflangcode = array();
188 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
189 $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
192 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
193 if (!is_object($extralanguages)) {
194 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
195 $extralanguages = new ExtraLanguages($this->db);
197 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
199 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
200 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".implode(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
201 $this->fetchValuesForExtraLanguages();
202 if (!is_object($form)) {
203 $form = new Form($this->db);
206 // If there is extra languages
207 foreach ($arrayoflangcode as $extralangcode) {
208 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
209 // This also call dol_format_address()
210 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
211 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
213 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
218 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
219 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
220 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
221 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
222 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
224 $out .= ($outdone ? ' - ' : '').$this->state;
230 $out = '<div class="address inline-block
">'.$out.'</div>';
233 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)) {
234 $out .= ($outdone ? '<br>' : '');
239 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
240 $out .= ($outphonedone ? ' ' : '');
241 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
245 if (!empty($this->phone_pro)) {
246 $out .= ($outphonedone ? ' ' : '');
247 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
251 if (!empty($this->phone_mobile)) {
252 $out .= ($outphonedone ? ' ' : '');
253 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
257 if (!empty($this->phone_perso)) {
258 $out .= ($outphonedone ? ' ' : '');
259 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
263 if (!empty($this->office_phone)) {
264 $out .= ($outphonedone ? ' ' : '');
265 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
269 if (!empty($this->user_mobile)) {
270 $out .= ($outphonedone ? ' ' : '');
271 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
275 if (!empty($this->fax)) {
276 $out .= ($outphonedone ? ' ' : '');
277 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
281 if (!empty($this->office_fax)) {
282 $out .= ($outphonedone ? ' ' : '');
283 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
289 $out .= '<div style="clear: both;
"></div>';
292 if (!empty($this->email)) {
293 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1);
296 if (!empty($this->url)) {
297 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
298 if (!empty($this->email)) {
301 $out .= dol_print_url($this->url, '_blank', 0, 1);
305 if (isModEnabled('socialnetworks')) {
306 $outsocialnetwork = '';
308 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
309 $socialnetworksdict = getArrayOfSocialNetworks();
310 foreach ($this->socialnetworks as $key => $value) {
312 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
318 if ($outsocialnetwork) {
319 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
324 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
335 public function setUpperOrLowerCase()
337 if (getDolGlobalString('MAIN_TE_PRIVATE_FIRST_AND_LASTNAME_TO_UPPER')) {
338 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
339 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
340 if (empty($this->typent_code) || $this->typent_code != "TE_PRIVATE
") {
341 $this->name = dol_ucwords(dol_strtolower($this->name));
343 if (!empty($this->firstname)) {
344 $this->lastname = dol_strtoupper($this->lastname);
346 if (property_exists($this, 'name_alias')) {
347 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
350 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
351 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
352 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
353 $this->name = dol_ucwords(dol_strtolower($this->name));
354 if (property_exists($this, 'name_alias')) {
355 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
358 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
359 $this->lastname = dol_strtoupper($this->lastname);
360 $this->name = dol_strtoupper($this->name);
361 if (property_exists($this, 'name_alias')) {
362 $this->name_alias = dol_strtoupper($this->name_alias);
365 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
366 $this->address = dol_strtoupper($this->address);
367 $this->town = dol_strtoupper($this->town);
369 if (isset($this->email)) {
370 $this->email = dol_strtolower($this->email);
372 if (isset($this->personal_email)) {
373 $this->personal_email = dol_strtolower($this->personal_email);
378 // Methods used by this Trait that must be implemented in the parent class.
379 // Note: this helps static type checking
390 abstract public function getFullAddress($withcountry = 0, $sep = "\n
", $withregion = 0, $extralangcode = '');
400 abstract public function fetchValuesForExtraLanguages();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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
$conf db name
Only used if Module[ID]Name translation string is not found.