Contacts
extends Synchronizer
in package
WAPRO ERP contacts synchronizer class.
Table of Contents
- NAME = 'LBL_CONTACTS'
- SEQUENCE = 3
- $className : string
- $controller : Wapro
- $currency : bool
- $fieldMap : array<string|int, string>
- $recordModel : Vtiger_Record_Model
- $row : array<string|int, mixed>
- $skip : bool
- $waproId : int
- __construct() : mixed
- Synchronizer constructor.
- findInMapTable() : int|null
- Find the crm ID for the integration record.
- getCounter() : int
- Get number of records.
- getName() : string
- Function to get provider name.
- importRecord() : int
- Import record.
- log() : void
- Add log to db.
- logError() : void
- Add error log to db.
- process() : int
- Main function to execute synchronizer.
- convertCountry() : string|null
- Convert country to system format.
- convertCurrency() : int
- Convert currency to system format.
- convertPhone() : string
- Convert phone to system format.
- convertUnitName() : string
- Convert unit name to system format.
- decode() : string
- Convert unit name to system format.
- findRelationship() : int
- Convert currency to system format.
- getBaseCurrency() : array<string|int, mixed>
- Get information about base currency.
- getGlobalTax() : string
- Get global tax from value.
- loadFromFieldMap() : void
- Load data from DB based on field map.
Constants
NAME
public
string
NAME
= 'LBL_CONTACTS'
Provider name | File name.
SEQUENCE
public
string
SEQUENCE
= 3
Priority order.
Properties
$className
public
string
$className
Class name.
$controller
protected
Wapro
$controller
Controller instance.
$currency
protected
static bool
$currency
Information on currency configuration.
$fieldMap
protected
array<string|int, string>
$fieldMap
= ['ID_KONTRAHENTA' => ['fieldName' => 'parent_id', 'fn' => 'findRelationship', 'tableName' => 'KONTRAHENT'], 'IMIE' => ['fieldName' => 'firstname', 'fn' => 'decode'], 'NAZWISKO' => ['fieldName' => 'lastname', 'fn' => 'decode'], 'TYTUL' => 'jobtitle', 'TEL' => ['fieldName' => 'phone', 'fn' => 'convertPhone'], 'TEL_KOM' => ['fieldName' => 'mobile', 'fn' => 'convertPhone'], 'E_MAIL' => 'email', 'E_MAIL_DW' => 'secondary_email', 'UWAGI' => 'description']
Map of fields integrating with WAPRO ERP
$recordModel
protected
Vtiger_Record_Model
$recordModel
Record model instance.
$row
protected
array<string|int, mixed>
$row
Record row.
$skip
protected
bool
$skip
The flag to skip record creation.
$waproId
protected
int
$waproId
WAPRO ERP record ID.
Methods
__construct()
Synchronizer constructor.
public
__construct(Wapro $controller) : mixed
Parameters
- $controller : Wapro
Return values
mixed —findInMapTable()
Find the crm ID for the integration record.
public
findInMapTable(int $id, string $table) : int|null
Parameters
- $id : int
- $table : string
Return values
int|null —getCounter()
Get number of records.
public
getCounter() : int
Return values
int —getName()
Function to get provider name.
public
getName() : string
Return values
string —provider name
importRecord()
Import record.
public
importRecord() : int
Return values
int —log()
Add log to db.
public
log(string $message) : void
Parameters
- $message : string
Return values
void —logError()
Add error log to db.
public
logError(Throwable $ex) : void
Parameters
- $ex : Throwable
Return values
void —process()
Main function to execute synchronizer.
public
process() : int
Return values
int —convertCountry()
Convert country to system format.
protected
convertCountry(string $value[, array<string|int, mixed> $params = [] ]) : string|null
Parameters
- $value : string
- $params : array<string|int, mixed> = []
Return values
string|null —convertCurrency()
Convert currency to system format.
protected
convertCurrency(string $value, array<string|int, mixed> $params) : int
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
int —convertPhone()
Convert phone to system format.
protected
convertPhone(string $value, array<string|int, mixed> &$params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —convertUnitName()
Convert unit name to system format.
protected
convertUnitName(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —decode()
Convert unit name to system format.
protected
decode(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —findRelationship()
Convert currency to system format.
protected
findRelationship(string $value, array<string|int, mixed> $params) : int
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
int —getBaseCurrency()
Get information about base currency.
protected
getBaseCurrency() : array<string|int, mixed>
Return values
array<string|int, mixed> —getGlobalTax()
Get global tax from value.
protected
getGlobalTax(string $value[, bool $addIfNotExist = false ]) : string
Parameters
- $value : string
- $addIfNotExist : bool = false
Return values
string —loadFromFieldMap()
Load data from DB based on field map.
protected
loadFromFieldMap() : void