FacturaScripts

Contacto extends Contact
in package
Uses ModelTrait, PasswordTrait

Description of crm_contacto

Tags
author

Carlos García Gómez [email protected]

Table of Contents

AUDIT_CHANNEL  = 'audit'
DATE_STYLE  = 'd-m-Y'
DATETIME_STYLE  = 'd-m-Y H:i:s'
HOUR_STYLE  = 'H:i:s'
$aceptaprivacidad  : bool
$admitemarketing  : bool
$apartado  : string
$apellidos  : string
$cargo  : string
$cifnif  : string
Tax identifier of the customer.
$ciudad  : string
$codagente  : string
$codcliente  : string
$codpais  : string
$codpostal  : string
$codproveedor  : string
$descripcion  : string
$direccion  : string
$email  : string
Email of the person.
$empresa  : string
$fax  : string
Fax of the person.
$fechaalta  : string
Date on which the customer was registered.
$habilitado  : bool
$idcontacto  : int
$langcode  : string
$lastactivity  : string
$lastip  : string
$level  : int
$logkey  : string
$newPassword  : string
New password.
$newPassword2  : string
Repeated new password.
$nombre  : string
Name by which we know the contact, not necessarily the official.
$observaciones  : string
Observations of the person.
$password  : string
Password hashed with password_hash()
$personafisica  : bool
True -> the customer is a natural person.
$provincia  : string
$puntos  : int
$telefono1  : string
Phone 1 of the person.
$telefono2  : string
Phone 2 of the person.
$tipoidfiscal  : string
Type of tax identification of the client.
$verificado  : bool
$dataBase  : DataBase
It provides direct access to the database.
$fields  : array<string|int, mixed>
List of fields in the table.
$checkedTables  : array<string|int, mixed>
List of already tested tables.
__construct()  : mixed
ModelClass constructor.
addExtension()  : mixed
Adds an extension to this model.
alias()  : string
all()  : array<string|int, static>
Returns all models that correspond to the selected filters.
changePrimaryColumnValue()  : bool
Change the value of the primary column in the model and the database.
checkVies()  : bool
clear()  : mixed
codeModelAll()  : array<string|int, CodeModel>
Allows to use this model as source in CodeModel special model.
codeModelSearch()  : array<string|int, CodeModel>
count()  : int
Returns the number of records in the model that meet the condition.
country()  : string
delete()  : bool
Remove the model data from the database.
exists()  : bool
Returns true if the model data is stored in the database.
fullName()  : string
Returns full name.
get()  : static|false
Returns the model whose primary column corresponds to the value $cod
getCustomer()  : Cliente
getModelFields()  : array<string|int, mixed>
Returns the list of fields in the table.
getSupplier()  : Proveedor
gravatar()  : string
Returns gravatar image url.
install()  : string
loadFromCode()  : bool
Fill the class with the registry values whose primary column corresponds to the value $cod, or according to the condition where indicated, if value is not reported in $cod.
loadFromData()  : mixed
Assign the values of the $data array to the model properties.
modelClassName()  : string
Returns the name of the class of the model.
newCode()  : int
Returns the following code for the reported field or the primary key of the model.
newLogkey()  : string
Generates a new login key for the user. It also updates last activity and last IP.
pipe()  : mixed
Executes all $name methods added from the extensions.
pipeFalse()  : bool
Executes all $name methods added from the extensions until someone returns false.
primaryColumn()  : string
primaryColumnValue()  : mixed
Returns the current value of the main column of the model.
primaryDescription()  : string
Descriptive identifier for humans of the data record
primaryDescriptionColumn()  : string
save()  : bool
Stores the model data in the database.
setPassword()  : mixed
Asigns the new password to the user.
tableName()  : string
test()  : bool
Returns True if there is no errors on properties values.
toArray()  : array<string|int, mixed>
Returns an array with the model fields values.
url()  : string
verifyLogkey()  : bool
Verifies the login key.
verifyPassword()  : bool
Verifies password. It also rehash the password if needed.
loadModelFields()  : mixed
Loads table fields if is necessary.
modelName()  : string
Returns the name of the model.
saveInsert()  : bool
Insert the model data in the database.
saveUpdate()  : bool
Update the model data in the database.
testPassword()  : bool
toolBox()  : ToolBox
checkTable()  : bool
Checks and updates the structure of the table if necessary.
getBoolValueForField()  : bool|null
Returns the boolean value for the field.
getFloatValueForField()  : float|null
Returns the float value for the field.
getIntegerValueForField()  : int|null
Returns the integer value by controlling special cases for the PK and FK.
getOrderBy()  : string
Convert an array of filters order by in string.
getRecord()  : array<string|int, mixed>
Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition.

Constants

AUDIT_CHANNEL

public mixed AUDIT_CHANNEL = 'audit'

DATE_STYLE

public mixed DATE_STYLE = 'd-m-Y'

DATETIME_STYLE

public mixed DATETIME_STYLE = 'd-m-Y H:i:s'

HOUR_STYLE

public mixed HOUR_STYLE = 'H:i:s'

Properties

$aceptaprivacidad

public bool $aceptaprivacidad

$admitemarketing

public bool $admitemarketing

$cifnif

Tax identifier of the customer.

public string $cifnif

$codproveedor

public string $codproveedor

$email

Email of the person.

public string $email

$fax

Fax of the person.

public string $fax

$fechaalta

Date on which the customer was registered.

public string $fechaalta

$lastactivity

public string $lastactivity

$newPassword2

Repeated new password.

public string $newPassword2

$nombre

Name by which we know the contact, not necessarily the official.

public string $nombre

$observaciones

Observations of the person.

public string $observaciones

$password

Password hashed with password_hash()

public string $password

$personafisica

True -> the customer is a natural person.

public bool $personafisica

False -> the client is a legal person (company).

$telefono1

Phone 1 of the person.

public string $telefono1

$telefono2

Phone 2 of the person.

public string $telefono2

$tipoidfiscal

Type of tax identification of the client.

public string $tipoidfiscal

Examples: CIF, NIF, CUIT ...

$dataBase

It provides direct access to the database.

protected static DataBase $dataBase

$fields

List of fields in the table.

protected static array<string|int, mixed> $fields = []

$checkedTables

List of already tested tables.

private static array<string|int, mixed> $checkedTables = []

Methods

__construct()

ModelClass constructor.

public __construct([array<string|int, mixed> $data = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []
Return values
mixed

addExtension()

Adds an extension to this model.

public abstract static addExtension(mixed $extension) : mixed
Parameters
$extension : mixed
Return values
mixed

alias()

public alias() : string
Return values
string

all()

Returns all models that correspond to the selected filters.

public all([array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ], int $offset[, int $limit = 50 ]) : array<string|int, static>
Parameters
$where : array<string|int, mixed> = []

filters to apply to model records.

$order : array<string|int, mixed> = []

fields to use in the sorting. For example ['code' => 'ASC']

$offset : int
$limit : int = 50
Return values
array<string|int, static>

changePrimaryColumnValue()

Change the value of the primary column in the model and the database.

public changePrimaryColumnValue(mixed $newValue) : bool
Parameters
$newValue : mixed
Return values
bool

checkVies()

public checkVies() : bool
Return values
bool

clear()

public clear() : mixed
Return values
mixed

codeModelAll()

Allows to use this model as source in CodeModel special model.

public codeModelAll([string $fieldCode = '' ]) : array<string|int, CodeModel>
Parameters
$fieldCode : string = ''
Return values
array<string|int, CodeModel>

codeModelSearch()

public codeModelSearch(string $query[, string $fieldCode = '' ][, array<string|int, DataBaseWhere$where = [] ]) : array<string|int, CodeModel>
Parameters
$query : string
$fieldCode : string = ''
$where : array<string|int, DataBaseWhere> = []
Return values
array<string|int, CodeModel>

count()

Returns the number of records in the model that meet the condition.

public count([array<string|int, DataBaseWhere$where = [] ]) : int
Parameters
$where : array<string|int, DataBaseWhere> = []

filters to apply to model records.

Return values
int

country()

public country() : string
Return values
string

delete()

Remove the model data from the database.

public delete() : bool
Return values
bool

exists()

Returns true if the model data is stored in the database.

public exists() : bool
Return values
bool

fullName()

Returns full name.

public fullName() : string
Return values
string

get()

Returns the model whose primary column corresponds to the value $cod

public get(string $code) : static|false
Parameters
$code : string
Return values
static|false

getCustomer()

public getCustomer([bool $create = true ]) : Cliente
Parameters
$create : bool = true
Return values
Cliente

getModelFields()

Returns the list of fields in the table.

public abstract getModelFields() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSupplier()

public getSupplier([bool $create = true ]) : Proveedor
Parameters
$create : bool = true
Return values
Proveedor

gravatar()

Returns gravatar image url.

public gravatar([int $size = 80 ]) : string
Parameters
$size : int = 80
Return values
string

install()

public install() : string
Return values
string

loadFromCode()

Fill the class with the registry values whose primary column corresponds to the value $cod, or according to the condition where indicated, if value is not reported in $cod.

public loadFromCode(string $code[, array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ]) : bool

Initializes the values of the class if there is no record that meet the above conditions. Returns True if the record exists and False otherwise.

Parameters
$code : string
$where : array<string|int, mixed> = []
$order : array<string|int, mixed> = []
Return values
bool

loadFromData()

Assign the values of the $data array to the model properties.

public loadFromData([array<string|int, mixed> $data = [] ][, array<string|int, mixed> $exclude = [] ]) : mixed
Parameters
$data : array<string|int, mixed> = []
$exclude : array<string|int, mixed> = []
Return values
mixed

modelClassName()

Returns the name of the class of the model.

public abstract modelClassName() : string
Return values
string

newCode()

Returns the following code for the reported field or the primary key of the model.

public newCode([string $field = '' ][, array<string|int, mixed> $where = [] ]) : int
Parameters
$field : string = ''
$where : array<string|int, mixed> = []
Return values
int

newLogkey()

Generates a new login key for the user. It also updates last activity and last IP.

public newLogkey(string $ipAddress) : string
Parameters
$ipAddress : string
Return values
string

pipe()

Executes all $name methods added from the extensions.

public abstract pipe(string $name, array<string|int, mixed> ...$arguments) : mixed
Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
mixed

pipeFalse()

Executes all $name methods added from the extensions until someone returns false.

public abstract pipeFalse(string $name, array<string|int, mixed> ...$arguments) : bool
Parameters
$name : string
$arguments : array<string|int, mixed>
Return values
bool

primaryColumn()

public static primaryColumn() : string
Return values
string

primaryColumnValue()

Returns the current value of the main column of the model.

public primaryColumnValue() : mixed
Return values
mixed

primaryDescription()

Descriptive identifier for humans of the data record

public primaryDescription() : string
Return values
string

primaryDescriptionColumn()

public primaryDescriptionColumn() : string
Return values
string

save()

Stores the model data in the database.

public save() : bool
Return values
bool

setPassword()

Asigns the new password to the user.

public setPassword(string $value) : mixed
Parameters
$value : string
Return values
mixed

tableName()

public static tableName() : string
Return values
string

test()

Returns True if there is no errors on properties values.

public test() : bool
Return values
bool

toArray()

Returns an array with the model fields values.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

url()

public url([string $type = 'auto' ][, string $list = 'ListCliente?activetab=List' ]) : string
Parameters
$type : string = 'auto'
$list : string = 'ListCliente?activetab=List'
Return values
string

verifyLogkey()

Verifies the login key.

public verifyLogkey(string $value) : bool
Parameters
$value : string
Return values
bool

verifyPassword()

Verifies password. It also rehash the password if needed.

public verifyPassword(string $value) : bool
Parameters
$value : string
Return values
bool

loadModelFields()

Loads table fields if is necessary.

protected abstract loadModelFields(DataBase &$dataBase, string $tableName) : mixed
Parameters
$dataBase : DataBase
$tableName : string
Return values
mixed

modelName()

Returns the name of the model.

protected abstract modelName() : string
Return values
string

saveInsert()

Insert the model data in the database.

protected saveInsert([array<string|int, mixed> $values = [] ]) : bool
Parameters
$values : array<string|int, mixed> = []
Return values
bool

saveUpdate()

Update the model data in the database.

protected saveUpdate([array<string|int, mixed> $values = [] ]) : bool
Parameters
$values : array<string|int, mixed> = []
Return values
bool

testPassword()

protected testPassword() : bool
Return values
bool

checkTable()

Checks and updates the structure of the table if necessary.

private checkTable() : bool
Return values
bool

getBoolValueForField()

Returns the boolean value for the field.

private getBoolValueForField(array<string|int, mixed> $field, mixed $value) : bool|null
Parameters
$field : array<string|int, mixed>
$value : mixed
Return values
bool|null

getFloatValueForField()

Returns the float value for the field.

private getFloatValueForField(array<string|int, mixed> $field, string $value) : float|null
Parameters
$field : array<string|int, mixed>
$value : string
Return values
float|null

getIntegerValueForField()

Returns the integer value by controlling special cases for the PK and FK.

private getIntegerValueForField(array<string|int, mixed> $field, string $value) : int|null
Parameters
$field : array<string|int, mixed>
$value : string
Return values
int|null

getOrderBy()

Convert an array of filters order by in string.

private getOrderBy(array<string|int, mixed> $order) : string
Parameters
$order : array<string|int, mixed>
Return values
string

getRecord()

Read the record whose primary column corresponds to the value $cod or the first that meets the indicated condition.

private getRecord(string $code[, array<string|int, mixed> $where = [] ][, array<string|int, mixed> $order = [] ]) : array<string|int, mixed>
Parameters
$code : string
$where : array<string|int, mixed> = []
$order : array<string|int, mixed> = []
Return values
array<string|int, mixed>

Search results