Products
extends Synchronizer
in package
WAPRO ERP products synchronizer class.
Table of Contents
- NAME = 'LBL_PRODUCTS'
- SEQUENCE = 4
- $className : string
- $cache : array<string|int, mixed>
- $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.
- getRecordById() : array<string|int, mixed>
- Get product record by record id.
- importRecord() : int
- Import record.
- importRecordById() : int
- Import record by id.
- log() : void
- Add log to db.
- logError() : void
- Add error log to db.
- process() : int
- Main function to execute synchronizer.
- convertCategory() : string
- Convert category to system format.
- convertCountry() : string|null
- Convert country to system format.
- convertCurrency() : int
- Convert currency to system format.
- convertPhone() : string
- Convert phone to system format.
- convertPrice() : string
- Convert price to system format.
- convertTaxes() : string
- Convert taxes 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_PRODUCTS'
Provider name | File name.
SEQUENCE
public
string
SEQUENCE
= 4
Priority order.
Properties
$className
public
string
$className
Class name.
$cache
protected
array<string|int, mixed>
$cache
= []
Cache form products
$controller
protected
Wapro
$controller
Controller instance.
$currency
protected
static bool
$currency
Information on currency configuration.
$fieldMap
protected
array<string|int, string>
$fieldMap
= ['NAZWA' => ['fieldName' => 'productname', 'fn' => 'decode'], 'STAN' => 'qtyinstock', 'STAN_MINIMALNY' => 'reorderlevel', 'STAN_MAKSYMALNY' => 'qtyindemand', 'INDEKS_KATALOGOWY' => ['fieldName' => 'mfr_part_no', 'fn' => 'decode'], 'INDEKS_HANDLOWY' => ['fieldName' => 'serial_no', 'fn' => 'decode'], 'INDEKS_PRODUCENTA' => 'vendor_part_no', 'KOD_KRESKOWY' => 'ean', 'OPIS' => 'description', 'WAGA' => 'weight', 'category' => ['fieldName' => 'pscategory', 'fn' => 'convertCategory'], 'VAT_SPRZEDAZY' => ['fieldName' => 'taxes', 'fn' => 'convertTaxes'], 'unitName' => ['fieldName' => 'usageunit', 'fn' => 'convertUnitName', 'moduleName' => 'Products'], 'CENA_ZAKUPU_BRUTTO' => ['fieldName' => 'purchase', 'fn' => 'convertPrice'], 'total' => ['fieldName' => 'unit_price', 'fn' => 'convertPrice']]
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
getRecordById()
Get product record by record id.
public
getRecordById(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed> —importRecord()
Import record.
public
importRecord() : int
Return values
int —importRecordById()
Import record by id.
public
importRecordById(int $id) : int
Parameters
- $id : 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 —convertCategory()
Convert category to system format.
protected
convertCategory(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —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 —convertPrice()
Convert price to system format.
protected
convertPrice(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —convertTaxes()
Convert taxes to system format.
protected
convertTaxes(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