DealCategory
Table of Contents
Constants
- MARKETPLACE_CRM_ORIGINATOR = 'marketplace_crm_originator'
Methods
- add() : int
- Add new entry.
- checkReadPermission() : bool
- Check if user may read deal categories.
- convertFromPermissionEntityType() : int
- Try to convert permission entity type to deal category entry ID.
- convertFromStatusEntityID() : int
- Try to convert status entity ID to deal category entry ID.
- convertToPermissionEntityType() : string
- Convert deal category entry ID to permission entity type.
- convertToStatusEntityID() : string
- Convert deal category entry ID to status entity ID.
- copyPermissionById() : Result
- Copies category permissions from one to another
- correctStageNamespaceID() : void
- Add namespace identifier to existing stage IDs if it was not added.
- createDefaultStages() : void
- Create default deal stage set for specified deal category entry.
- delete() : void
- Delete entry by ID.
- erasePermissions() : void
- Remove all permissions those are belong to specified deal category entry.
- eraseStages() : void
- Remove all deal stages those are belong to specified deal category entry.
- exists() : bool
- Check if entry already exists.
- get() : array<string|int, mixed>|null
- Retrieve entry by ID.
- getAll() : array<string|int, mixed>
- Get all entries
- getAllIDs() : array<string|int, mixed>
- Get all entry IDs
- getAllPermissionEntityTypes() : mixed
- getCount() : int
- Get total quantity
- getDefaultCategoryName() : string
- Get name of default category.
- getDefaultCategorySort() : int
- Get Sort of default category.
- getFieldCaption() : mixed
- getFieldsInfo() : array<string|int, mixed>
- Get metadata fields.
- getFullStageList() : mixed
- getJavaScriptInfos() : array<string|int, mixed>
- Prepare JavaScript infos
- getList() : Result
- Get entry list
- getName() : string
- Retrive entry name
- getPermissionById() : mixed
- getPermissionEntityTypeList() : mixed
- getPermissionRoleConfiguration() : array<string|int, mixed>
- getPermissionRoleConfigurations() : mixed
- getPermissionRoleConfigurationsWithDefault() : array<string|int, mixed>
- getSelectListItems() : array<string|int, mixed>
- Retrive items for select options
- getStageByName() : mixed
- getStageFilterInfo() : array<string|int, mixed>
- Prepare stage filter info
- getStageGroupInfos() : array<string|int, mixed>
- Prepare stage grouping data according to categories
- getStageInfos() : array<string|int, mixed>
- Get stage infos for specified deal category entry.
- getStageList() : array<string|int, mixed>
- Get stage list for specified deal category entry.
- getStageName() : mixed
- getStatusEntityID() : string
- Get stage infos for specified deal category entry.
- hasDependencies() : bool
- Check if category has deals.
- hasPermissionEntity() : bool
- Check if specified permission entity belong to deal category entry
- hasStage() : mixed
- hasStageNamespaceID() : bool
- Check if specified Stage ID includes namespace ID of specified Category.
- hasStatusEntity() : bool
- Check if specified status entity belong to deal category entry
- isCustomized() : bool
- Check if exist one or more user-defined categories.
- isEnabled() : bool
- Check if entry exists and is not locked.
- normalizeStatusIds() : mixed
- prepareFormID() : string
- Prepare Form ID fom specified category
- prepareSelectListItems() : array<string|int, mixed>
- Prepare select options for specified items
- prepareStageID() : string
- Prepare unique stage ID.
- prepareStageNamespaceID() : string
- Prepare Deal stage namespace identifier.
- prepareStatusEntityInfos() : mixed
- Add to destination array status entity type infos for all registered deal category entries.
- removeColorScheme() : void
- removeStageNamespaceID() : mixed
- Remove namespace identifier from stage ID.
- resolveByName() : int
- Resolve category entry ID by name.
- resolveFromStageID() : int
- Resolve category entry ID from stage ID.
- setDefaultCategoryName() : mixed
- Assign user-defined value for name of default category.
- setDefaultCategorySort() : mixed
- Assign user-defined value for sort of default category.
- setPermissionById() : Result
- Sets permission for all roles
- update() : void
- Update entry fields.
Constants
MARKETPLACE_CRM_ORIGINATOR
public
mixed
MARKETPLACE_CRM_ORIGINATOR
= 'marketplace_crm_originator'
Methods
add()
Add new entry.
public
static add(array<string|int, mixed> $fields) : int
Parameters
- $fields : array<string|int, mixed>
-
Fields.
Tags
Return values
intcheckReadPermission()
Check if user may read deal categories.
public
static checkReadPermission([CCrmPerms|null $userPermissions = null ]) : bool
Parameters
- $userPermissions : CCrmPerms|null = null
Return values
boolconvertFromPermissionEntityType()
Try to convert permission entity type to deal category entry ID.
public
static convertFromPermissionEntityType(string $entityType) : int
Returns 0 if entityType is equal to 'DEAL' Returns -1 if conversion failed.
Parameters
- $entityType : string
-
Permission entity type.
Return values
intconvertFromStatusEntityID()
Try to convert status entity ID to deal category entry ID.
public
static convertFromStatusEntityID(string $entityID) : int
Returns 0 if entityID is equal to 'DEAL_STAGE' Returns -1 if conversion failed.
Parameters
- $entityID : string
-
Status entity ID.
Return values
intconvertToPermissionEntityType()
Convert deal category entry ID to permission entity type.
public
static convertToPermissionEntityType(int $id) : string
Parameters
- $id : int
-
Entry ID.
Return values
stringconvertToStatusEntityID()
Convert deal category entry ID to status entity ID.
public
static convertToStatusEntityID(int $ID) : string
Parameters
- $ID : int
-
Entry ID.
Return values
stringcopyPermissionById()
Copies category permissions from one to another
public
static copyPermissionById(int $id, int $donorId) : Result
Parameters
- $id : int
- $donorId : int
Return values
ResultcorrectStageNamespaceID()
Add namespace identifier to existing stage IDs if it was not added.
public
static correctStageNamespaceID(string $categoryID) : void
Parameters
- $categoryID : string
-
Category ID.
createDefaultStages()
Create default deal stage set for specified deal category entry.
public
static createDefaultStages(int $ID) : void
Parameters
- $ID : int
-
Deal category ID.
delete()
Delete entry by ID.
public
static delete(int $ID) : void
Parameters
- $ID : int
-
Entry ID.
Tags
erasePermissions()
Remove all permissions those are belong to specified deal category entry.
public
static erasePermissions(int $ID) : void
Parameters
- $ID : int
-
Deal category entry ID (must be greater than 0).
eraseStages()
Remove all deal stages those are belong to specified deal category entry.
public
static eraseStages(int $ID) : void
Parameters
- $ID : int
-
Deal category entry ID (must be greater than 0).
exists()
Check if entry already exists.
public
static exists(int $ID) : bool
Parameters
- $ID : int
-
Entry ID.
Tags
Return values
boolget()
Retrieve entry by ID.
public
static get(int $ID) : array<string|int, mixed>|null
Parameters
- $ID : int
-
Entry ID.
Return values
array<string|int, mixed>|nullgetAll()
Get all entries
public
static getAll([bool $enableDefault = false ][, array<string|int, mixed> $sort = null ]) : array<string|int, mixed>
Parameters
- $enableDefault : bool = false
-
Add default category (default category is virtual and has ID = 0).
- $sort : array<string|int, mixed> = null
-
Sorting params.
Tags
Return values
array<string|int, mixed>getAllIDs()
Get all entry IDs
public
static getAllIDs() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getAllPermissionEntityTypes()
public
static getAllPermissionEntityTypes() : mixed
getCount()
Get total quantity
public
static getCount() : int
Return values
intgetDefaultCategoryName()
Get name of default category.
public
static getDefaultCategoryName() : string
Returns user-defined value if assigned or system default value.
Tags
Return values
stringgetDefaultCategorySort()
Get Sort of default category.
public
static getDefaultCategorySort() : int
Returns user-defined value if assigned or 0.
Tags
Return values
intgetFieldCaption()
public
static getFieldCaption(mixed $fieldName) : mixed
Parameters
- $fieldName : mixed
getFieldsInfo()
Get metadata fields.
public
static getFieldsInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>getFullStageList()
public
static getFullStageList() : mixed
getJavaScriptInfos()
Prepare JavaScript infos
public
static getJavaScriptInfos([array<string|int, mixed> $IDs = null ][, bool $encode = false ]) : array<string|int, mixed>
Parameters
- $IDs : array<string|int, mixed> = null
-
Entry IDs to add.
- $encode : bool = false
-
Enable html encoding of names.
Return values
array<string|int, mixed>getList()
Get entry list
public
static getList(array<string|int, mixed> $params) : Result
Parameters
- $params : array<string|int, mixed>
-
List params.
Tags
Return values
ResultgetName()
Retrive entry name
public
static getName(int $ID) : string
Parameters
- $ID : int
-
Entry ID.
Return values
stringgetPermissionById()
public
static getPermissionById(int $id) : mixed
Parameters
- $id : int
getPermissionEntityTypeList()
public
static getPermissionEntityTypeList() : mixed
getPermissionRoleConfiguration()
public
static getPermissionRoleConfiguration(int $id) : array<string|int, mixed>
Parameters
- $id : int
Return values
array<string|int, mixed>getPermissionRoleConfigurations()
public
static getPermissionRoleConfigurations() : mixed
getPermissionRoleConfigurationsWithDefault()
public
static getPermissionRoleConfigurationsWithDefault() : array<string|int, mixed>
Return values
array<string|int, mixed>getSelectListItems()
Retrive items for select options
public
static getSelectListItems([bool $enableDefault = true ]) : array<string|int, mixed>
Parameters
- $enableDefault : bool = true
-
Add default category (default category is virtual and has ID = 0).
Return values
array<string|int, mixed>getStageByName()
public
static getStageByName(mixed $name[, mixed $ID = 0 ]) : mixed
Parameters
- $name : mixed
- $ID : mixed = 0
getStageFilterInfo()
Prepare stage filter info
public
static getStageFilterInfo([array<string|int, mixed>|null $params = null ]) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>|null = null
-
Field params
Return values
array<string|int, mixed>getStageGroupInfos()
Prepare stage grouping data according to categories
public
static getStageGroupInfos() : array<string|int, mixed>
Return values
array<string|int, mixed>getStageInfos()
Get stage infos for specified deal category entry.
public
static getStageInfos(int $ID) : array<string|int, mixed>
Parameters
- $ID : int
-
Deal category entry ID.
Return values
array<string|int, mixed>getStageList()
Get stage list for specified deal category entry.
public
static getStageList(int $ID) : array<string|int, mixed>
Parameters
- $ID : int
-
Deal category entry ID.
Return values
array<string|int, mixed>getStageName()
public
static getStageName(mixed $stageID[, mixed $ID = -1 ]) : mixed
Parameters
- $stageID : mixed
- $ID : mixed = -1
getStatusEntityID()
Get stage infos for specified deal category entry.
public
static getStatusEntityID(int $ID) : string
Parameters
- $ID : int
-
Deal category entry ID.
Return values
stringhasDependencies()
Check if category has deals.
public
static hasDependencies(int $ID) : bool
Parameters
- $ID : int
-
Entry ID.
Return values
boolhasPermissionEntity()
Check if specified permission entity belong to deal category entry
public
static hasPermissionEntity(string $entityType) : bool
Parameters
- $entityType : string
-
Permission entity.
Return values
boolhasStage()
public
static hasStage(mixed $stageID[, mixed $ID = -1 ]) : mixed
Parameters
- $stageID : mixed
- $ID : mixed = -1
hasStageNamespaceID()
Check if specified Stage ID includes namespace ID of specified Category.
public
static hasStageNamespaceID(string $stageID, int $ID) : bool
Parameters
- $stageID : string
-
Stage ID.
- $ID : int
-
Category ID.
Return values
boolhasStatusEntity()
Check if specified status entity belong to deal category entry
public
static hasStatusEntity(string $entityID) : bool
Parameters
- $entityID : string
-
Status entity ID.
Return values
boolisCustomized()
Check if exist one or more user-defined categories.
public
static isCustomized() : bool
Return values
boolisEnabled()
Check if entry exists and is not locked.
public
static isEnabled(int $ID) : bool
Parameters
- $ID : int
-
Entry ID.
Tags
Return values
boolnormalizeStatusIds()
public
static normalizeStatusIds(array<string|int, mixed> $stages) : mixed
Parameters
- $stages : array<string|int, mixed>
prepareFormID()
Prepare Form ID fom specified category
public
static prepareFormID(int $categoryId, int $sourceFormId[, mixed $useUpperCase = true ]) : string
Parameters
- $categoryId : int
-
Entry ID.
- $sourceFormId : int
-
Initial form ID.
- $useUpperCase : mixed = true
Return values
stringprepareSelectListItems()
Prepare select options for specified items
public
static prepareSelectListItems(array<string|int, mixed> $IDs) : array<string|int, mixed>
Parameters
- $IDs : array<string|int, mixed>
-
Item IDs.
Return values
array<string|int, mixed>prepareStageID()
Prepare unique stage ID.
public
static prepareStageID(int $ID, string $stageID) : string
For example if entry ID is 15 and stage ID is "PREPARATION", then string "C15:PREPARATION" will be returnted. Where "C15" is namespace ID and "PREPARATION" is specific stage ID.
Parameters
- $ID : int
-
Entry ID.
- $stageID : string
-
Specific stage ID (for example "NEW" or "WON")
Return values
stringprepareStageNamespaceID()
Prepare Deal stage namespace identifier.
public
static prepareStageNamespaceID(int $ID) : string
For example if category entry ID is 15 then string "C15" will be returned.
Parameters
- $ID : int
-
Entry ID.
Return values
stringprepareStatusEntityInfos()
Add to destination array status entity type infos for all registered deal category entries.
public
static prepareStatusEntityInfos(array<string|int, mixed> &$entityTypes[, mixed $enableDefault = false ]) : mixed
Parameters
- $entityTypes : array<string|int, mixed>
-
Destination array.
- $enableDefault : mixed = false
removeColorScheme()
public
static removeColorScheme(int $ID) : void
Parameters
- $ID : int
-
Deal category entry ID (must be greater than 0).
removeStageNamespaceID()
Remove namespace identifier from stage ID.
public
static removeStageNamespaceID(string $stageID) : mixed
For example if stage ID is "C15:WON" (where prefix "C15:" is namespace identifier) then string "WON" will be returned.
Parameters
- $stageID : string
-
Deal stage ID.
resolveByName()
Resolve category entry ID by name.
public
static resolveByName(string $name) : int
Parameters
- $name : string
-
Entry name.
Return values
intresolveFromStageID()
Resolve category entry ID from stage ID.
public
static resolveFromStageID(string $stageID) : int
If stage ID contains namespace ID. For example if stageID is "C15:NEW", then "C15" is namespace ID and category entry ID is 15.
Parameters
- $stageID : string
-
Stage ID.
Return values
intsetDefaultCategoryName()
Assign user-defined value for name of default category.
public
static setDefaultCategoryName(string $name) : mixed
Parameters
- $name : string
-
Default Category Name.
Tags
setDefaultCategorySort()
Assign user-defined value for sort of default category.
public
static setDefaultCategorySort(int $sort) : mixed
Parameters
- $sort : int
-
Default category sort.
Tags
setPermissionById()
Sets permission for all roles
public
static setPermissionById(int $id, string $permission) : Result
Possible can damage existed permissions. Do not use!
Parameters
- $id : int
- $permission : string
Return values
Resultupdate()
Update entry fields.
public
static update(int $ID, array<string|int, mixed> $fields) : void
Parameters
- $ID : int
-
Entry ID.
- $fields : array<string|int, mixed>
-
Entry fields.