AutoAssign
extends Base
in package
Auto Assign class.
Table of Contents
- MEMBERS_TABLES = ['s_#__auto_assign_users' => 'id', 's_#__auto_assign_groups' => 'id', 's_#__auto_assign_roles' => 'id']
- METHOD_LOAD_BALANCE = 0
- METHOD_ROUND_ROBIN = 1
- MODE_HANDLER = 2
- MODE_MANUAL = 1
- MODE_WORKFLOW = 4
- ROUND_ROBIN_TABLE = 'u_#__auto_assign_rr'
- STATUS_ACTIVE = 1
- STATUS_INACTIVE = 0
- TABLE_NAME = 's_#__auto_assign'
- $value : array<string|int, mixed>
- __construct() : mixed
- Constructor.
- checkConditionForRecord() : bool
- Check conditions for record.
- get() : mixed
- Function to get the value for a given key.
- getArray() : array<string|int, mixed>
- Function to get the array values for a given key.
- getAutoAssignForRecord() : self|null
- Get auto assign instance for record.
- getAvailableUsersQuery() : QueryGenerator
- Query generator object of available users.
- getByModule() : array<string|int, mixed>
- Get all auto assign entries for module.
- getData() : array<string|int, mixed>
- Function to get all the values of the Object.
- getDefaultOwner() : int
- Get default owner.
- getForHtml() : mixed
- Function to get the html encoded value for a given key.
- getForSql() : mixed
- Function to get the value if its safe to use for SQL Query (column).
- getId() : int
- Function to get the Id.
- getInstance() : self|null
- Get auto assign instance by data.
- getInstanceById() : self|null
- Get auto assign instance by ID.
- getInstancesByModule() : array<string|int, mixed>
- Get all auto assign instances for module.
- getKeys() : array<string|int, string>
- Function to get keys.
- getMembers() : array<string|int, mixed>
- Get members.
- getModuleName() : string
- Get module name.
- getName() : string
- Get name of auto assign instance.
- getOwner() : int
- Get an automatic selected user ID.
- getOwners() : array<string|int, mixed>
- Get automatic selected users.
- getQuery() : Query
- Query object for users allowed for assignment.
- getQueryByLoadBalance() : Query
- Query object for users allowed to be assigned by load balanced method.
- getQueryByRoundRobin() : Query
- Query object for users allowed to be assigned by round robin.
- has() : bool
- Function to check if the key exists.
- isActive() : bool
- Check if the instance is active in a given mode.
- isEmpty() : bool
- Function to check if the key is empty.
- postProcess() : void
- Post process action.
- remove() : mixed
- Function to remove the value.
- set() : $this
- Function to set the value for a given key.
- setData() : $this
- Function to set all the values.
Constants
MEMBERS_TABLES
public
array<string|int, mixed>
MEMBERS_TABLES
= ['s_#__auto_assign_users' => 'id', 's_#__auto_assign_groups' => 'id', 's_#__auto_assign_roles' => 'id']
Members tables
METHOD_LOAD_BALANCE
public
int
METHOD_LOAD_BALANCE
= 0
Load balance method
METHOD_ROUND_ROBIN
public
int
METHOD_ROUND_ROBIN
= 1
Round robin method
MODE_HANDLER
public
int
MODE_HANDLER
= 2
Handler mode
MODE_MANUAL
public
int
MODE_MANUAL
= 1
Manual mode
MODE_WORKFLOW
public
int
MODE_WORKFLOW
= 4
Workflow mode
ROUND_ROBIN_TABLE
public
string
ROUND_ROBIN_TABLE
= 'u_#__auto_assign_rr'
Round robin table name
STATUS_ACTIVE
public
int
STATUS_ACTIVE
= 1
Status active
STATUS_INACTIVE
public
int
STATUS_INACTIVE
= 0
Status inactive
TABLE_NAME
public
string
TABLE_NAME
= 's_#__auto_assign'
Basic table name
Properties
$value
protected
array<string|int, mixed>
$value
Values
Methods
__construct()
Constructor.
public
__construct([array<string|int, mixed> $values = [] ]) : mixed
Parameters
- $values : array<string|int, mixed> = []
Return values
mixed —checkConditionForRecord()
Check conditions for record.
public
checkConditionForRecord(Vtiger_Record_Model $recordModel) : bool
Parameters
- $recordModel : Vtiger_Record_Model
Return values
bool —get()
Function to get the value for a given key.
public
get(string $key) : mixed
Parameters
- $key : string
Return values
mixed —Value for the given key
getArray()
Function to get the array values for a given key.
public
getArray(string $key[, array<string|int, mixed> $value = [] ]) : array<string|int, mixed>
Parameters
- $key : string
- $value : array<string|int, mixed> = []
Return values
array<string|int, mixed> —getAutoAssignForRecord()
Get auto assign instance for record.
public
static getAutoAssignForRecord(Vtiger_Record_Model $recordModel[, int|null $mode = null ]) : self|null
Parameters
- $recordModel : Vtiger_Record_Model
- $mode : int|null = null
-
A bitmask of one or more of the mode flags
Return values
self|null —getAvailableUsersQuery()
Query generator object of available users.
public
getAvailableUsersQuery() : QueryGenerator
Return values
QueryGenerator —getByModule()
Get all auto assign entries for module.
public
static getByModule(string $moduleName[, int $mode = self::MODE_HANDLER | self::MODE_WORKFLOW | self::MODE_MANUAL ][, int $state = self::STATUS_ACTIVE ]) : array<string|int, mixed>
Parameters
- $moduleName : string
- $mode : int = self::MODE_HANDLER | self::MODE_WORKFLOW | self::MODE_MANUAL
-
A bitmask of one or more of the mode flags
- $state : int = self::STATUS_ACTIVE
Return values
array<string|int, mixed> —getData()
Function to get all the values of the Object.
public
getData() : array<string|int, mixed>
Return values
array<string|int, mixed> —getDefaultOwner()
Get default owner.
public
getDefaultOwner() : int
Return values
int —getForHtml()
Function to get the html encoded value for a given key.
public
getForHtml(string $key) : mixed
Parameters
- $key : string
Return values
mixed —getForSql()
Function to get the value if its safe to use for SQL Query (column).
public
getForSql(string $key[, bool $skipEmtpy = true ]) : mixed
Parameters
- $key : string
- $skipEmtpy : bool = true
-
Skip the check if string is empty
Return values
mixed —Value for the given key
getId()
Function to get the Id.
public
getId() : int
Return values
int —getInstance()
Get auto assign instance by data.
public
static getInstance(array<string|int, mixed> $data) : self|null
Parameters
- $data : array<string|int, mixed>
Return values
self|null —getInstanceById()
Get auto assign instance by ID.
public
static getInstanceById(int $id) : self|null
Parameters
- $id : int
Return values
self|null —getInstancesByModule()
Get all auto assign instances for module.
public
static getInstancesByModule(string $moduleName[, int|null $mode = null ]) : array<string|int, mixed>
Parameters
- $moduleName : string
- $mode : int|null = null
-
A bitmask of one or more of the mode flags
Return values
array<string|int, mixed> —getKeys()
Function to get keys.
public
getKeys() : array<string|int, string>
Return values
array<string|int, string> —getMembers()
Get members.
public
getMembers() : array<string|int, mixed>
Return values
array<string|int, mixed> —getModuleName()
Get module name.
public
getModuleName() : string
Return values
string —getName()
Get name of auto assign instance.
public
getName([bool $encode = true ]) : string
Parameters
- $encode : bool = true
Return values
string —getOwner()
Get an automatic selected user ID.
public
getOwner() : int
Return values
int —getOwners()
Get automatic selected users.
public
getOwners() : array<string|int, mixed>
Return values
array<string|int, mixed> —getQuery()
Query object for users allowed for assignment.
public
getQuery() : Query
Return values
Query —getQueryByLoadBalance()
Query object for users allowed to be assigned by load balanced method.
public
getQueryByLoadBalance() : Query
In order to correctly balance the entries attribution we need ot randomize the order in which they are returned. Otherwise, when multiple users have the same amount of entries it is always the first one in the results who will be assigned to new entry.
Return values
Query —getQueryByRoundRobin()
Query object for users allowed to be assigned by round robin.
public
getQueryByRoundRobin() : Query
Return values
Query —has()
Function to check if the key exists.
public
has(string $key) : bool
Parameters
- $key : string
Return values
bool —isActive()
Check if the instance is active in a given mode.
public
isActive(int $mode) : bool
Parameters
- $mode : int
Return values
bool —isEmpty()
Function to check if the key is empty.
public
isEmpty(string $key) : bool
Parameters
- $key : string
Return values
bool —postProcess()
Post process action.
public
postProcess(int $userId) : void
Parameters
- $userId : int
Return values
void —remove()
Function to remove the value.
public
remove(string $key) : mixed
Parameters
- $key : string
Return values
mixed —set()
Function to set the value for a given key.
public
set(string $key, mixed $value) : $this
Parameters
- $key : string
- $value : mixed
Return values
$this —setData()
Function to set all the values.
public
setData(mixed $values) : $this
Parameters
- $values : mixed