72 public function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0)
75 $lastname = $this->lastname;
76 $firstname = $this->firstname;
77 if (empty($lastname)) {
78 $lastname = (isset($this->lastname) ? $this->lastname : (isset($this->
name) ? $this->
name : (isset($this->nom) ? $this->nom : (isset($this->societe) ? $this->societe : (isset($this->company) ? $this->company :
'')))));
82 if (!empty($option) && !empty($this->civility_code)) {
83 if ($langs->transnoentitiesnoconv(
"Civility".$this->civility_code) !=
"Civility".$this->civility_code) {
84 $ret .= $langs->transnoentitiesnoconv(
"Civility".$this->civility_code).
' ';
86 $ret .= $this->civility_code.
' ';
102 public function getBannerAddress($htmlkey, $object)
104 global $conf, $langs, $form, $extralanguages;
106 $countriesusingstate = array(
'AU',
'US',
'IN',
'GB',
'ES',
'UK',
'TR');
110 $elementforaltlanguage = $this->element;
111 if ($this->element ==
'societe') {
113 $thirdpartyid = $this->id;
115 if ($this->element ==
'contact') {
117 $contactid = $this->id;
118 $thirdpartyid = empty($this->fk_soc) ? 0 : $this->fk_soc;
120 if ($this->element ==
'user') {
122 $contactid = $this->contact_id;
123 $thirdpartyid = empty($object->fk_soc) ? 0 : $object->fk_soc;
129 $coords = $this->getFullAddress(1,
', ',
getDolGlobalInt(
'MAIN_SHOW_REGION_IN_STATE_SELECT'));
131 if (!empty($conf->use_javascript_ajax)) {
134 if ($this->element ==
'contact' &&
getDolGlobalString(
'MAIN_SHOW_COMPANY_NAME_IN_BANNER_ADDRESS')) {
135 $namecoords .= $object->name.
'<br>';
137 $namecoords .= $this->
getFullName($langs, 1).
'<br>'.$coords;
139 $out .=
'<a href="#" class="hideonsmartphone" onclick="return copyToClipboard(\''.dol_escape_js($namecoords).
'\',\
''.dol_escape_js($langs->trans(
"HelpCopyToClipboard")).
'\');
">';
140 $out .= img_picto($langs->trans("Address
"), 'map-marker-alt');
143 $address = dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
150 // List of extra languages
151 $arrayoflangcode = array();
152 if (getDolGlobalString('PDF_USE_ALSO_LANGUAGE_CODE')) {
153 $arrayoflangcode[] = $conf->global->PDF_USE_ALSO_LANGUAGE_CODE;
156 if (is_array($arrayoflangcode) && count($arrayoflangcode)) {
157 if (!is_object($extralanguages)) {
158 include_once DOL_DOCUMENT_ROOT.'/core/class/extralanguages.class.php';
159 $extralanguages = new ExtraLanguages($this->db);
161 $extralanguages->fetch_name_extralanguages($elementforaltlanguage);
163 if (!empty($extralanguages->attributes[$elementforaltlanguage]['address']) || !empty($extralanguages->attributes[$elementforaltlanguage]['town'])) {
164 $out .= "<!-- alternatelanguage
for '".$elementforaltlanguage."' set to fields
'".join(',
', $extralanguages->attributes[$elementforaltlanguage])."' -->\n
";
165 $this->fetchValuesForExtraLanguages();
166 if (!is_object($form)) {
167 $form = new Form($this->db);
170 // If there is extra languages
171 foreach ($arrayoflangcode as $extralangcode) {
172 $s = picto_from_langcode($extralangcode, 'class="pictoforlang paddingright
"');
173 // This also call dol_format_address()
174 $coords = $this->getFullAddress(1, ', ', $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT, $extralangcode);
175 $htmltext .= $s.dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', ');
177 $out .= $form->textwithpicto('', $htmltext, -1, 'language', 'opacitymedium paddingleft');
182 // If MAIN_FORCE_STATE_INTO_ADDRESS is on, state is already returned previously with getFullAddress
183 if (!in_array($this->country_code, $countriesusingstate) && !getDolGlobalString('MAIN_FORCE_STATE_INTO_ADDRESS')
184 && !getDolGlobalString('SOCIETE_DISABLE_STATE') && $this->state) {
185 if (getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 && $this->region) {
186 $out .= ($outdone ? ' - ' : '').$this->region.' - '.$this->state;
188 $out .= ($outdone ? ' - ' : '').$this->state;
194 $out = '<div class="address
inline-block
">'.$out.'</div>';
197 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)) {
198 $out .= ($outdone ? '<br>' : '');
200 if (!empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
201 $out .= dol_print_phone($this->phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
204 if (!empty($this->phone_pro)) {
205 $out .= dol_print_phone($this->phone_pro, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
208 if (!empty($this->phone_mobile)) {
209 $out .= dol_print_phone($this->phone_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
212 if (!empty($this->phone_perso)) {
213 $out .= dol_print_phone($this->phone_perso, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePerso
"));
216 if (!empty($this->office_phone)) {
217 $out .= dol_print_phone($this->office_phone, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'phone', $langs->trans("PhonePro
"));
220 if (!empty($this->user_mobile)) {
221 $out .= dol_print_phone($this->user_mobile, $this->country_code, $contactid, $thirdpartyid, 'AC_TEL', ' ', 'mobile', $langs->trans("PhoneMobile
"));
224 if (!empty($this->fax)) {
225 $out .= dol_print_phone($this->fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
228 if (!empty($this->office_fax)) {
229 $out .= dol_print_phone($this->office_fax, $this->country_code, $contactid, $thirdpartyid, 'AC_FAX', ' ', 'fax', $langs->trans("Fax
"));
234 $out .= '<div style="clear: both;
"></div>';
237 if (!empty($this->email)) {
238 $out .= dol_print_email($this->email, $this->id, $object->id, 1, 0, 0, 1);
241 if (!empty($this->url)) {
242 //$out.=dol_print_url($this->url,'_goout',0,1);//steve changed to blank
243 if (!empty($this->email)) {
246 $out .= dol_print_url($this->url, '_blank', 0, 1);
250 if (isModEnabled('socialnetworks')) {
251 $outsocialnetwork = '';
253 if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
254 $socialnetworksdict = getArrayOfSocialNetworks();
255 foreach ($this->socialnetworks as $key => $value) {
257 $outsocialnetwork .= dol_print_socialnetworks($value, $this->id, $object->id, $key, $socialnetworksdict);
263 if ($outsocialnetwork) {
264 $out .= '<div style="clear: both;
">'.$outsocialnetwork.'</div>';
269 return '<!-- BEGIN part to show address block -->'."\n
".$out.'<!-- END Part to show address block -->'."\n
";
280 public function setUpperOrLowerCase()
282 if (getDolGlobalString('MAIN_FIRST_TO_UPPER')) {
283 $this->lastname = dol_ucwords(dol_strtolower($this->lastname));
284 $this->firstname = dol_ucwords(dol_strtolower($this->firstname));
285 $this->name = dol_ucwords(dol_strtolower($this->name));
286 if (property_exists($this, 'name_alias')) {
287 $this->name_alias = isset($this->name_alias) ? dol_ucwords(dol_strtolower($this->name_alias)) : '';
290 if (getDolGlobalString('MAIN_ALL_TO_UPPER')) {
291 $this->lastname = dol_strtoupper($this->lastname);
292 $this->name = dol_strtoupper($this->name);
293 if (property_exists($this, 'name_alias')) {
294 $this->name_alias = dol_strtoupper($this->name_alias);
297 if (getDolGlobalString('MAIN_ALL_TOWN_TO_UPPER')) {
298 $this->address = dol_strtoupper($this->address);
299 $this->town = dol_strtoupper($this->town);
301 if (isset($this->email)) {
302 $this->email = dol_strtolower($this->email);
304 if (isset($this->personal_email)) {
305 $this->personal_email = dol_strtolower($this->personal_email);
trait CommonPeople
Superclass for thirdparties, contacts, members or users.
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.