73 public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
76 $lastname = $this->lastname;
77 $firstname = $this->firstname;
78 if (empty($lastname)) {
79 $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 :
'')))));
83 if (!empty($option) && !empty($this->civility_code)) {
84 if ($langs->transnoentitiesnoconv(
"Civility".$this->civility_code) !=
"Civility".$this->civility_code) {
85 $ret .= $langs->transnoentitiesnoconv(
"Civility".$this->civility_code).
' ';
87 $ret .= $this->civility_code.
' ';
103 public function getBannerAddress($htmlkey,
$object)
105 global $conf, $langs, $form, $extralanguages;
107 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
111 $elementforaltlanguage = $this->element;
112 if ($this->element ==
'societe') {
114 $thirdpartyid = $this->id;
116 if ($this->element ==
'contact') {
118 $contactid = $this->id;
119 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
121 if ($this->element ==
'user') {
123 $contactid = $this->contact_id;
130 $coords = $this->getFullAddress(1,
', ',
getDolGlobalInt(
'MAIN_SHOW_REGION_IN_STATE_SELECT'));
132 if (!empty($conf->use_javascript_ajax)) {
135 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
136 $namecoords .=
$object->name.
'<br>';
138 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
140 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
141 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
144 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
151 // List of extra languages
152 $arrayoflangcode = array();
153 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
154 $arrayoflangcode[] = getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE');
157 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
158 if (!is_object($extralanguages)) {
159 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
160 $extralanguages = new ExtraLanguages($this->db);
162 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
164 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
165 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".implode(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
166 $this->fetchValuesForExtraLanguages();
167 if (!is_object($form)) {
168 $form = new Form($this->db);
171 // If there is extra languages
172 foreach ($arrayoflangcode as $extralangcode) {
173 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
174 // This also call dol_format_address()
175 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
176 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
178 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
183 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
184 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
185 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
186 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
187 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
189 $out .= ($outdone ? ' - ' : '').$this->state;
195 $out = '<div class="address
inline-block
">'.$out.'</div>';
198 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)) {
199 $out .= ($outdone ? '<br>' : '');
201 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
202 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
205 if (!empty($this->phone_pro)) {
206 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
209 if (!empty($this->phone_mobile)) {
210 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
213 if (!empty($this->phone_perso)) {
214 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
217 if (!empty($this->office_phone)) {
218 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
221 if (!empty($this->user_mobile)) {
222 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
225 if (!empty($this->fax)) {
226 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
229 if (!empty($this->office_fax)) {
230 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
235 $out .= '<div style="clear: both;
"></div>';
238 if (!empty($this->email)) {
239 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1);
242 if (!empty($this->url)) {
243 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
244 if (!empty($this->email)) {
247 $out .= dol_print_url($this->url, '_blank', 0, 1);
251 if (isModEnabled('socialnetworks')) {
252 $outsocialnetwork = '';
254 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
255 $socialnetworksdict = getArrayOfSocialNetworks();
256 foreach ($this->socialnetworks as $key => $value) {
258 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
264 if ($outsocialnetwork) {
265 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
270 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
281 public function setUpperOrLowerCase()
283 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
284 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
285 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
286 $this->name = dol_ucwords(dol_strtolower($this->name));
287 if (property_exists($this, 'name_alias')) {
288 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
291 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
292 $this->lastname = dol_strtoupper($this->lastname);
293 $this->name = dol_strtoupper($this->name);
294 if (property_exists($this, 'name_alias')) {
295 $this->name_alias = dol_strtoupper($this->name_alias);
298 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
299 $this->address = dol_strtoupper($this->address);
300 $this->town = dol_strtoupper($this->town);
302 if (isset($this->email)) {
303 $this->email = dol_strtolower($this->email);
305 if (isset($this->personal_email)) {
306 $this->personal_email = dol_strtolower($this->personal_email);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
trait CommonPeople
Support class for thirdparties, contacts, members, users or resources.
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 dolibarr global constant string value.
$conf db name
Only used if Module[ID]Name translation string is not found.