trait CommonPeople (View source)

Support class for third parties, contacts, members, users or resources

Properties expected in the host class receiving this trait.

Properties

?string $address
?string $zip
?string $town
int $state_id
string $state_code
?string $state
?string $email
?string $url
int $id
int $contact_id
int $fk_soc
string $civility_code
DoliDB $db
string $element
string $name
string $name_alias
string $nom
string $company
string $firstname
string $lastname
string $personal_email
array<string, string> $socialnetworks
string $fax
string $office_fax
string $office_phone
string $phone
string $phone_perso
string $phone_pro
string $phone_mobile
string $user_mobile
string $country_code
string $region

Methods

getFullName(Translate $langs, int<0, 1> $option = 0, $nameorder = -1, $maxlen = 0)

Return full name (civility+' '+name+' '+lastname)

getCivilityLabel()

Return civility label of object

string
getBannerAddress($htmlkey, CommonObject $object)

Return full address for banner

void
setUpperOrLowerCase()

Set to upper or ucwords/lower if needed

getFullAddress($withcountry = 0, string $sep = "\n", $withregion = 0, $extralangcode = '')

Return full address of contact

fetchValuesForExtraLanguages()

Function to get alternative languages of a data into $this->array_languages This method is NOT called by method fetch of objects but must be called separately.

Details

getFullName(Translate $langs, int<0, 1> $option = 0, $nameorder = -1, $maxlen = 0)

Return full name (civility+' '+name+' '+lastname)

Parameters

Translate $langs

Language object for translation of civility (used only if option is 1)

int<0, 1> $option

0=No option, 1=Add civility @param int<-1,5> $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname, 3=Firstname if defined else lastname, 4=Lastname, 5=Lastname if defined else firstname @param int $maxlen Maximum length @return string String with full name

$nameorder
$maxlen

getCivilityLabel()

Return civility label of object

@return string Translated name of civility

string getBannerAddress($htmlkey, CommonObject $object)

Return full address for banner

@param      string          $htmlkey            HTML id to make banner content unique

Parameters

$htmlkey
CommonObject $object

Object (thirdparty, thirdparty of contact for contact, null for a member)

Return Value

string

Full address string

void setUpperOrLowerCase()

Set to upper or ucwords/lower if needed

Return Value

void

abstract getFullAddress($withcountry = 0, string $sep = "\n", $withregion = 0, $extralangcode = '')

Return full address of contact

@param int<0,1> $withcountry 1=Add country into address string

Parameters

$withcountry
string $sep

Separator to use to build string @param int<0,1> $withregion 1=Add region into address string @param string $extralangcode User extralanguages as value @return string Full address string

$withregion
$extralangcode

abstract fetchValuesForExtraLanguages()

Function to get alternative languages of a data into $this->array_languages This method is NOT called by method fetch of objects but must be called separately.

@return int<-1,1> Return integer <0 if error, 0 if no values of alternative languages to find nor found, 1 if a value was found and loaded

See also

fetch_optionnals()