Invoice
extends Synchronizer
in package
WAPRO ERP invoice synchronizer class.
Table of Contents
- NAME = 'LBL_INVOICE'
- PAYMENT_METHODS_MAP = ['gotówka' => 'PLL_CASH', 'przelew' => 'PLL_TRANSFER', 'czek' => 'PLL_CHECK', 'pobranie' => 'PLL_CASH_ON_DELIVERY']
- SEQUENCE = 5
- $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.
- addProduct() : int
- Add a product when it does not exist in CRM.
- convertCountry() : string|null
- Convert country to system format.
- convertCurrency() : int
- Convert currency to system format.
- convertDate() : string
- Convert date to system format.
- convertPaymentMethods() : string
- Convert payment method 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.
- getCurrencyParam() : array<string|int, mixed>
- Get currency param.
- getGlobalTax() : string
- Get global tax from value.
- getInventory() : array<string|int, mixed>
- Get inventory items.
- loadDeliveryAddress() : void
- Load delivery address.
- loadFromFieldMap() : void
- Load data from DB based on field map.
- loadInventory() : void
- Load inventory items.
Constants
NAME
public
string
NAME
= 'LBL_INVOICE'
Provider name | File name.
PAYMENT_METHODS_MAP
public
array<string|int, string>
PAYMENT_METHODS_MAP
= ['gotówka' => 'PLL_CASH', 'przelew' => 'PLL_TRANSFER', 'czek' => 'PLL_CHECK', 'pobranie' => 'PLL_CASH_ON_DELIVERY']
Map for payment methods with WAPRO ERP
SEQUENCE
public
string
SEQUENCE
= 5
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], 'ID_KONTRAHENTA' => ['fieldName' => 'accountid', 'fn' => 'findRelationship', 'tableName' => 'KONTRAHENT', 'skipMode' => true], 'FORMA_PLATNOSCI' => ['fieldName' => 'payment_methods', 'fn' => 'convertPaymentMethods'], 'UWAGI' => 'description', 'KONTRAHENT_NAZWA' => ['fieldName' => 'company_name_a', 'fn' => 'decode'], 'issueTime' => ['fieldName' => 'issue_time', 'fn' => 'convertDate'], 'saleDate' => ['fieldName' => 'saledate', 'fn' => 'convertDate'], 'paymentDate' => ['fieldName' => 'paymentdate', 'fn' => 'convertDate']]
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 —addProduct()
Add a product when it does not exist in CRM.
protected
addProduct(int $id) : int
Parameters
- $id : 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 —convertDate()
Convert date to system format.
protected
convertDate(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —convertPaymentMethods()
Convert payment method to system format.
protected
convertPaymentMethods(string $value, array<string|int, mixed> $params) : string
Parameters
- $value : string
- $params : array<string|int, mixed>
Return values
string —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> —getCurrencyParam()
Get currency param.
protected
getCurrencyParam(int $currencyId) : array<string|int, mixed>
Parameters
- $currencyId : int
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 —getInventory()
Get inventory items.
protected
getInventory() : array<string|int, mixed>
Return values
array<string|int, mixed> —loadDeliveryAddress()
Load delivery address.
protected
loadDeliveryAddress(string $key) : void
Parameters
- $key : string
Return values
void —loadFromFieldMap()
Load data from DB based on field map.
protected
loadFromFieldMap() : void
Return values
void —loadInventory()
Load inventory items.
protected
loadInventory() : void