Function saveModulePermissions
has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring. Open
protected function saveModulePermissions($moduleModel, $permissions)
{
$db = \App\Db::getInstance();
$dbCommand = $db->createCommand();
$profileId = $this->getId();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File Record.php
has 672 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
Function save
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
public function save()
{
$db = App\Db::getInstance();
$profileName = $this->get('profilename');
$description = $this->get('description');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method saveModulePermissions
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function saveModulePermissions($moduleModel, $permissions)
{
$db = \App\Db::getInstance();
$dbCommand = $db->createCommand();
$profileId = $this->getId();
Settings_Profiles_Record_Model
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Profile field inactive.
*
Function getModulePermissions
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function getModulePermissions()
{
if (!isset($this->module_permissions)) {
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
$profileTabPermissions = $this->getProfileTabPermissions();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class Settings_Profiles_Record_Model has an overall complexity of 159 which is very high. The configured complexity threshold is 50. Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Profile field inactive.
*
- Exclude checks
Method save
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function save()
{
$db = App\Db::getInstance();
$profileName = $this->get('profilename');
$description = $this->get('description');
Method getModulePermissions
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getModulePermissions()
{
if (!isset($this->module_permissions)) {
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
$profileTabPermissions = $this->getProfileTabPermissions();
Method getRecordLinks
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getRecordLinks(): array
{
$links = [];
$recordLinks = [
Consider simplifying this complex logical expression. Open
if (!(
4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3])
|| 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
|| 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')
)
Function hasModuleActionPermission
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function hasModuleActionPermission($module, $action)
{
$actionId = false;
if (\is_object($action) && is_a($action, 'Vtiger_Action_Model')) {
$actionId = $action->getId();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getProfileUtilityPermissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getProfileUtilityPermissions()
{
if (!isset($this->profile_utility_permissions)) {
$profile2UtilityPermissions = [];
if ($this->getId()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getProfileActionPermissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getProfileActionPermissions()
{
if (!isset($this->profile_action_permissions)) {
$profile2ActionPermissions = [];
if ($this->getId()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getProfileTabFieldPermissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getProfileTabFieldPermissions($tabId)
{
if (!isset($this->profile_tab_field_permissions[$tabId])) {
$profile2TabFieldPermissions = [];
if ($this->getId()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The method saveModulePermissions() has an NPath complexity of 12996. The configured NPath complexity threshold is 200. Open
protected function saveModulePermissions($moduleModel, $permissions)
{
$db = \App\Db::getInstance();
$dbCommand = $db->createCommand();
$profileId = $this->getId();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method saveModulePermissions() has 136 lines of code. Current threshold is set to 100. Avoid really long methods. Open
protected function saveModulePermissions($moduleModel, $permissions)
{
$db = \App\Db::getInstance();
$dbCommand = $db->createCommand();
$profileId = $this->getId();
- Exclude checks
The method save() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10. Open
public function save()
{
$db = App\Db::getInstance();
$profileName = $this->get('profilename');
$description = $this->get('description');
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method getModulePermissions() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function getModulePermissions()
{
if (!isset($this->module_permissions)) {
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
$profileTabPermissions = $this->getProfileTabPermissions();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method saveModulePermissions() has a Cyclomatic Complexity of 34. The configured cyclomatic complexity threshold is 10. Open
protected function saveModulePermissions($moduleModel, $permissions)
{
$db = \App\Db::getInstance();
$dbCommand = $db->createCommand();
$profileId = $this->getId();
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Reduce the number of returns of this function 4, down to the maximum allowed 3. Open
public function hasModuleActionPermission($module, $action)
- Read upRead up
- Exclude checks
Having too many return statements in a function increases the function's essential complexity because the flow of execution is broken each time a return statement is encountered. This makes it harder to read and understand the logic of the function.
Noncompliant Code Example
With the default threshold of 3:
function myFunction(){ // Noncompliant as there are 4 return statements if (condition1) { return true; } else { if (condition2) { return false; } else { return true; } } return false; }
Class "Settings_Profiles_Record_Model" has 37 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 28 to the 15 allowed. Open
public function getModulePermissions()
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 49 to the 15 allowed. Open
public function save()
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 101 to the 15 allowed. Open
protected function saveModulePermissions($moduleModel, $permissions)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The class Settings_Profiles_Record_Model has a coupling between objects value of 14. Consider to reduce the number of dependencies under 13. Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Profile field inactive.
*
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '424', column '24'). Open
$dataReader = (new App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '448', column '24'). Open
$dataReader = (new App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '140', column '31'). Open
$globalPermissions = (new App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '531', column '79'). Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '691', column '29'). Open
'permissions' => new \yii\db\Expression($caseExpression),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '976', column '17'). Open
$query = (new App\Db\Query())->select(['id'])->from('vtiger_users')
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '531', column '22'). Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getInstanceByName has a boolean flag argument $checkOnlyDirectlyRelated, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
The method getUsersList has a boolean flag argument $profileId, which is a certain sign of a Single Responsibility Principle violation. Open
public static function getUsersList($profileId = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '861', column '22'). Open
$dataReader = (new App\Db\Query())->from('vtiger_profile')
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '838', column '22'). Open
$dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '910', column '17'). Open
$query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '533', column '30'). Open
->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '397', column '24'). Open
$dataReader = (new App\Db\Query())->from('vtiger_profile2field')
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '375', column '36'). Open
$profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '710', column '28'). Open
'permission' => new \yii\db\Expression($caseExpression),
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '886', column '15'). Open
$row = (new App\Db\Query())->from('vtiger_profile')
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method saveModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
//Insert Process
//Standard permissions
$dataToInsert = [];
foreach ($actionsIdsList as $actionId => $permission) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method getProfileTabModel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$module = Vtiger_Module_Model::getInstance($module);
$tabId = $module->getId();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Db' in method 'save'. Open
$db = App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method hasModuleActionPermission uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$action = Vtiger_Action_Model::getInstance($action);
$actionId = $action->getId();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Cache' in method 'getInstanceById'. Open
if (App\Cache::has('ProfilesRecordModelById', $profileId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method saveModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$utilityIdsList[$actionId] = $permission;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\UserPrivilegesFile' in method 'recalculate'. Open
\App\UserPrivilegesFile::createUserPrivilegesfile($userId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_INACTIVE;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method saveModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;
$readOnly = Settings_Profiles_Module_Model::FIELD_READWRITE;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Action_Model' in method 'getModulePermissions'. Open
$allTabActions = Vtiger_Action_Model::getAll(true);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Profiles_Module_Model' in method 'save'. Open
$allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getProfileTabModel'. Open
$module = Vtiger_Module_Model::getInstance($module);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Field_Model' in method 'getProfileTabFieldModel'. Open
$field = Vtiger_Field_Model::getInstance($field, $profileTabModel);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method saveModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$actionEnabled = true;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Cache' in method 'getInstanceById'. Open
return App\Cache::get('ProfilesRecordModelById', $profileId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Config' in method 'recalculate'. Open
$php_max_execution_time = \App\Config::main('php_max_execution_time');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Action_Model' in method 'hasModuleActionPermission'. Open
$action = Vtiger_Action_Model::getInstance($action);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Access' in method 'delete'. Open
vtlib\Access::syncSharingAccess();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'saveModulePermissions'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method saveModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$isModulePermitted = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Privilege' in method 'saveModulePermissions'. Open
\App\Privilege::setUpdater($moduleModel->getName());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Settings_Profiles_Module_Model' in method 'getModulePermissions'. Open
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getModulePermissions uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$permissions['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$db->createCommand()->update('vtiger_profile', [
'profilename' => $profileName,
'description' => $description,
'directly_related_to_role' => $isProfileDirectlyRelatedToRole,
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Action_Model' in method 'save'. Open
$actionModels = Vtiger_Action_Model::getAll(true);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method save uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$permissions = [];
$permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
if ($moduleModel->isEntityModule()) {
$permissions['actions'] = [];
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Link_Model' in method 'getRecordLinks'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getInstanceById'. Open
App\Cache::save('ProfilesRecordModelById', $profileId, $profile);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getProfileTabFieldModel uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$field = Vtiger_Field_Model::getInstance($field, $profileTabModel);
$fieldId = $field->getId();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Module_Model' in method 'save'. Open
$allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getModulePermissions'. Open
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method delete uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->execute();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Define a constant instead of duplicating this literal "fieldid" 3 times. Open
$fieldId = $row['fieldid'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile2tab" 4 times. Open
->from('vtiger_profile2tab')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "LISTVIEWRECORD" 3 times. Open
'linktype' => 'LISTVIEWRECORD',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "directly_related_to_role" 6 times. Open
if ($this->has('directly_related_to_role')) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "globalactionpermission" 3 times. Open
->select(['globalactionid', 'globalactionpermission'])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkurl" 3 times. Open
'linkurl' => $this->getEditViewUrl(),
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "permissions" 11 times. Open
$modulePermissions = $moduleModule->get('permissions');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile2utility" 4 times. Open
->from('vtiger_profile2utility')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile2standardpermissions" 4 times. Open
->from('vtiger_profile2standardpermissions')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkicon" 3 times. Open
'linkicon' => 'yfi yfi-full-editing-view',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "readonly" 8 times. Open
$fieldReadOnlyPermission = $fieldPermissions['readonly'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linktype" 3 times. Open
'linktype' => 'LISTVIEWRECORD',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "is_permitted" 8 times. Open
$moduleAccessPermission = $modulePermissions['is_permitted'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_role2profile" 6 times. Open
->from('vtiger_role2profile')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkclass" 3 times. Open
'linkclass' => 'btn btn-primary btn-sm',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile2field" 4 times. Open
$dataReader = (new App\Db\Query())->from('vtiger_profile2field')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "fields" 7 times. Open
$permissions['fields'] = [];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile" 7 times. Open
$dbCommand->delete('vtiger_profile', ['profileid' => $profileId])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linklabel" 3 times. Open
'linklabel' => 'LBL_EDIT_RECORD',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "permission" 3 times. Open
$profile2UtilityPermissions[$row['tabid']][$row['activityid']] = $row['permission'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "roleid" 7 times. Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "globalactionid" 3 times. Open
->select(['globalactionid', 'globalactionpermission'])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "presence" 3 times. Open
if (!(4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3]))
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "profilename" 5 times. Open
return $this->get('profilename');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "ProfilesRecordModelById" 3 times. Open
if (App\Cache::has('ProfilesRecordModelById', $profileId)) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "profileid" 31 times. Open
return $this->get('profileid');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_profile2globalpermissions" 5 times. Open
->from('vtiger_profile2globalpermissions')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "description" 4 times. Open
return $this->get('description');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "visible" 9 times. Open
$fieldAccessPermission = $fieldPermissions['visible'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "actions" 11 times. Open
$moduleActionPermissions = $modulePermissions['actions'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "tabid" 12 times. Open
$profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused local variables such as '$utilityActionName'. Open
foreach (Vtiger_Action_Model::$utilityActions as $utilityActionId => $utilityActionName) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Argument 2 (field)
is \Vtiger_Field_Model|\vtlib\Field|\vtlib\FieldBasic
but \Settings_Profiles_Record_Model::hasModuleFieldWritePermission()
takes int
defined at /code/modules/Settings/Profiles/models/Record.php:263
Open
if ($this->hasModuleFieldWritePermission($module, $field)) {
- Exclude checks
Argument 1 (module)
is string
but \Settings_Profiles_Record_Model::getProfileTabModel()
takes \Vtiger_Module_Model
defined at /code/modules/Settings/Profiles/models/Record.php:324
Open
$moduleModule = $this->getProfileTabModel($module);
- Exclude checks
Argument 1 (value)
is \Vtiger_Field_Model|\vtlib\Field|\vtlib\FieldBasic
but \Vtiger_Field_Model::getInstance()
takes int|string
defined at /code/modules/Vtiger/models/Field.php:1158
Open
$field = Vtiger_Field_Model::getInstance($field, $profileTabModel);
- Exclude checks
Argument 2 (field)
is int
but \Settings_Profiles_Record_Model::getProfileTabFieldModel()
takes \Vtiger_Field_Model
defined at /code/modules/Settings/Profiles/models/Record.php:348
Open
$fieldModel = $this->getProfileTabFieldModel($module, $field);
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions
Open
if (!isset($this->profile_tab_permissions)) {
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())->from('vtiger_profile2field')
- Exclude checks
Argument 1 (module)
is string
but \Settings_Profiles_Record_Model::getProfileTabModel()
takes \Vtiger_Module_Model
defined at /code/modules/Settings/Profiles/models/Record.php:324
Open
$profileTabModel = $this->getProfileTabModel($module);
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions
Open
if (!isset($this->profile_utility_permissions)) {
- Exclude checks
Argument 1 (module)
is string
but \Settings_Profiles_Record_Model::getProfileTabModel()
takes \Vtiger_Module_Model
defined at /code/modules/Settings/Profiles/models/Record.php:324
Open
$moduleModel = $this->getProfileTabModel($module);
- Exclude checks
Argument 2 (field)
is int
but \Settings_Profiles_Record_Model::getProfileTabFieldModel()
takes \Vtiger_Field_Model
defined at /code/modules/Settings/Profiles/models/Record.php:348
Open
$fieldModel = $this->getProfileTabFieldModel($module, $field);
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions
(Did you mean $profile2TabFieldPermissions) Open
$this->profile_tab_field_permissions[$tabId] = $profile2TabFieldPermissions;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions
(Did you mean $profile2ActionPermissions) Open
return $this->profile_action_permissions;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$globalPermissions = (new App\Db\Query())
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions
Open
if (!isset($this->global_permissions)) {
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions
(Did you mean $globalPermissions) Open
$this->global_permissions = $globalPermissions;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->global_permissions
(Did you mean $globalPermissions) Open
return $this->global_permissions;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions
(Did you mean $profile2TabPermissions) Open
$this->profile_tab_permissions = $profile2TabPermissions;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions
Open
if (!isset($this->profile_tab_field_permissions[$tabId])) {
- Exclude checks
Argument 1 (value)
is \App\Base|\Vtiger_Action_Model
but \Vtiger_Action_Model::getInstance()
takes int
defined at /code/modules/Vtiger/models/Action.php:126
Open
$action = Vtiger_Action_Model::getInstance($action);
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_field_permissions
(Did you mean $profile2TabFieldPermissions) Open
return $this->profile_tab_field_permissions[$tabId];
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_tab_permissions
(Did you mean $profile2TabPermissions) Open
return $this->profile_tab_permissions;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions
(Did you mean $profile2ActionPermissions) Open
$this->profile_action_permissions = $profile2ActionPermissions;
- Exclude checks
Returning type \Settings_Profiles_Record_Model
but setId()
is declared to return int
Open
return $this;
- Exclude checks
Argument 1 (mixed)
is \Vtiger_Module_Model|\vtlib\Module|\vtlib\ModuleBasic
but \Vtiger_Module_Model::getInstance()
takes int|string
defined at /code/modules/Vtiger/models/Module.php:197
Open
$module = Vtiger_Module_Model::getInstance($module);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_action_permissions
Open
if (!isset($this->profile_action_permissions)) {
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions
(Did you mean $profile2UtilityPermissions) Open
$this->profile_utility_permissions = $profile2UtilityPermissions;
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
App\Cache::save('ProfilesRecordModelById', $profileId, $profile);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new App\Db\Query())->select(['id'])->from('vtiger_users')
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
$caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Argument 1 (moduleName)
is false
but \App\Privilege::setUpdater()
takes string
defined at /code/app/Privilege.php:575
Open
\App\Privilege::setUpdater($moduleModel->getName());
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new App\Db\Query())->from('vtiger_profile')
- Exclude checks
Default value for int
$profileId
can't be false
Open
public static function getUsersList($profileId = false)
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = $db->createCommand();
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
$caseExpression .= " ELSE {$db->quoteValue(1)} END ";
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_profile2globalpermissions', [
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::get()
takes string
defined at /code/app/Cache.php:61
Open
return App\Cache::get('ProfilesRecordModelById', $profileId);
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
Open
return $this->module_permissions;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_profile', [
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::has()
takes string
defined at /code/app/Cache.php:74
Open
if (App\Cache::has('ProfilesRecordModelById', $profileId)) {
- Exclude checks
Call to undeclared method \App\Db::quoteValue
Open
$caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$dataReader = (new App\Db\Query())->from('vtiger_profile')
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_profile2globalpermissions', [
- Exclude checks
Return type of getInstanceByName()
is undeclared type \self
Open
public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
Open
if (!isset($this->module_permissions)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
'permissions' => new \yii\db\Expression($caseExpression),
- Exclude checks
Returning type null
but getInstanceByName()
is declared to return \Settings_Profiles_Record_Model|\self
Open
return null;
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->profile_utility_permissions
(Did you mean $profile2UtilityPermissions) Open
return $this->profile_utility_permissions;
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_profile', [
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
'permission' => new \yii\db\Expression($caseExpression),
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])
- Exclude checks
Reference to undeclared property \Settings_Profiles_Record_Model->module_permissions
Open
$this->module_permissions = $allModules;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getProfileUtilityPermissions()
{
if (!isset($this->profile_utility_permissions)) {
$profile2UtilityPermissions = [];
if ($this->getId()) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 127.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public function getProfileActionPermissions()
{
if (!isset($this->profile_action_permissions)) {
$profile2ActionPermissions = [];
if ($this->getId()) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 127.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid excessively long variable names like $moduleActionPermission. Keep variable name length under 20. Open
$moduleActionPermission = $moduleActionPermissions[$actionId];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $moduleActionPermissions. Keep variable name length under 20. Open
$moduleActionPermissions = $modulePermissions['actions'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profile2TabPermissions. Keep variable name length under 20. Open
$profile2TabPermissions = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $checkOnlyDirectlyRelated. Keep variable name length under 20. Open
public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $moduleAccessPermission. Keep variable name length under 20. Open
$moduleAccessPermission = $modulePermissions['is_permitted'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fieldReadOnlyPermission. Keep variable name length under 20. Open
$fieldReadOnlyPermission = $fieldPermissions['readonly'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profile2UtilityPermissions. Keep variable name length under 20. Open
$profile2UtilityPermissions = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profile2ActionPermissions. Keep variable name length under 20. Open
$profile2ActionPermissions = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileTabPermissions. Keep variable name length under 20. Open
$profileTabPermissions = $this->getProfileTabPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $defaultFieldPermission. Keep variable name length under 20. Open
$defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileUtilityPermissions. Keep variable name length under 20. Open
$profileUtilityPermissions = $this->getProfileUtilityPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fieldAccessPermission. Keep variable name length under 20. Open
$fieldAccessPermission = $fieldPermissions['visible'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileActionPermissions. Keep variable name length under 20. Open
$profileActionPermissions = $this->getProfileActionPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $isProfileDirectlyRelatedToRole. Keep variable name length under 20. Open
$isProfileDirectlyRelatedToRole = 0;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileActionPermissions. Keep variable name length under 20. Open
$profileActionPermissions = $this->getProfileActionPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $fieldAccessPermission. Keep variable name length under 20. Open
$fieldAccessPermission = $fieldPermissions['visible'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileUtilityPermissions. Keep variable name length under 20. Open
$profileUtilityPermissions = $this->getProfileUtilityPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileTabPermissionsBase. Keep variable name length under 20. Open
$profileTabPermissionsBase = $this->getProfileTabPermissions();
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profileTabPermissions. Keep variable name length under 20. Open
$profileTabPermissions = $profileTabPermissionsBase[$tabId] ?? false;
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $moduleAccessPermission. Keep variable name length under 20. Open
$moduleAccessPermission = $modulePermissions['is_permitted'];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $profile2TabFieldPermissions. Keep variable name length under 20. Open
$profile2TabFieldPermissions = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $php_max_execution_time. Keep variable name length under 20. Open
$php_max_execution_time = \App\Config::main('php_max_execution_time');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
- Exclude checks
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $id. Configured minimum length is 3. Open
protected function setId($id)
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The class Settings_Profiles_Record_Model is not named in CamelCase. Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
{
/**
* Profile field inactive.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Delete Action Url for the current profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDescription()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Edit View Url for the Profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getGlobalPermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$globalPermissions = $this->getGlobalPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Profile field inactive.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has global write permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the description of the Profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '?module=Profiles&parent=Settings&action=DeleteAjax&record=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Profile field readwrite.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PROFILE_FIELD_READWRITE = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int Profile Id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $viewAllPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasGlobalWritePermission()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PROFILE_FIELD_INACTIVE = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function setId($id)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getEditViewUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDeleteActionUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW] = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT] = Settings_Profiles_Module_Model::GLOBAL_ACTION_DEFAULT_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has global read permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $editAllPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('description');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 218 characters Open
$globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW] = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT] = Settings_Profiles_Module_Model::GLOBAL_ACTION_DEFAULT_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['globalactionid', 'globalactionpermission'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$viewAllPermission = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Field locked UI types.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDeleteAjaxUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=Profiles&parent=Settings&view=DeleteAjax&record=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '?module=Profiles&parent=Settings&view=Edit&record=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDuplicateViewUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->global_permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->global_permissions = $globalPermissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('profileid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('profileid', $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return global permissions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$globalPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasGlobalReadPermission()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Profile field readonly.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->queryAllByGroup(0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->hasGlobalReadPermission()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$globalPermissions = (new App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->global_permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int Profile Id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private static $fieldLockedUiTypes = [70];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Edit View Url for the Profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_profile2globalpermissions')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$globalPermissions = $this->getGlobalPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editAllPermission = $globalPermissions[Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const PROFILE_FIELD_READONLY = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Profile Name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->get('profilename');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '?module=Profiles&parent=Settings&view=Edit&from_record=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Detail Action Url for the Profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modulePermissions = $moduleModule->get('permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldAccessPermission = $fieldPermissions['visible'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleAccessPermission = $modulePermissions['is_permitted'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $this->getProfileTabFieldModel($module, $field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')
- Exclude checks
Line exceeds 120 characters; contains 176 characters Open
&& Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldReadOnlyPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->hasModuleFieldWritePermission($module, $field)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleActionPermissions = $modulePermissions['actions'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldReadOnlyPermission = $fieldPermissions['readonly'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModule = $this->getProfileTabModel($module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE != $moduleAccessPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasModuleFieldPermission($module, $field)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $this->getProfileTabFieldModel($module, $field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Field_Model $field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::PROFILE_FIELD_INACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if module field is locked.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| \in_array($fieldModel->getUIType(), self::$fieldLockedUiTypes)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_object($module) && is_a($module, 'Vtiger_Module_Model')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has module action permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Action_Model $action
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$action = Vtiger_Action_Model::getInstance($action);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modulePermissions = $moduleModel->get('permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions = $fieldModel->get('permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldAccessPermission = $fieldPermissions['visible'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = $module->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->hasModuleFieldPermission($module, $field)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel = $this->getProfileTabFieldModel($module, $field);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
if (isset($moduleActionPermissions[$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleActionPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasModuleFieldWritePermission($module, $field)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasModulePermission($module)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_object($action) && is_a($action, 'Vtiger_Action_Model')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$actionId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleActionPermission = $moduleActionPermissions[$actionId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| 0 === strcasecmp($fieldModel->getFieldDataType(), 'id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|Vtiger_Module_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!(4 === $fieldModel->getDisplayType() || \in_array($fieldModel->get('presence'), [1, 3]))
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($modulePermissions['is_permitted']) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleAccessPermission) {
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
if (isset($modulePermissions['is_permitted']) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleAccessPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return module field permission value.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
|| (1 !== $fieldModel->getDisplayType() && 10 !== $fieldModel->getDisplayType());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return profile tab model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Module_Model $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function hasModuleActionPermission($module, $action)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = $action->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Field_Model $field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fieldModel->isMandatory() || \in_array($fieldModel->get('presence'), [1, 3])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = $action->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($moduleActionPermissions[$actionId]) && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $moduleActionPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
&& Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldAccessPermission && Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $fieldReadOnlyPermission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::PROFILE_FIELD_READWRITE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return self::PROFILE_FIELD_READONLY;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileTabModel($module)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = Vtiger_Module_Model::getInstance($module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleAccessPermission = $modulePermissions['is_permitted'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has module field permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions = $fieldModel->get('permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModuleFieldPermissionValue($module, $field)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isModuleFieldLocked($module, $field)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has module permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
|| 5 === $fieldModel->getDisplayType() || 0 === strcasecmp($fieldModel->getFieldDataType(), 'autogenerated')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel = $this->getProfileTabModel($module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if has module field write permission.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $this->getId(), 'tabid' => $tabId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readOnly = $row['readonly'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_profile2utility')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($profileTabPermissions[$id])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleFields = $profileTabModel->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->profile_tab_permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->profile_tab_field_permissions[$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->profile_action_permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->profile_utility_permissions = $profile2UtilityPermissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileTabPermissions = $this->getProfileTabPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileTabFieldPermissions($tabId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2TabFieldPermissions[$fieldId]['visible'] = $visible;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->profile_tab_field_permissions[$tabId] = $profile2TabFieldPermissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get permission for actions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldId = $field->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2TabFieldPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_profile2standardpermissions')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allTabActions = Vtiger_Action_Model::getAll(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($allTabActions as $actionModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileTabModel = $this->getProfileTabModel($module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$field = Vtiger_Field_Model::getInstance($field, $profileTabModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_profile2tab')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->profile_tab_permissions = $profile2TabPermissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return profile tab field permissions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldId = $row['fieldid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($allModules as $id => $moduleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return profile tab field model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2UtilityPermissions[$row['tabid']][$row['activityid']] = $row['permission'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getModulePermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = $actionModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($profileActionPermissions[$id][$actionId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = $module->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|Vtiger_Field_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldId = $field->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->queryAllByGroup(0);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$tabId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Field_Model $field
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2TabFieldPermissions[$fieldId]['readonly'] = $readOnly;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'][$actionId] = $profileActionPermissions[$id][$actionId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allModulePermissions = $this->getModulePermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $moduleFields[$field->getName()];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2TabPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$visible = $row['visible'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileActionPermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileActionPermissions = $this->getProfileActionPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['is_permitted'] = $profileTabPermissions[$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $allModulePermissions[$tabId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_object($field) && is_a($field, 'Vtiger_Field_Model')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())->from('vtiger_profile2field')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2ActionPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->profile_action_permissions = $profile2ActionPermissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileUtilityPermissions = $this->getProfileUtilityPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2ActionPermissions[$row['tabid']][$row['operation']] = $row['permissions'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get permissions for utility actions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->profile_utility_permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->profile_tab_permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Return module permissions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->profile_tab_field_permissions[$tabId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($this->module_permissions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 160 characters Open
$defaultFieldPermission = $this->getId() ? Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE : Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$fieldId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get permissions for modules.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2TabPermissions = (new App\Db\Query())->select(['tabid', 'permissions'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->profile_action_permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileTabPermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileUtilityPermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->profile_utility_permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getProfileTabFieldModel($module, $field)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile2UtilityPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profileid' => $profileId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($allModuleModules) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions['visible'] = $allFieldPermissions[$fieldId]['visible'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Settings_Profiles_Record_Model $transferToRecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$roleId = $row['roleid'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$description = $this->get('description');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->has('directly_related_to_role')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionId = $actionModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileId = $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_profile', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_profile2globalpermissions', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionModels = Vtiger_Action_Model::getAll(true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_INACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions['readonly'] = $allFieldPermissions[$fieldId]['readonly'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'globalactionpermission' => $this->tranformInputPermissionValue($this->get('editall')),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'globalactionpermission' => $this->tranformInputPermissionValue($this->get('viewall')),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($fieldModel->isViewEnabled()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'][$actionId] = $profileUtilityPermissions[$id][$actionId];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileId = $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileId = $db->getLastInsertID('vtiger_profile_profileid_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profilename' => $profileName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'globalactionid' => Settings_Profiles_Module_Model::GLOBAL_ACTION_VIEW,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'globalactionid' => Settings_Profiles_Module_Model::GLOBAL_ACTION_EDIT,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profilePermissions[$moduleId]['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
$permissions['actions'][$actionModel->getId()] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions['visible'] = $defaultFieldPermission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete($transferToRecord)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileCount = $row['profilecount'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_role2profile', ['roleid' => $roleId, 'profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profilePermissions = $this->get('profile_permissions');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'directly_related_to_role' => $isProfileDirectlyRelatedToRole,
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$profilePermissions[$moduleId]['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->saveModulePermissions($moduleModel, $permissions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2tab', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2standardpermissions', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => $description,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($actionModels as $actionModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($profilePermissions[$moduleId]['actions'][$actionId]) && $actionModel->isModuleEnabled($moduleModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($actionModel->isModuleEnabled($moduleModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (isset($profileUtilityPermissions[$id][$actionId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'][$actionId] = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldPermissions['readonly'] = $defaultFieldPermission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileName = $this->get('profilename');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->saveModulePermissions($moduleModel, $profilePermissions[$moduleId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($actionModels as $actionModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allFieldPermissions = $this->getProfileTabFieldPermissions($id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->module_permissions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2utility', ['profileid' => $profileId])->execute();
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'directly_related_to_role' => $isProfileDirectlyRelatedToRole,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->isWritable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleFields = $moduleModel->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldId = $fieldModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($allFieldPermissions[$fieldId]['readonly'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_role2profile')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profilename' => $profileName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_profile2globalpermissions', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profileid' => $profileId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleId = $moduleModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_READONLY;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->recalculate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
vtlib\Access::syncSharingAccess();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save record to database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel->isEntityModule()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleFields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['fields'][$fieldModel->getId()] = self::PROFILE_FIELD_READWRITE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $profileId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transferProfileId = $transferToRecord->getId();
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
$dbCommand->update('vtiger_role2profile', ['profileid' => $transferProfileId], ['roleid' => $roleId, 'profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_profile', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($allModuleModules as $moduleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($moduleFields as $fieldModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($allFieldPermissions[$fieldId]['visible'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleModel->set('permissions', $permissions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->module_permissions = $allModules;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())->select(['roleid', 'profilecount' => new yii\db\Expression('count(profileid)')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['roleid' => (new App\Db\Query())->select(['roleid'])->from('vtiger_role2profile')->where(['profileid' => $profileId])])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($profileCount > 1) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function save()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$profileId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->groupBy('roleid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->delete('vtiger_profile2globalpermissions', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel->isActive() && isset($profilePermissions[$moduleId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['is_permitted'] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isProfileDirectlyRelatedToRole = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleFields = $moduleModel->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldModel->set('permissions', $fieldPermissions);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete record and optionally transfer assigments to other record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isProfileDirectlyRelatedToRole = $this->get('directly_related_to_role');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->setId($profileId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => $description,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$allModuleModules = Vtiger_Module_Model::getAll([0], Settings_Profiles_Module_Model::getNonVisibleModulesList());
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
if (!isset($profilePermissions[$moduleId]['actions'][$actionId]) && $actionModel->isModuleEnabled($moduleModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['actions'][$actionModel->getId()] = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissions['fields'] = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = $moduleModel->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'permissions' => new \yii\db\Expression($caseExpression),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_profile2utility', [
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$dbCommand->batchInsert('vtiger_profile2utility', ['profileid', 'tabid', 'activityid', 'permission'], $dataToInsert)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($permissions['actions']) || $moduleModel->isUtilityActionEnabled()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($moduleModel->isEntityModule() || $moduleModel->isUtilityActionEnabled()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionPermissions = $permissions['actions'] ?? [];
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
if ($profileActionPermissions || isset($profileTabPermissionsBase[$tabId]) || isset($profileUtilityPermissions[$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($actionsIdsList as $actionId => $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isModulePermitted != $profileTabPermissions) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readOnly = Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Save module permissions to database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileTabPermissions = $profileTabPermissionsBase[$tabId] ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isModulePermitted = $this->tranformInputPermissionValue($permissions['is_permitted']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => $tabId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (self::PROFILE_FIELD_READONLY == $stateValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profileid' => $profileId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $permissions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionPermissions = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$dbCommand->batchInsert('vtiger_profile2standardpermissions', ['profileid', 'tabid', 'operation', 'permissions'], $dataToInsert)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Utility permissions
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->batchInsert('vtiger_profile2utility', ['profileid', 'tabid', 'activityid', 'permission'], $dataToInsert)->execute();
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
$dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId, 'tabid' => $tabId, 'fieldid' => $fieldId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Dividing on actions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($actionPermissions as $actionId => $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Standard permissions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (Vtiger_Action_Model::$utilityActions as $utilityActionId => $utilityActionName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Utility permissions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'permission' => new \yii\db\Expression($caseExpression),
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('vtiger_profile2field', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileId = $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Update process
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($actionsIdsList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_profile2standardpermissions', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Standard permissions
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataToInsert = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'profileid' => $profileId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readOnly = Settings_Profiles_Module_Model::FIELD_READONLY;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileActionPermissions = $this->getProfileActionPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2tab', ['profileid' => $profileId, 'tabid' => $tabId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset(Vtiger_Action_Model::$standardActions[$actionId])) {
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($utilityIdsList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
// Enable module permission in profile2tab table only if either its an extension module or the entity module has atleast 1 action enabled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Privilege::setUpdater($moduleModel->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileUtilityPermissions = $this->getProfileUtilityPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($permission, Vtiger_Action_Model::$nonConfigurableActions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_profile2field', ['profileid' => $profileId, 'tabid' => $tabId, 'fieldid' => $fieldId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['profileid' => $profileId, 'tabid' => $tabId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!isset($utilityIdsList[$utilityActionId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($actionsIdsList && ($moduleModel->isEntityModule())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($permissions['fields']) && \is_array($permissions['fields'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = $db->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($profileActionPermissions || isset($profileTabPermissionsBase[$tabId]) || isset($profileUtilityPermissions[$tabId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
], ['profileid' => $profileId, 'tabid' => $tabId])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($actionEnabled && isset($permissions['is_permitted'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isModulePermitted = Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (self::PROFILE_FIELD_INACTIVE == $stateValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileActionPermissions = $profileActionPermissions[$tabId] ?? false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$utilityIdsList = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionsIdsList[$actionId] = $permission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($permission, Vtiger_Action_Model::$nonConfigurableActions)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression .= " WHEN operation = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($actionsIdsList as $actionId => $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($utilityIdsList as $actionId => $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$visible = Settings_Profiles_Module_Model::FIELD_INACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$visible = Settings_Profiles_Module_Model::FIELD_ACTIVE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$readOnly = Settings_Profiles_Module_Model::FIELD_READWRITE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression .= 'ELSE permissions END ';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataToInsert[] = [$profileId, $tabId, $actionId, $this->tranformInputPermissionValue($permission)];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// Enable module permission in profile2tab table only if either its an extension module or the entity module has atleast 1 action enabled
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$utilityIdsList[$actionId] = $permission;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$moduleModel->isEntityModule()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = 'on';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionEnabled = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$utilityIdsList[$utilityActionId] = 'off';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permission = 'on';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->batchInsert('vtiger_profile2standardpermissions', ['profileid', 'tabid', 'operation', 'permissions'], $dataToInsert)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($permissions['fields'] as $fieldId => $stateValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tabid' => $tabId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fieldid' => $fieldId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function saveModulePermissions($moduleModel, $permissions)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($actionsIdsList[$actionId])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissionValue = $this->tranformInputPermissionValue($permission);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($utilityIdsList as $actionId => $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression .= " ELSE {$db->quoteValue(1)} END ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($utilityIdsList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('vtiger_profile2tab', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'visible' => $visible,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Module_Model $moduleModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profileTabPermissionsBase = $this->getProfileTabPermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$actionsIdsList = Vtiger_Action_Model::$standardActions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression = 'CASE';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (Settings_Profiles_Module_Model::IS_PERMITTED_VALUE == $permission) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$caseExpression = 'CASE';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$permissionValue = $this->tranformInputPermissionValue($permission);
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
$caseExpression .= " WHEN activityid = {$db->quoteValue($actionId)} THEN {$db->quoteValue($permissionValue)} ";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//Insert Process
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataToInsert = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'permissions' => $isModulePermitted,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'readonly' => $readOnly,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_DELETE_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profiles[$profile->getId()] = $profile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Settings_Profiles_Module_Model::NOT_PERMITTED_VALUE;
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
'linkurl' => "javascript:Settings_Vtiger_List_Js.triggerDelete(event,'" . $this->getDeleteActionUrl() . "')",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profiles = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to check whether the profiles is directly related to role.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWRECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($recordLinks as $recordLink) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())->select(['vtiger_profile.*'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_profile')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $profile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Create instance by profile name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $excludedRecordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $profiles;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \self
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceByName($profileName, $checkOnlyDirectlyRelated = false, $excludedRecordId = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = $query->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $links;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new App\Db\Query())->from('vtiger_profile')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['profileid' => $profileId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return Settings_Profiles_Module_Model::IS_PERMITTED_VALUE;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn btn-danger btn-sm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profiles = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($excludedRecordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the Detail Url for the current group.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $profiles;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return App\Cache::get('ProfilesRecordModelById', $profileId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param bool $checkOnlyDirectlyRelated
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn btn-primary btn-sm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_role2profile.roleid' => $roleId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get all the profiles.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profiles[$profile->getId()] = $profile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Profiles_Record_Model instance, if exists. Null otherwise
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (App\Cache::has('ProfilesRecordModelById', $profileId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRecordLinks(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => $this->getEditViewUrl(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'yfi yfi-full-editing-view',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWRECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn btn-primary btn-sm',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAll()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Transform input permission value.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('on' === $value || '1' === $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_DUPLICATE_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Profiles_Record_Model[] Array of Settings_Profiles_Record_Model instances
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('ProfilesRecordModelById', $profileId, $profile);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from('vtiger_profile')->where(['profilename' => $profileName]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['NOT IN', 'profileid', $excludedRecordId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\UserPrivilegesFile::createUserPrivilegesfile($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $profileId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected function tranformInputPermissionValue($value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => $this->getDuplicateViewUrl(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWRECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Settings_Profiles_Record_Model[] Array of Settings_Profiles_Record_Model instances
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_role2profile', 'vtiger_role2profile.profileid = vtiger_profile.profileid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new App\Db\Query())->from('vtiger_profile')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getUsersList($profileId = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_user2role', 'vtiger_user2role.userid = vtiger_users.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get all the profiles linked to the given role.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $roleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDetailViewUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($profileId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($checkOnlyDirectlyRelated) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordLinks = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => "javascript:Settings_Vtiger_List_Js.triggerDelete(event,'" . $this->getDeleteActionUrl() . "')",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-trash-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAllByRole($roleId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the instance of Profile model, given profile id.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $profileId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstanceById($profileId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $profileName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $query->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_EDIT_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-clone',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$profile->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['directly_related_to_role' => 1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $profile;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return '?module=Profiles&parent=Settings&view=Detail&record=' . $this->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$php_max_execution_time = \App\Config::main('php_max_execution_time');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return int[] list of user ids
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_role2profile', 'vtiger_role2profile.roleid = vtiger_user2role.roleid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['vtiger_role2profile.profileid' => $profileId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_users.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function recalculate()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($userIdsList as $userId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userIdsList = self::getUsersList($this->getId());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($userIdsList) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Users list from this Profile.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isDirectlyRelated()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new App\Db\Query())->select(['id'])->from('vtiger_users')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function recalculate the sharing rules.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isDirectlyRelated = $this->get('directly_related_to_role');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 == $isDirectlyRelated) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
set_time_limit($php_max_execution_time);
- Exclude checks
Class name "Settings_Profiles_Record_Model" is not in camel caps format Open
class Settings_Profiles_Record_Model extends Settings_Vtiger_Record_Model
- Exclude checks
The variable $php_max_execution_time is not named in camelCase. Open
public function recalculate()
{
$php_max_execution_time = \App\Config::main('php_max_execution_time');
set_time_limit($php_max_execution_time);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $php_max_execution_time is not named in camelCase. Open
public function recalculate()
{
$php_max_execution_time = \App\Config::main('php_max_execution_time');
set_time_limit($php_max_execution_time);
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}