UserVat
extends JobProtoctedCacheModel
in package
Table of Contents
Constants
- COUNTRY_ID_AT = 40
- JOB_PROTECTED_FIELD_LIST = ['start_at', 'end_at', 'vatid']
- JOB_PROTECTED_MAIN_ACTION = \Vatjar\Jobs\Model\Job::MAIN_ACTION_MODEL_UserVat
- MOSS_EU_FORMAT_REGEX = '^(EU)(?<localVatidEU>[0-9]{9})'
- VATID_FORMAT_REGEX = [ /* * source http://ec.europa.eu/taxation_customs/vies/faqvies.do#item_11 * *: Format excludes 2 letter alpha prefix * 9: A digit * X: A letter or a digit * S: A letter; a digit; "+" or "*" * L: A letter */ // ATU99999999 40 => '/^(?<countryTwo>AT)(?<localVatid>U[0-9]{8})$/', // BE0999999999 56 => '/^(?<countryTwo>BE)(?<localVatid>[0-1][0-9]{9})$/', // BG999999999 or BG9999999999 100 => '/^(?<countryTwo>BG)(?<localVatid>[0-9]{9,10})$/', // CY99999999L 196 => '/^(?<countryTwo>CY)(?<localVatid>[0-9]{8}[A-Z])$/', // CZ99999999 or CZ999999999 or CZ9999999999 203 => '/^(?<countryTwo>CZ)(?<localVatid>[0-9]{8,10}$)/', // DE999999999 276 => '/^(?<countryTwo>DE)(?<localVatid>[0-9]{9})$/', // DK99 99 99 99 208 => '/^(?<countryTwo>DK)(?<localVatid>[0-9]{8})$/', // EE999999999 233 => '/^(?<countryTwo>EE)(?<localVatid>[0-9]{9})$/', // EL999999999 // GR999999999 300 => '/^(?<countryTwo>EL|GR)(?<localVatid>[0-9]{9})$/', /* * ES51234567A - Correct * ESA12345675 - Correct * ESA1234567A - Correct * ES512345675 - Incorrect */ 724 => '/^(?<countryTwo>ES)(?<localVatid>([A-Z][0-9]{8}|[A-Z][0-9]{7}[A-Z]|[0-9]{8}[A-Z]))$/', // FI99999999 246 => '/^(?<countryTwo>FI)(?<localVatid>[0-9]{8})$/', // FRXX 999999999 250 => '/^(?<countryTwo>FR)(?<localVatid>[0-9A-Z]{2}[0-9]{9})$/', /* * GB999999999 * GB999999999999 * GBGD999 * GBHA999 */ 826 => '/^(?<countryTwo>GB)(?<localVatid>[0-9]{12}|[0-9]{9}|(GD|HA)[0-9]{3})$/', // HR99999999999 191 => '/^(?<countryTwo>HR)(?<localVatid>[0-9]{11})$/', // HU99999999 348 => '/^(?<countryTwo>HU)(?<localVatid>[0-9]{8})$/', // IE9S99999L IE9999999WI 372 => '/^(?<countryTwo>IE)(?<localVatid>[0-9][0-9A-Z\*\+][0-9]{5}[A-Z]{1,2})$/', // IT99999999999 380 => '/^(?<countryTwo>IT)(?<localVatid>[0-9]{11})$/', // LT999999999 LT999999999999 440 => '/^(?<countryTwo>LT)(?<localVatid>[0-9]{9}|[0-9]{12})$/', // LU99999999 442 => '/^(?<countryTwo>LU)(?<localVatid>[0-9]{8})$/', // LV99999999999 428 => '/^(?<countryTwo>LV)(?<localVatid>[0-9]{11})$/', // MT99999999 470 => '/^(?<countryTwo>MT)(?<localVatid>[0-9]{8})$/', // NL999999999B99 528 => '/^(?<countryTwo>NL)(?<localVatid>[0-9]{9}B[0-9]{2})$/', // PL9999999999 616 => '/^(?<countryTwo>PL)(?<localVatid>[0-9]{10})$/', // PT999999999 620 => '/^(?<countryTwo>PT)(?<localVatid>[0-9]{9})$/', // RO999999999 642 => '/^(?<countryTwo>RO)(?<localVatid>[0-9]{2,10})$/', // SE999999999999 752 => '/^(?<countryTwo>SE)(?<localVatid>[0-9]{12})$/', // SI99999999 705 => '/^(?<countryTwo>SI)(?<localVatid>[0-9]{8})$/', //SK9999999999 703 => '/^(?<countryTwo>SK)(?<localVatid>[0-9]{10})$/', //UA1234567890 804 => '/^(?<countryTwo>UA)(?<localVatid>[0-9]{10})$/', ]
Properties
- $acknowledged_since : mixed
- $country_id : mixed
- $end_at : mixed
- $id : mixed
- $start_at : mixed
- $takeover : mixed
- $tax_id : mixed
- $user_id : mixed
- $vatid : mixed
- $_existsModel : bool
- $create_time : mixed
- $jobList : mixed
- $jobMergedData : mixed
- $jobProtectedCreate : mixed
- $jobProtectedDelete : mixed
- $jobProtectedModel : mixed
- $update_time : mixed
Methods
- __toString() : mixed
- assignJobMergedData() : static
- assignJobMergedDataFor() : static
- beforeSave() : mixed
- delete() : bool
- {@inheritDoc}
- exists() : bool
- fetchAsArray() : mixed
- fetchAsAssocArray() : mixed
- fetchAsMultiAssocArray() : mixed
- find() : false|array<string|int, static>
- findByUser() : mixed
- findByUserAndCountry() : mixed
- findByUsers() : mixed
- findFirst() : static|false
- fixParameters() : mixed
- fixVatid() : mixed
- fromArray() : mixed
- getActiveUserCountryFilingCompany() : UserCountryFilingCompany|null
- getActiveUserOssFilingCompany() : UserOssFilingCompany|null
- getChangedFields() : array<string|int, mixed>
- Add Phalcon < 3.2 condition for compatibility {@inheritDoc}
- getClient() : Client
- getCountry() : Country
- getCountryId() : mixed
- getCreateTime() : mixed
- getEndAt() : mixed
- getId() : mixed
- getJobInitObject() : mixed
- getJobList() : array<string|int, Job>
- getJobMergedData() : array<string|int, mixed>
- getOptOutCountries() : array<string|int, UserVatThresholdOptOut>|array<string|int, mixed>|null
- getOssRegistration() : OssRegistration|null
- getStartAt() : mixed
- getTakeover() : mixed
- getTaxId() : mixed
- getThe() : mixed
- getUpdateTime() : mixed
- getUserAccount() : UserAccount
- getUserId() : mixed
- getUserTraderCountrySetting() : UserTraderCountrySetting|null
- getVatid() : mixed
- getVatidLocal() : mixed
- getVatidLocalOrInApp() : mixed
- getVatidOrInApp() : mixed
- initialize() : mixed
- isVatidValid() : mixed
- loadJobList() : array<string|int, Job>
- loadJobListFor() : array<string|int, Job>
- loadMergedDataFor() : mixed
- loadMergedDataFromJob() : mixed
- mapper() : mixed
- monthInInterval() : mixed
- parseThisVatid() : mixed
- save() : bool
- set() : mixed
- setCountryId() : mixed
- setCreateTime() : $this
- If $createTime is null, default value now.
- setEndAt() : mixed
- setId() : mixed
- setStartAt() : mixed
- setTakeover() : mixed
- setTaxId() : mixed
- setUpdateTime() : $this
- If $updateTime is null, default value now.
- setUserId() : mixed
- setVatid() : mixed
- writeAttributeIfNeeded() : mixed
- _createKey() : mixed
- _isExistsModel() : mixed
- _loadExistsModel() : bool
- getJobparameters() : mixed
- getJobSecondaryId() : mixed
- getJobUserId() : mixed
- saveJobProtectedData() : mixed
- getPartAssocCountryTwo() : mixed
- getPartAssocLocalVatId() : mixed
- prepareVatIdRegex() : string
Constants
COUNTRY_ID_AT
public
mixed
COUNTRY_ID_AT
= 40
JOB_PROTECTED_FIELD_LIST
public
mixed
JOB_PROTECTED_FIELD_LIST
= ['start_at', 'end_at', 'vatid']
JOB_PROTECTED_MAIN_ACTION
public
mixed
JOB_PROTECTED_MAIN_ACTION
= \Vatjar\Jobs\Model\Job::MAIN_ACTION_MODEL_UserVat
MOSS_EU_FORMAT_REGEX
public
mixed
MOSS_EU_FORMAT_REGEX
= '^(EU)(?<localVatidEU>[0-9]{9})'
VATID_FORMAT_REGEX
public
mixed
VATID_FORMAT_REGEX
= [
/*
* source http://ec.europa.eu/taxation_customs/vies/faqvies.do#item_11
* *: Format excludes 2 letter alpha prefix
* 9: A digit
* X: A letter or a digit
* S: A letter; a digit; "+" or "*"
* L: A letter
*/
// ATU99999999
40 => '/^(?<countryTwo>AT)(?<localVatid>U[0-9]{8})$/',
// BE0999999999
56 => '/^(?<countryTwo>BE)(?<localVatid>[0-1][0-9]{9})$/',
// BG999999999 or BG9999999999
100 => '/^(?<countryTwo>BG)(?<localVatid>[0-9]{9,10})$/',
// CY99999999L
196 => '/^(?<countryTwo>CY)(?<localVatid>[0-9]{8}[A-Z])$/',
// CZ99999999 or CZ999999999 or CZ9999999999
203 => '/^(?<countryTwo>CZ)(?<localVatid>[0-9]{8,10}$)/',
// DE999999999
276 => '/^(?<countryTwo>DE)(?<localVatid>[0-9]{9})$/',
// DK99 99 99 99
208 => '/^(?<countryTwo>DK)(?<localVatid>[0-9]{8})$/',
// EE999999999
233 => '/^(?<countryTwo>EE)(?<localVatid>[0-9]{9})$/',
// EL999999999
// GR999999999
300 => '/^(?<countryTwo>EL|GR)(?<localVatid>[0-9]{9})$/',
/*
* ES51234567A - Correct
* ESA12345675 - Correct
* ESA1234567A - Correct
* ES512345675 - Incorrect
*/
724 => '/^(?<countryTwo>ES)(?<localVatid>([A-Z][0-9]{8}|[A-Z][0-9]{7}[A-Z]|[0-9]{8}[A-Z]))$/',
// FI99999999
246 => '/^(?<countryTwo>FI)(?<localVatid>[0-9]{8})$/',
// FRXX 999999999
250 => '/^(?<countryTwo>FR)(?<localVatid>[0-9A-Z]{2}[0-9]{9})$/',
/*
* GB999999999
* GB999999999999
* GBGD999
* GBHA999
*/
826 => '/^(?<countryTwo>GB)(?<localVatid>[0-9]{12}|[0-9]{9}|(GD|HA)[0-9]{3})$/',
// HR99999999999
191 => '/^(?<countryTwo>HR)(?<localVatid>[0-9]{11})$/',
// HU99999999
348 => '/^(?<countryTwo>HU)(?<localVatid>[0-9]{8})$/',
// IE9S99999L IE9999999WI
372 => '/^(?<countryTwo>IE)(?<localVatid>[0-9][0-9A-Z\*\+][0-9]{5}[A-Z]{1,2})$/',
// IT99999999999
380 => '/^(?<countryTwo>IT)(?<localVatid>[0-9]{11})$/',
// LT999999999 LT999999999999
440 => '/^(?<countryTwo>LT)(?<localVatid>[0-9]{9}|[0-9]{12})$/',
// LU99999999
442 => '/^(?<countryTwo>LU)(?<localVatid>[0-9]{8})$/',
// LV99999999999
428 => '/^(?<countryTwo>LV)(?<localVatid>[0-9]{11})$/',
// MT99999999
470 => '/^(?<countryTwo>MT)(?<localVatid>[0-9]{8})$/',
// NL999999999B99
528 => '/^(?<countryTwo>NL)(?<localVatid>[0-9]{9}B[0-9]{2})$/',
// PL9999999999
616 => '/^(?<countryTwo>PL)(?<localVatid>[0-9]{10})$/',
// PT999999999
620 => '/^(?<countryTwo>PT)(?<localVatid>[0-9]{9})$/',
// RO999999999
642 => '/^(?<countryTwo>RO)(?<localVatid>[0-9]{2,10})$/',
// SE999999999999
752 => '/^(?<countryTwo>SE)(?<localVatid>[0-9]{12})$/',
// SI99999999
705 => '/^(?<countryTwo>SI)(?<localVatid>[0-9]{8})$/',
//SK9999999999
703 => '/^(?<countryTwo>SK)(?<localVatid>[0-9]{10})$/',
//UA1234567890
804 => '/^(?<countryTwo>UA)(?<localVatid>[0-9]{10})$/',
]
Properties
$acknowledged_since
public
mixed
$acknowledged_since
$country_id
public
mixed
$country_id
$end_at
public
mixed
$end_at
= null
$id
public
mixed
$id
$start_at
public
mixed
$start_at
$takeover
public
mixed
$takeover
= 0
$tax_id
public
mixed
$tax_id
$user_id
public
mixed
$user_id
$vatid
public
mixed
$vatid
$_existsModel
protected
bool
$_existsModel
$create_time
protected
mixed
$create_time
$jobList
protected
mixed
$jobList
$jobMergedData
protected
mixed
$jobMergedData
$jobProtectedCreate
protected
mixed
$jobProtectedCreate
= true
$jobProtectedDelete
protected
mixed
$jobProtectedDelete
= true
$jobProtectedModel
protected
mixed
$jobProtectedModel
= \Vatjar\Jobs\Model\Job::class
$update_time
protected
mixed
$update_time
Methods
__toString()
public
__toString() : mixed
assignJobMergedData()
public
assignJobMergedData([array<string|int, mixed> $opt = [] ]) : static
Parameters
- $opt : array<string|int, mixed> = []
Return values
staticassignJobMergedDataFor()
public
assignJobMergedDataFor(JobProtoctedCacheModel &$model[, array<string|int, mixed> $opt = [] ]) : static
Parameters
- $model : JobProtoctedCacheModel
- $opt : array<string|int, mixed> = []
Return values
staticbeforeSave()
public
beforeSave() : mixed
delete()
{@inheritDoc}
public
delete() : bool
Tags
Return values
boolexists()
public
exists() : bool
Return values
boolfetchAsArray()
public
static fetchAsArray([mixed $parameter = null ]) : mixed
Parameters
- $parameter : mixed = null
fetchAsAssocArray()
public
static fetchAsAssocArray([mixed $parameter = null ][, mixed $key = 'id' ][, mixed $cols = null ]) : mixed
Parameters
- $parameter : mixed = null
- $key : mixed = 'id'
- $cols : mixed = null
fetchAsMultiAssocArray()
public
static fetchAsMultiAssocArray([mixed $parameter = null ][, mixed $keyname = ['id'] ][, mixed $cols = null ]) : mixed
Parameters
- $parameter : mixed = null
- $keyname : mixed = ['id']
- $cols : mixed = null
find()
public
static find([array<string|int, mixed>|null|int $parameters = null ]) : false|array<string|int, static>
Parameters
- $parameters : array<string|int, mixed>|null|int = null
Return values
false|array<string|int, static>findByUser()
public
static findByUser(mixed $uid) : mixed
Parameters
- $uid : mixed
findByUserAndCountry()
public
static findByUserAndCountry(mixed $userId, mixed $countryId) : mixed
Parameters
- $userId : mixed
- $countryId : mixed
findByUsers()
public
static findByUsers(array<string|int, mixed> $uids) : mixed
Parameters
- $uids : array<string|int, mixed>
findFirst()
public
static findFirst([array<string|int, mixed>|null|int $parameters = null ]) : static|false
Parameters
- $parameters : array<string|int, mixed>|null|int = null
Return values
static|falsefixParameters()
public
static fixParameters([mixed $parameters = null ]) : mixed
Parameters
- $parameters : mixed = null
fixVatid()
public
static fixVatid(string $vatid) : mixed
Parameters
- $vatid : string
fromArray()
public
static fromArray(mixed $array) : mixed
Parameters
- $array : mixed
getActiveUserCountryFilingCompany()
public
getActiveUserCountryFilingCompany() : UserCountryFilingCompany|null
Return values
UserCountryFilingCompany|nullgetActiveUserOssFilingCompany()
public
getActiveUserOssFilingCompany() : UserOssFilingCompany|null
Return values
UserOssFilingCompany|nullgetChangedFields()
Add Phalcon < 3.2 condition for compatibility {@inheritDoc}
public
getChangedFields() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getClient()
public
getClient() : Client
Return values
ClientgetCountry()
public
getCountry() : Country
Return values
CountrygetCountryId()
public
getCountryId() : mixed
getCreateTime()
public
getCreateTime() : mixed
getEndAt()
public
getEndAt() : mixed
getId()
public
getId() : mixed
getJobInitObject()
public
static getJobInitObject(mixed $userId, mixed $secondary[, array<string|int, mixed> $data = [] ]) : mixed
Parameters
- $userId : mixed
- $secondary : mixed
- $data : array<string|int, mixed> = []
getJobList()
public
getJobList([array<string|int, mixed> $opt = [] ]) : array<string|int, Job>
Parameters
- $opt : array<string|int, mixed> = []
Return values
array<string|int, Job>getJobMergedData()
public
getJobMergedData([array<string|int, mixed> $opt = [] ]) : array<string|int, mixed>
Parameters
- $opt : array<string|int, mixed> = []
Return values
array<string|int, mixed>getOptOutCountries()
public
getOptOutCountries() : array<string|int, UserVatThresholdOptOut>|array<string|int, mixed>|null
Return values
array<string|int, UserVatThresholdOptOut>|array<string|int, mixed>|nullgetOssRegistration()
public
getOssRegistration() : OssRegistration|null
Return values
OssRegistration|nullgetStartAt()
public
getStartAt() : mixed
getTakeover()
public
getTakeover() : mixed
getTaxId()
public
getTaxId() : mixed
getThe()
public
static getThe(mixed $paramater) : mixed
Parameters
- $paramater : mixed
getUpdateTime()
public
getUpdateTime() : mixed
getUserAccount()
public
getUserAccount() : UserAccount
Return values
UserAccountgetUserId()
public
getUserId() : mixed
getUserTraderCountrySetting()
public
getUserTraderCountrySetting() : UserTraderCountrySetting|null
Return values
UserTraderCountrySetting|nullgetVatid()
public
getVatid([mixed $fix = false ]) : mixed
Parameters
- $fix : mixed = false
getVatidLocal()
public
getVatidLocal() : mixed
getVatidLocalOrInApp()
public
getVatidLocalOrInApp() : mixed
getVatidOrInApp()
public
getVatidOrInApp() : mixed
initialize()
public
initialize() : mixed
isVatidValid()
public
isVatidValid([array<string|int, mixed> &$partAssoc = [] ]) : mixed
Parameters
- $partAssoc : array<string|int, mixed> = []
loadJobList()
public
loadJobList([array<string|int, mixed> $opt = [] ]) : array<string|int, Job>
Parameters
- $opt : array<string|int, mixed> = []
Return values
array<string|int, Job>loadJobListFor()
public
static loadJobListFor(JobProtoctedCacheModel $model[, array<string|int, mixed> $opt = [] ]) : array<string|int, Job>
Parameters
- $model : JobProtoctedCacheModel
- $opt : array<string|int, mixed> = []
Return values
array<string|int, Job>loadMergedDataFor()
public
static loadMergedDataFor(JobProtoctedCacheModel &$model[, array<string|int, mixed> $opt = [] ]) : mixed
Parameters
- $model : JobProtoctedCacheModel
- $opt : array<string|int, mixed> = []
loadMergedDataFromJob()
public
static loadMergedDataFromJob(Job $job[, array<string|int, mixed> $opt = [] ]) : mixed
Parameters
- $job : Job
- $opt : array<string|int, mixed> = []
mapper()
public
static mapper(array<string|int, mixed> $map, array<string|int, mixed> $original[, bool $reverse = true ]) : mixed
Parameters
- $map : array<string|int, mixed>
- $original : array<string|int, mixed>
- $reverse : bool = true
monthInInterval()
public
monthInInterval(mixed $month) : mixed
Parameters
- $month : mixed
parseThisVatid()
public
static parseThisVatid(string $vatid[, mixed $countryId = null ][, array<string|int, mixed> &$partAssoc = [] ]) : mixed
Parameters
- $vatid : string
- $countryId : mixed = null
- $partAssoc : array<string|int, mixed> = []
save()
public
save([mixed $data = null ][, mixed $whiteList = null ][, mixed $force = false ]) : bool
Parameters
- $data : mixed = null
- $whiteList : mixed = null
- $force : mixed = false
Return values
boolset()
public
set(mixed $property, mixed $value) : mixed
Parameters
- $property : mixed
- $value : mixed
setCountryId()
public
setCountryId(mixed $country_id) : mixed
Parameters
- $country_id : mixed
setCreateTime()
If $createTime is null, default value now.
public
setCreateTime([mixed $createTime = null ]) : $this
Parameters
- $createTime : mixed = null
Return values
$thissetEndAt()
public
setEndAt(mixed $end_at) : mixed
Parameters
- $end_at : mixed
setId()
public
setId([mixed $id = null ]) : mixed
Parameters
- $id : mixed = null
setStartAt()
public
setStartAt(mixed $start_at) : mixed
Parameters
- $start_at : mixed
setTakeover()
public
setTakeover(mixed $takeover) : mixed
Parameters
- $takeover : mixed
setTaxId()
public
setTaxId(mixed $taxId) : mixed
Parameters
- $taxId : mixed
setUpdateTime()
If $updateTime is null, default value now.
public
setUpdateTime([mixed $updateTime = null ]) : $this
Parameters
- $updateTime : mixed = null
Return values
$thissetUserId()
public
setUserId(mixed $user_id) : mixed
Parameters
- $user_id : mixed
setVatid()
public
setVatid(mixed $vatid[, mixed $fix = false ]) : mixed
Parameters
- $vatid : mixed
- $fix : mixed = false
writeAttributeIfNeeded()
public
writeAttributeIfNeeded(mixed $attribute, mixed $value) : mixed
Parameters
- $attribute : mixed
- $value : mixed
_createKey()
protected
static _createKey(mixed $parameters) : mixed
Parameters
- $parameters : mixed
_isExistsModel()
protected
_isExistsModel() : mixed
_loadExistsModel()
protected
_loadExistsModel() : bool
Return values
boolgetJobparameters()
protected
getJobparameters(mixed $dalayedSave) : mixed
Parameters
- $dalayedSave : mixed
getJobSecondaryId()
protected
getJobSecondaryId() : mixed
getJobUserId()
protected
getJobUserId() : mixed
saveJobProtectedData()
protected
saveJobProtectedData(mixed $subAction, array<string|int, mixed> $data) : mixed
Parameters
- $subAction : mixed
- $data : array<string|int, mixed>
getPartAssocCountryTwo()
private
static getPartAssocCountryTwo(int $countryId, array<string|int, mixed> $partAssoc) : mixed
Parameters
- $countryId : int
- $partAssoc : array<string|int, mixed>
getPartAssocLocalVatId()
private
static getPartAssocLocalVatId(array<string|int, mixed> $partAssoc) : mixed
Parameters
- $partAssoc : array<string|int, mixed>
prepareVatIdRegex()
private
static prepareVatIdRegex(string $format) : string
Parameters
- $format : string