Accounts
extends Synchronizer
in package
WAPRO ERP accounts synchronizer class.
Table of Contents
- NAME = 'LBL_ACCOUNTS'
- SEQUENCE = 2
- $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.
- convertDiscount() : int
- Convert discount 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_ACCOUNTS'
Provider name | File name.
SEQUENCE
public
string
SEQUENCE
= 2
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_FIRMY' => ['fieldName' => 'multiCompanyId', 'fn' => 'findRelationship', 'tableName' => 'FIRMA', 'skipMode' => true], 'NAZWA' => ['fieldName' => 'accountname', 'fn' => 'decode'], 'NIP' => 'vat_id', 'REGON' => 'registration_number_2', 'UWAGI' => 'description', 'ADRES_WWW' => 'website', 'DOMYSLNY_RABAT' => ['fieldName' => 'discount', 'fn' => 'convertDiscount'], 'ADRES_EMAIL' => 'email1', 'TELEFON_FIRMOWY' => ['fieldName' => 'phone', 'fn' => 'convertPhone'], 'SYM_KRAJU' => ['fieldName' => 'addresslevel1a', 'fn' => 'convertCountry'], 'WOJEWODZTWO' => 'addresslevel2a', 'POWIAT' => 'addresslevel3a', 'MIEJSCOWOSC' => 'addresslevel5a', 'KOD_POCZTOWY' => 'addresslevel7a', 'ULICA_LOKAL' => 'addresslevel8a', 'SYM_KRAJU_KOR' => ['fieldName' => 'addresslevel1b', 'fn' => 'convertCountry'], 'WOJEWODZTWO_KOR' => 'addresslevel2b', 'POWIAT_KOR' => 'addresslevel3b', 'MIEJSCOWOSC_KOR' => 'addresslevel5b', 'KOD_POCZTOWY_KOR' => 'addresslevel7b', 'ULICA_LOKAL_KOR' => 'addresslevel8b']
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 —convertDiscount()
Convert discount to system format.
protected
convertDiscount(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