Customer
extends Address
in package
Uses
ServiceRoles
Implement customer object
This class provides general interfaces to handle the customer specific object operations. The customer is a uuid and encrypted store object
Tags
Table of Contents
- $ : string|null
- $ : array<string|int, mixed>|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : string|null
- $ : array<string|int, mixed>|null
- $active_branch : object|null
- $companies : array<string|int, mixed>|null
- List of related company ids
- __construct() : mixed
- Customer constructor.
- ActiveBranch() : object|null
- Get / Set active branch
- AddCompany() : Result
- Add to company Add a new sub customer to this company.
- Branches() : array<string|int, mixed>|null
- Get / Set branches
- ContactPerson() : array<string|int, mixed>|string|null
- Streamlined interface to get the contact person data
- Country() : string|null
- CountryCode() : string|null
- Data() : array<string|int, mixed>|null
- Must override the behavior of addresses that calculate this based on the name
- Delete() : Result
- Delete customer
- FormattedNumber() : string
- The formatted customer number
- GeoCode() : array<string|int, mixed>|null
- Get go location information about this address
- GetDefaultLanguage() : string|null
- Get default language
- GetDefaultTimezone() : DateTimeZone|null
- Id() : int|string
- Expose the object id
- IsFilled() : bool
- Has minimal required data
- LinkedUserAccounts() : array<string|int, mixed>|null
- Get list of assigned/responsible users
- LinkUserAccount() : mixed
- Add user with role to this entity
- ListCompanies() : array<string|int, mixed>|null
- List customer companies
- Locations() : array<string|int, Address>
- Get list of index able addresses
- MailContact() : object
- Get the email contact supporting the active branch
- Name() : string
- Get the assigned name or, combined company name
- Number() : string
- Get the customer number
- PhoneClear() : string|null
- RequireGeoCode() : bool
- Requires and can geo locate
- Salutation() : string|stdClass|null
- Get salutation
- Save() : Result|null
- Automatic geocode address dataset in company
- SearchFields() : array<string|int, mixed>
- Return search indexer fields
- SkontoTable() : array<string|int, mixed>|null
- ToPlainObject() : stdClass
- Convert to plain object
- Types() : array<string|int, string>|null
- Get the types list
- UnlinkCompany() : Result
- Unlink from company
- UpdateAttributeServiceroles() : Result
- Callback on update validate service roles
- companyPath() : string
Properties
$
public
string|null
$
company_name The company name store by address attribute
$
public
array<string|int, mixed>|null
$
serviceroles The list of service roles
$
public
string|null
$
zipcode The postal code
$
public
string|null
$
town The town name
$
public
string|null
$
phone The primary phone number
$
public
string|null
$
cell_phone The primary mobile phone number
$
public
string|null
$
email The primary email
$
public
string|null
$
name The contact person name
$
public
string|null
$
last_name The contact person last name
$
public
string|null
$
street The street and number
$
public
string|null
$
company The company name
$
public
string|null
$
salutation Salutation of contact person
$
public
array<string|int, mixed>|null
$
geo_location The geolocation array
$active_branch
private
object|null
$active_branch
= null
$companies
List of related company ids
private
array<string|int, mixed>|null
$companies
= null
The list
Methods
__construct()
Customer constructor.
public
__construct([string|null $id = null ][, string|null $language = null ]) : mixed
Construct a new customer object
Parameters
- $id : string|null = null
-
A object id
- $language : string|null = null
-
The local language
Return values
mixed —ActiveBranch()
Get / Set active branch
public
ActiveBranch([string|null $id = null ]) : object|null
Parameters
- $id : string|null = null
Return values
object|null —AddCompany()
Add to company Add a new sub customer to this company.
public
AddCompany(string $company_id) : Result
Parameters
- $company_id : string
-
The company id
Return values
Result —A system result object
Branches()
Get / Set branches
public
Branches([array<string|int, mixed>|null $branches = null ]) : array<string|int, mixed>|null
Parameters
- $branches : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|null —ContactPerson()
Streamlined interface to get the contact person data
public
ContactPerson([string|null $key = null ]) : array<string|int, mixed>|string|null
Parameters
- $key : string|null = null
Return values
array<string|int, mixed>|string|null —Either a single part or a set of field when present
Country()
public
Country() : string|null
Return values
string|null —CountryCode()
public
CountryCode() : string|null
Return values
string|null —Data()
Must override the behavior of addresses that calculate this based on the name
public
Data([array<string|int, mixed>|null $data = null ]) : array<string|int, mixed>|null
Parameters
- $data : array<string|int, mixed>|null = null
Return values
array<string|int, mixed>|null —Delete()
Delete customer
public
Delete([bool $skip = false ]) : Result
Delete entity from file system and git repository This method will also delete the company link list next to the storage file
Parameters
- $skip : bool = false
-
Skip hooks on demand
Return values
Result —A default system result set
FormattedNumber()
The formatted customer number
public
FormattedNumber([int $fill = 8 ][, string $prefix = 'RK' ]) : string
Parameters
- $fill : int = 8
- $prefix : string = 'RK'
Return values
string —GeoCode()
Get go location information about this address
public
GeoCode() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —GetDefaultLanguage()
Get default language
public
GetDefaultLanguage() : string|null
Get the default language code of the user attribute set
Return values
string|null —GetDefaultTimezone()
public
GetDefaultTimezone() : DateTimeZone|null
Return values
DateTimeZone|null —Id()
Expose the object id
public
Id() : int|string
Provide an interface to extract the current id, can be numeric or string
Return values
int|string —The id as fixed value
IsFilled()
Has minimal required data
public
IsFilled() : bool
Return values
bool —Is filled with enough data
LinkedUserAccounts()
Get list of assigned/responsible users
public
LinkedUserAccounts([array<string|int, mixed>|null $types = null ]) : array<string|int, mixed>|null
Parameters
- $types : array<string|int, mixed>|null = null
-
Roles to filter for
Return values
array<string|int, mixed>|null —LinkUserAccount()
Add user with role to this entity
public
LinkUserAccount(string $user_id, string $role) : mixed
Parameters
- $user_id : string
- $role : string
Return values
mixed —ListCompanies()
List customer companies
public
ListCompanies() : array<string|int, mixed>|null
Get a list of related company ids
Return values
array<string|int, mixed>|null —Get id list of related companies
Locations()
Get list of index able addresses
public
Locations([bool $all = false ]) : array<string|int, Address>
Parameters
- $all : bool = false
Return values
array<string|int, Address> —MailContact()
Get the email contact supporting the active branch
public
MailContact() : object
Return values
object —Name()
Get the assigned name or, combined company name
public
Name() : string
Return values
string —Number()
Get the customer number
public
Number() : string
Return values
string —PhoneClear()
public
PhoneClear([string $prefix = '' ]) : string|null
Parameters
- $prefix : string = ''
Return values
string|null —RequireGeoCode()
Requires and can geo locate
public
RequireGeoCode() : bool
Return values
bool —Salutation()
Get salutation
public
Salutation([string|null $language = null ]) : string|stdClass|null
Get the translated salutation from this content type. Can be raw as well.
Parameters
- $language : string|null = null
-
Translate to this language
Return values
string|stdClass|null —The option value
Save()
Automatic geocode address dataset in company
public
Save([bool $force_new_id = false ]) : Result|null
Parameters
- $force_new_id : bool = false
Return values
Result|null —SearchFields()
Return search indexer fields
public
SearchFields() : array<string|int, mixed>
Convert instance to search indexer values
Return values
array<string|int, mixed> —The search indexer fields
SkontoTable()
public
SkontoTable() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —ToPlainObject()
Convert to plain object
public
ToPlainObject([null $language = null ][, bool $with_parent = true ]) : stdClass
Parameters
- $language : null = null
- $with_parent : bool = true
Return values
stdClass —Types()
Get the types list
public
Types() : array<string|int, string>|null
Return values
array<string|int, string>|null —UnlinkCompany()
Unlink from company
public
UnlinkCompany(string $company_id) : Result
Parameters
- $company_id : string
Return values
Result —UpdateAttributeServiceroles()
Callback on update validate service roles
public
UpdateAttributeServiceroles(object $attr, array<string|int, mixed> $data) : Result
This function is called when the primary identifier is changed, is called from objecthandler->updateentity
Parameters
- $attr : object
-
The changed attribute
- $data : array<string|int, mixed>
-
The new attribute value
Return values
Result —A system result object
companyPath()
private
companyPath([bool $relative = false ]) : string
Parameters
- $relative : bool = false