File Item.php
has 515 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Picklist value item.
*
* @package App
Method getFieldInstanceByName
has 132 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getFieldInstanceByName($name)
{
$params = [];
$qualifiedModuleName = 'Settings:Picklist';
$tableName = $this->getTableName();
The class Item has an overall complexity of 119 which is very high. The configured complexity threshold is 50. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
- Exclude checks
Function saveToDb
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function saveToDb(): bool
{
$db = \App\Db::getInstance();
$result = false;
$fieldName = $this->fieldModel->getName();
- 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
Item
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
Method delete
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function delete(int $replaceId)
{
$db = \App\Db::getInstance();
$fieldName = $this->fieldModel->getName();
$transaction = $db->beginTransaction();
Method saveToDb
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function saveToDb(): bool
{
$db = \App\Db::getInstance();
$result = false;
$fieldName = $this->fieldModel->getName();
Function getFieldInstanceByName
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getFieldInstanceByName($name)
{
$params = [];
$qualifiedModuleName = 'Settings:Picklist';
$tableName = $this->getTableName();
- 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 getEditFields
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getEditFields(): array
{
$fields = [];
$editFields = ['name'];
$editFields[] = 'icon';
- 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 validateValue
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateValue(string $fieldName, $value)
{
switch ($fieldName) {
case 'name':
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
Function validateValue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function validateValue(string $fieldName, $value)
{
switch ($fieldName) {
case 'name':
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
- 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
Consider simplifying this complex logical expression. Open
if ($itemPropertyModel && isset($this->{$name}) && ($this->getId() || (!$this->getId() && '' !== $this->{$name}))) {
$this->validateValue($name, $this->{$name});
$forSave[$itemPropertyModel->getTableName()][$itemPropertyModel->getColumnName()] = $this->{$name};
} elseif (isset($this->{$name}) && ($this->getId() || (!$this->getId() && '' !== $this->{$name}))) {
$this->validateValue($name, $this->{$name});
Method getEditFields
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEditFields(): array
{
$fields = [];
$editFields = ['name'];
$editFields[] = 'icon';
Method rename
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rename()
{
$newValue = $this->name;
$previousValue = $this->getPreviousValue('name');
$fieldName = $this->fieldModel->getName();
Function getValuesToSave
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function getValuesToSave(): array
{
$forSave = [];
$tableName = $this->getTableName();
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
Consider simplifying this complex logical expression. Open
if ($this->getId() && !\in_array($key, ['id']) && ($propertyExists && $this->{$key} !== $value && (null !== $this->{$key} || '' !== $value)) && !\array_key_exists($key, $this->changes)) {
$this->changes[$key] = $this->get($key);
}
Function updateRolePermissions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function updateRolePermissions()
{
if ($this->valueid && null !== $this->roles) {
$dbCommand = \App\Db::getInstance()->createCommand();
$dbCommand->delete('vtiger_role2picklist', ['picklistvalueid' => $this->valueid])->execute();
- 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 getData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getData()
{
$data = [];
foreach (get_object_vars($this) as $name => $value) {
if (\is_object($value) || 'value' === $name || 'changes' === $name || null === $value) {
- 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 getFieldInstanceByName() has 136 lines of code. Current threshold is set to 100. Avoid really long methods. Open
public function getFieldInstanceByName($name)
{
$params = [];
$qualifiedModuleName = 'Settings:Picklist';
$tableName = $this->getTableName();
- Exclude checks
The method saveToDb() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function saveToDb(): bool
{
$db = \App\Db::getInstance();
$result = false;
$fieldName = $this->fieldModel->getName();
- 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 validateValue() has a Cyclomatic Complexity of 19. The configured cyclomatic complexity threshold is 10. Open
public function validateValue(string $fieldName, $value)
{
switch ($fieldName) {
case 'name':
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
- 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 getValuesToSave() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
private function getValuesToSave(): array
{
$forSave = [];
$tableName = $this->getTableName();
if (!$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
The method getFieldInstanceByName() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. Open
public function getFieldInstanceByName($name)
{
$params = [];
$qualifiedModuleName = 'Settings:Picklist';
$tableName = $this->getTableName();
- 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 class Item has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
- 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 '75', column '40'). Open
$instance->close_state = (int) (new \App\Db\Query())->from('u_#__picklist_close_state')->where(['valueid' => $instance->valueid, 'fieldid' => $fieldModel->getId()])->exists();
- 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 '520', column '16'). Open
throw new \App\Exceptions\IllegalValue("LBL_NOT_FILLED_MANDATORY_FIELDS||{$fieldName}", 512);
- 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 '549', column '16'). Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- 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 '523', column '16'). Open
throw new \App\Exceptions\IllegalValue("ERR_SPECIAL_CHARACTERS_NOT_ALLOWED||{$fieldName}||{$value}", 512);
- 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 '529', column '16'). Open
throw new \App\Exceptions\IllegalValue("ERR_DUPLICATES_VALUES_FOUND||{$fieldName}||{$value}", 513);
- 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 '553', column '15'). Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- 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 '339', column '23'). Open
$dataReader = (new \App\Db\Query())->select(['tablename', 'columnname', 'fieldid', 'tabid'])
- 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 '544', column '16'). Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- 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 '333', column '25'). Open
$dependencyId = (new \App\Db\Query())->select(['s_#__picklist_dependency.id'])->from('s_#__picklist_dependency')->innerJoin('s_#__picklist_dependency_data', 's_#__picklist_dependency_data.id = s_#__picklist_dependency.id')
- 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 '526', column '16'). Open
throw new \App\Exceptions\IllegalValue("ERR_EXCEEDED_NUMBER_CHARACTERS||{$fieldName}||{$value}", 406);
- 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 '353', column '25'). Open
$eventHandler = new \App\EventHandler();
- 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 '235', column '21'). Open
return (int) (new \App\Db\Query())->from($this->getTableName())->max('sortorderid') + 1;
- 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 '323', column '51'). Open
$replaceValue = \App\Purifier::decodeHtml((new \App\Db\Query())->select([$this->fieldModel->getName()])
- 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 '294', column '24'). Open
$eventHandler = new \App\EventHandler();
- 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 '280', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['tablename', 'columnname', 'fieldid', 'tabid'])
- 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
Avoid assigning values to variables in if clauses and the like (line '211', column '9'). Open
public function updateRolePermissions()
{
if ($this->valueid && null !== $this->roles) {
$dbCommand = \App\Db::getInstance()->createCommand();
$dbCommand->delete('vtiger_role2picklist', ['picklistvalueid' => $this->valueid])->execute();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Fields\Picklist' in method 'getInstance'. Open
}
- 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\Log' in method 'saveToDb'. Open
\App\Log::error($ex->__toString());
- 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\Log' in method 'save'. Open
\App\Log::error($e->__toString());
- 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\Fields\Picklist' in method 'saveToDb'. Open
$primaryKey = \App\Fields\Picklist::getPickListId($fieldName);
- 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\Utils' in method 'saveToDb'. Open
\vtlib\Utils::addColumn($baseTable, $column, $criteria);
- 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 'saveToDb'. 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
Avoid using static access to class '\App\Fields\Picklist' in method 'save'. Open
\App\Fields\Picklist::clearCache($this->fieldModel->getName(), $this->fieldModel->getModuleName());
- 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\Fields\Picklist' in method 'rename'. Open
\App\Fields\Picklist::clearCache($fieldName, $this->fieldModel->getModuleName());
- 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\Fields\Picklist' in method 'delete'. Open
\App\Fields\Picklist::clearCache($fieldName, $this->fieldModel->getModuleName());
- 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\Fields\Picklist' in method 'delete'. Open
$primaryKey = \App\Fields\Picklist::getPickListId($this->fieldModel->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_Roles_Record_Model' in method 'getFieldInstanceByName'. Open
foreach (\Settings_Roles_Record_Model::getAll() as $key => $roleModel) {
- 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\Module' in method 'rename'. Open
$moduleName = \App\Module::getModuleName($row['tabid']);
- 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\Fields\Picklist' in method 'rename'. Open
\App\Fields\Picklist::clearCache($fieldName, $moduleName);
- 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\Language' in method 'validate'. Open
'message' => \App\Language::translate('LBL_DUPLICATE', 'Settings:Picklist')
- 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\Fields\Picklist' in method 'updateRolePermissions'. Open
$picklistId = \App\Fields\Picklist::getPicklistIdNr($this->fieldModel->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 '\App\Db' in method 'delete'. 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
Avoid using static access to class '\App\Module' in method 'delete'. Open
$moduleName = \App\Module::getModuleName($row['tabid']);
- 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\Fields\Picklist' in method 'delete'. Open
\App\Fields\Picklist::clearCache($fieldName, $moduleName);
- 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\Language' in method 'getFieldInstanceByName'. Open
\App\RecordStatus::TIME_COUNTING_REACTION => \App\Language::translate('LBL_TIME_COUNTING_REACTION', $qualifiedModuleName),
- 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\Language' in method 'getFieldInstanceByName'. Open
\App\RecordStatus::TIME_COUNTING_IDLE => \App\Language::translate('LBL_TIME_COUNTING_IDLE', $qualifiedModuleName)
- 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\Language' in method 'getFieldInstanceByName'. Open
$params['picklistValues'][$key] = \App\Language::translate($value, $qualifiedModuleName);
- 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\Language' in method 'getFieldInstanceByName'. Open
$params['picklistValues'][$key] = \App\Language::translate($roleModel->get('rolename'), 'Settings:Roles');
- 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\Validator' in method 'validateValue'. Open
if (!\App\Validator::integer($value)) {
- 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\RecordStatus' in method 'getFieldInstanceByName'. Open
foreach (\App\RecordStatus::getLabels() as $key => $value) {
- 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\Fields\Picklist' in method 'getTableName'. Open
return \App\Fields\Picklist::getPickListTableName($this->fieldModel->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 '\App\Fields\Picklist' in method 'isDuplicateValue'. Open
$picklistValues = \App\Fields\Picklist::getValuesName($this->fieldModel->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 '\App\Language' in method 'getFieldInstanceByName'. Open
0 => \App\Language::translate('LBL_NONE', '_Base'),
- 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\Purifier' in method 'delete'. Open
$replaceValue = \App\Purifier::decodeHtml((new \App\Db\Query())->select([$this->fieldModel->getName()])
->from($this->getTableName())
->where([$primaryKey => $replaceId])
->scalar());
- 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\Log' in method 'delete'. Open
\App\Log::error($ex->__toString());
- 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\Language' in method 'getFieldInstanceByName'. Open
\App\RecordStatus::TIME_COUNTING_RESOLVE => \App\Language::translate('LBL_TIME_COUNTING_RESOLVE', $qualifiedModuleName),
- 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 assigning values to variables in if clauses and the like (line '464', column '15'). Open
public function getEditFields(): array
{
$fields = [];
$editFields = ['name'];
$editFields[] = 'icon';
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Language' in method 'getFieldInstanceByName'. Open
'all' => \App\Language::translate('LBL_ALL_ROLES', $qualifiedModuleName)
- 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
syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Open
if ($insertValueList = array_map(fn ($roleid) => [$roleid, $this->valueid, $picklistId], $this->roles)) {
- Exclude checks
The property $record_state is not named in camelCase. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
public static function getInstance(\Vtiger_Field_Model $fieldModel, ?int $id): self
- 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 property $time_counting is not named in camelCase. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $close_state is not named in camelCase. Open
class Item extends \App\Base
{
/** @var int Item ID */
protected $id;
/** @var string Item name */
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
protected $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
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
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Sort ID */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $fieldModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
$instance->close_state = (int) (new \App\Db\Query())->from('u_#__picklist_close_state')->where(['valueid' => $instance->valueid, 'fieldid' => $fieldModel->getId()])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [
- 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
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($dataForSave[$baseTable][$column])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$criteria = $db->getSchema()->createColumnSchemaBuilder($type, $length)->defaultValue('');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\vtlib\Utils::addColumn($baseTable, $column, $criteria);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->presence = (int) $data['presence'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->prefix = $data['prefix'] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getId(): 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
/**
- 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
$primaryKey = \App\Fields\Picklist::getPickListId($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Item ID */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $color;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $record_state;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get instance.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->description = $data['description'] ?? null;
- Exclude checks
Spaces must 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 set($key, $value)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->getId() && !\in_array($key, ['id']) && ($propertyExists && $this->{$key} !== $value && (null !== $this->{$key} || '' !== $value)) && !\array_key_exists($key, $this->changes)) {
- Exclude checks
Spaces must 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->getPreviousValue('name')) {
- Exclude checks
Spaces must 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 string Icon */
- Exclude checks
Spaces must 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
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = \App\Fields\Picklist::getValues($fieldModel->getName())[$id];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $instance;
- Exclude checks
Spaces must 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
'icon' => [\yii\db\Schema::TYPE_STRING, 255]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = $this->saveToDb();
- Exclude checks
Spaces must 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 string Description */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $valueid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->valueid = isset($data['picklist_valueid']) ? (int) $data['picklist_valueid'] : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Record state */
- Exclude checks
Line exceeds 120 characters; contains 195 characters Open
if ($this->getId() && !\in_array($key, ['id']) && ($propertyExists && $this->{$key} !== $value && (null !== $this->{$key} || '' !== $value)) && !\array_key_exists($key, $this->changes)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $time_counting;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function get($key)
- Exclude checks
Spaces must 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->validate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataForSave = $this->getValuesToSave();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int|null $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->id = $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->name = $data['picklistValue'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->sortorderid = (int) $data['sortorderid'];
- Exclude checks
Spaces must 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 \Settings_Picklist_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
$instance->fieldModel = $fieldModel;
- Exclude checks
Spaces must 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\Fields\Picklist::clearCache($this->fieldModel->getName(), $this->fieldModel->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transaction = $db->beginTransaction();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Item ID for role */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $name;
- Exclude checks
Spaces must 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 Changes */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance = new self();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->rename();
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \property_exists($this, $key) ? $this->{$key} : parent::get($key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'prefix' => [\yii\db\Schema::TYPE_STRING, 30],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $e) {
- Exclude checks
Spaces must 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 ($this->getDbTypes() as $column => $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Item name */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $icon;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Color */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Time counting */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->color = $data['color'] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (int) $this->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 save(): 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
\App\Log::error($e->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $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
$propertyExists = \property_exists($this, $key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets field datatypes.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw $e;
- Exclude checks
Spaces must 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
protected $prefix;
- Exclude checks
Spaces must 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 $propertyExists ? $this->{$key} = $value : parent::set($key, $value);
- 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
public function getDbTypes(): 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
* Save.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int Permission level */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string Prefix for numbering */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var int State for the record */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \Vtiger_Field_Model $fieldModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getInstance(\Vtiger_Field_Model $fieldModel, ?int $id): self
- 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
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$result = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $this->fieldModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$baseTable = $this->getTableName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $roles;
- 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
'color' => [\yii\db\Schema::TYPE_STRING, 25],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $result;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function saveToDb(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $sortorderid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $changes = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** @var string[] Role IDs */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->icon = $data['icon'] ?? null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->record_state = isset($data['record_state']) ? (int) $data['record_state'] : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->close_state = (int) (new \App\Db\Query())->from('u_#__picklist_close_state')->where(['valueid' => $instance->valueid, 'fieldid' => $fieldModel->getId()])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->changes[$key] = $this->get($key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'description' => \yii\db\Schema::TYPE_TEXT,
- Exclude checks
Spaces must 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
* Save data to database.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$type, $length] = $type;
- Exclude checks
Spaces must 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 $presence = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $close_state;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$instance->time_counting = isset($data['time_counting']) ? (int) $data['time_counting'] : null;
- 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
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$length = null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->delete($tableName, ['fieldid' => $this->fieldModel->getId(), 'valueid' => $this->valueid])->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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_field', ['defaultvalue' => $newValue], ['defaultvalue' => $previousValue, 'fieldid' => $row['fieldid']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = \App\Module::getModuleName($row['tabid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('PicklistAfterRename');
- Exclude checks
Spaces must 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
$eventHandler->setParams([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transaction = $db->beginTransaction();
- Exclude checks
Spaces must 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 = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get next sequence number.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getNextSeq(): int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get writable fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getWritableFields(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Rename item value in other data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$previousValue = $this->getPreviousValue('name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler = new \App\EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$replaceValue = \App\Purifier::decodeHtml((new \App\Db\Query())->select([$this->fieldModel->getName()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$vId = $db->getUniqueID('vtiger_picklistvalues');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update($tableName, $tableData, [$primaryKey => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (bool) $result;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($insertValueList = array_map(fn ($roleid) => [$roleid, $this->valueid, $picklistId], $this->roles)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->fieldModel->isRoleBased()) {
- Exclude checks
Spaces must 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
* @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
* Get field model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isDeletable(): 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
* @param int $replaceId Item 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 \Settings_Picklist_Field_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFieldModel(): \Settings_Picklist_Field_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = $row['tablename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update($tableName, [$columnName => $newValue], [$columnName => $previousValue])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\Picklist::clearCache($fieldName, $this->fieldModel->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($dataForSave as $tableName => $tableData) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transaction->commit();
- Exclude checks
Spaces must 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 rename()
- 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
} elseif ('u_#__picklist_close_state' === $tableName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $ex) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw $ex;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (int) (new \App\Db\Query())->from($this->getTableName())->max('sortorderid') + 1;
- 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
\App\Fields\Picklist::clearCache($fieldName, $moduleName);
- Exclude checks
Spaces must 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
$transaction->rollBack();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistId = \App\Fields\Picklist::getPicklistIdNr($this->fieldModel->getName());
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
if ($insertValueList = array_map(fn ($roleid) => [$roleid, $this->valueid, $picklistId], $this->roles)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
return ['name', 'presence', 'sortorderid', 'presence', 'description', 'prefix', 'icon', 'record_state', 'time_counting', 'close_state'];
- Exclude checks
Spaces must 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->fieldModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'oldvalue' => $previousValue,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $this->fieldModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->getId() && $baseTable === $tableName) {
- Exclude checks
Spaces must 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_role2picklist', ['roleid', 'picklistvalueid', 'picklistid'], $insertValueList)->execute();
- 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
}
- Exclude checks
Spaces must 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 = (new \App\Db\Query())->select(['tablename', 'columnname', 'fieldid', 'tabid'])
- 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
$result = $db->createCommand()->insert($tableName, $tableData)->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->id = $db->getLastInsertID($tableName . '_' . $primaryKey . '_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update role 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_role2picklist', ['picklistvalueid' => $this->valueid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->roles) {
- Exclude checks
Spaces must 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 getTableName(): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableData['picklist_valueid'] = $vId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($baseTable === $tableName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($ex->__toString());
- Exclude checks
Spaces must 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 updateRolePermissions()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return ['name', 'presence', 'sortorderid', 'presence', 'description', 'prefix', 'icon', 'record_state', 'time_counting', 'close_state'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if item is deletable.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->valueid && null !== $this->roles) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnName = $row['columnname'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get table name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$primaryKey = \App\Fields\Picklist::getPickListId($this->fieldModel->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
$fieldName = $this->fieldModel->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_field')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 172 characters Open
$db->createCommand()->insert($tableName, ['fieldid' => $this->fieldModel->getId(), 'valueid' => $this->valueid, 'value' => $this->name])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateRolePermissions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Fields\Picklist::getPickListTableName($this->fieldModel->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
/**
- Exclude checks
Spaces must 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 = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'newvalue' => $newValue,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $this->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->close_state) {
- Exclude checks
Spaces must 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 1 === $this->presence && $this->fieldModel->isEditable();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newValue = $this->name;
- 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
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Delete item.
- 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
->from($this->getTableName())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('valueid', $vId);
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
$db->createCommand()->delete($tableName, ['fieldid' => $this->fieldModel->getId(), 'valueid' => $this->valueid])->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
}
- Exclude checks
Spaces must 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(['fieldname' => $fieldName, 'uitype' => [15, 16, 33]])
- Exclude checks
Spaces must 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(int $replaceId)
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert($tableName, ['fieldid' => $this->fieldModel->getId(), 'valueid' => $this->valueid, 'value' => $this->name])->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
*
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$dbCommand->batchInsert('vtiger_role2picklist', ['roleid', 'picklistvalueid', 'picklistid'], $insertValueList)->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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$dbCommand->update('vtiger_field', ['defaultvalue' => $newValue], ['defaultvalue' => $previousValue, 'fieldid' => $row['fieldid']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fieldname' => $fieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $moduleName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
try {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where([$primaryKey => $replaceId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function formats data for saving.
- Exclude checks
Spaces must 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
$propertyModel->set('fieldvalue', $defaultValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'message' => \App\Language::translate('LBL_DUPLICATE', 'Settings:Picklist')
- Exclude checks
Spaces must 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
$propertyModel->set('fieldvalue', $this->get($fieldName));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fields;
- Exclude checks
Spaces must 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(['fieldname' => $fieldName, 'uitype' => [15, 16, 33]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\Picklist::clearCache($fieldName, $this->fieldModel->getModuleName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$response = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->scalar());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['source_field' => $this->fieldModel->getId(), 'source_id' => $this->getId()])->column();
- Exclude checks
Spaces must 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_field')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnName = $row['columnname'];
- Exclude checks
Line exceeds 120 characters; contains 148 characters Open
$dbCommand->update('vtiger_field', ['defaultvalue' => $replaceValue], ['defaultvalue' => $this->name, 'fieldid' => $row['fieldid']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getValuesToSave(): 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
$forSave[$itemPropertyModel->getTableName()][$itemPropertyModel->getColumnName()] = $this->{$name};
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (isset($this->{$name}) && ($this->getId() || (!$this->getId() && '' !== $this->{$name}))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return mixed
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $data;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get fields for edit.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function validate(): 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
$response[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_field', ['defaultvalue' => $replaceValue], ['defaultvalue' => $this->name, 'fieldid' => $row['fieldid']])
- 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
throw $ex;
- 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
public function getEditFields(): 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
foreach ($editFields as $fieldName) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->isDuplicateValue()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('vtiger_role2picklist', ['picklistvalueid' => $this->valueid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $moduleName,
- Exclude checks
Spaces must 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 getPreviousValue(?string $fieldName = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'replacevalue' => $replaceValue,
- Exclude checks
Spaces must 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 (\is_object($value) || 'value' === $name || 'changes' === $name || null === $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->fieldModel->getModule()->isEntityModule()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->fieldModel->getFieldParams()['isProcessStatusField'] ?? false) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'time_counting';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'record_state';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (15 === $this->fieldModel->getUIType()) {
- Exclude checks
Spaces must 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('s_#__picklist_dependency_data', ['id' => $dependencyId, 'source_id' => $this->getId()])->execute();
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$dbCommand->delete('s_#__picklist_dependency_data', ['id' => $dependencyId, 'source_id' => $this->getId()])->execute();
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$transaction->commit();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} catch (\Throwable $ex) {
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
if ($itemPropertyModel && isset($this->{$name}) && ($this->getId() || (!$this->getId() && '' !== $this->{$name}))) {
- Exclude checks
Spaces must 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 $fieldName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = implode(',', $value);
- 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
$editFields[] = 'description';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete('u_#__picklist_close_state', ['valueid' => $this->valueid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->trigger('PicklistAfterDelete');
- Exclude checks
Spaces must 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 ($itemPropertyModel && isset($this->{$name}) && ($this->getId() || (!$this->getId() && '' !== $this->{$name}))) {
- Exclude checks
Spaces must 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
* @return array
- 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
$dependencyId = (new \App\Db\Query())->select(['s_#__picklist_dependency.id'])->from('s_#__picklist_dependency')->innerJoin('s_#__picklist_dependency_data', 's_#__picklist_dependency_data.id = s_#__picklist_dependency.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler->setParams([
- 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
$forSave = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'sortorderid' => $this->getNextSeq(),
- Exclude checks
Spaces must 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 $forSave;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'icon';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[$fieldName] = $propertyModel;
- Exclude checks
Line exceeds 120 characters; contains 234 characters Open
$dependencyId = (new \App\Db\Query())->select(['s_#__picklist_dependency.id'])->from('s_#__picklist_dependency')->innerJoin('s_#__picklist_dependency_data', 's_#__picklist_dependency_data.id = s_#__picklist_dependency.id')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'valuetodelete' => [$this->name],
- Exclude checks
Spaces must 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
if (!$this->getId()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$forSave[$tableName][$name] = $this->{$name};
- Exclude checks
Spaces must 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 getData()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$data[$name] = $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
if (\App\Db::getInstance()->getTableSchema($this->getTableName())->getColumn('time_counting')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$propertyModel = $this->getFieldInstanceByName($fieldName);
- Exclude checks
Spaces must 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 = (new \App\Db\Query())->select(['tablename', 'columnname', 'fieldid', 'tabid'])
- 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
$transaction->rollBack();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->validateValue($name, $this->{$name});
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get pervious value by 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
if ($dependencyId) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update($tableName, [$columnName => $replaceValue], [$columnName => $this->name])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fieldname' => $fieldName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $this->getId() ? array_keys($this->changes) : $this->getWritableFields();
- Exclude checks
Spaces must 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->fieldModel->isRoleBased()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->delete($this->getTableName(), [$primaryKey => $this->getId()])->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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = $this->getTableName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fieldName ? ($this->changes[$fieldName] ?? null) : $this->changes;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Basic validation.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'result' => false,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = $row['tablename'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$forSave[$this->getTableName()] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->validateValue($name, $this->{$name});
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields = ['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'roles';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'close_state';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = \App\Module::getModuleName($row['tabid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Fields\Picklist::clearCache($fieldName, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventHandler = new \App\EventHandler();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error($ex->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'presence' => $this->presence,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itemPropertyModel = $this->getFieldInstanceByName($name);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (get_object_vars($this) as $name => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\is_array($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$editFields[] = 'prefix';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (null !== $this->get($fieldName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (($defaultValue = $propertyModel->get('defaultvalue')) !== null) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
throw new \App\Exceptions\IllegalValue("ERR_EXCEEDED_NUMBER_CHARACTERS||{$fieldName}||{$value}", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_DUPLICATES_VALUES_FOUND||{$fieldName}||{$value}", 513);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $name
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::TEXT,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::HTML,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
unset($picklistValues[$this->id]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($fieldName) {
- Exclude checks
Spaces must 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 (!\App\Validator::integer($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (1 !== $value && 0 !== $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'validator' => [['name' => 'FieldLabel']]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 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
'tooltip' => 'LBL_BLOCKED_RECORD_INFO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklistValues = \App\Fields\Picklist::getValuesName($this->fieldModel->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function validateValue(string $fieldName, $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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get fields instance by name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_CLOSES_RECORD',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'color':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'description':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'time_counting':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return Vtiger_Field_Model
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => $this->fieldModel->getMaxValue(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_DESCRIPTION',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '65535',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tooltip' => 'LBL_DESCRIPTION_PREFIXES',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'close_state':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 62,
- Exclude checks
Spaces must 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 (empty($value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($itemPropertyModel->getMaxValue() && \strlen($value) > $itemPropertyModel->getMaxValue()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_ICON',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $fieldName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $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
case 'sortorderid':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must 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
'typeofdata' => 'V~O',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itemPropertyModel = $this->getFieldInstanceByName($fieldName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_EXCEEDED_NUMBER_CHARACTERS||{$fieldName}||{$value}", 406);
- Exclude checks
Spaces must 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
'uitype' => 1,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_PREFIX',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'icon':
- Exclude checks
Spaces must 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 (1 !== $this->presence || !$this->fieldModel->isEditable()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~O',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- 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
* Validate item data.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itemPropertyModel->getUITypeModel()->validate($value, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("LBL_NOT_FILLED_MANDATORY_FIELDS||{$fieldName}", 512);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~O',
- Exclude checks
Spaces must 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
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => 'u_#__picklist_close_state'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must 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
case 'record_state':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $this->fieldModel->getName(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_ITEM_VALUE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 56,
- Exclude checks
Spaces must 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
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- Exclude checks
Spaces must 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 getFieldInstanceByName($name)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$qualifiedModuleName = 'Settings:Picklist';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~M',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tooltip' => 'LBL_DESCRIPTION_VALUE_LIST',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::BOOL,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::TEXT,
- Exclude checks
Spaces must 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 (preg_match('/[\<\>\"\#]/', $value)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_SPECIAL_CHARACTERS_NOT_ALLOWED||{$fieldName}||{$value}", 512);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tableName = $this->getTableName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::TEXT,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'C~O',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '5',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '255',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'name':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'icon':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itemPropertyModel->getUITypeModel()->validate($value, false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
throw new \App\Exceptions\IllegalValue("ERR_NOT_ALLOWED_VALUE||{$fieldName}||{$value}", 406);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'name':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['isEditableReadOnly'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if picklist value exists.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'prefix':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
throw new \App\Exceptions\IllegalValue("ERR_SPECIAL_CHARACTERS_NOT_ALLOWED||{$fieldName}||{$value}", 512);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->isDuplicateValue($value, $this->getId())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 300,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '25',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $response;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isDuplicateValue(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \in_array(strtolower($this->name), array_map('strtolower', $picklistValues));
- Exclude checks
Spaces must 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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'prefix':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'close_state':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'presence':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'description':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'time_counting':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistValues' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Line exceeds 120 characters; contains 146 characters Open
\App\RecordStatus::TIME_COUNTING_REACTION => \App\Language::translate('LBL_TIME_COUNTING_REACTION', $qualifiedModuleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~O',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Line exceeds 120 characters; contains 140 characters Open
return $params ? \Vtiger_Field_Model::init($qualifiedModuleName, $params, $name)->set('sourceFieldModel', $this->fieldModel) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tooltip' => 'LBL_RECORD_STATE_INFO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~M',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 16,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\RecordStatus::TIME_COUNTING_REACTION => \App\Language::translate('LBL_TIME_COUNTING_REACTION', $qualifiedModuleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_RECORD_STATE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['picklistValues'][$key] = \App\Language::translate($value, $qualifiedModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistValues' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '250',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\RecordStatus::TIME_COUNTING_IDLE => \App\Language::translate('LBL_TIME_COUNTING_IDLE', $qualifiedModuleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'record_state':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_ASSIGN_TO_ROLE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '500',
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$params['picklistValues'][$key] = \App\Language::translate($roleModel->get('rolename'), 'Settings:Roles');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
\App\RecordStatus::TIME_COUNTING_RESOLVE => \App\Language::translate('LBL_TIME_COUNTING_RESOLVE', $qualifiedModuleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultvalue' => 'all',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['picklistValues'][$key] = \App\Language::translate($roleModel->get('rolename'), 'Settings:Roles');
- Exclude checks
Spaces must 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 (\App\RecordStatus::getLabels() as $key => $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::TEXT,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'all' => \App\Language::translate('LBL_ALL_ROLES', $qualifiedModuleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\RecordStatus::TIME_COUNTING_RESOLVE => \App\Language::translate('LBL_TIME_COUNTING_RESOLVE', $qualifiedModuleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'maximumlength' => '250',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultvalue' => \App\RecordStatus::RECORD_STATE_NO_CONCERN,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'picklistValues' => [],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'table' => $tableName
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
\App\RecordStatus::TIME_COUNTING_IDLE => \App\Language::translate('LBL_TIME_COUNTING_IDLE', $qualifiedModuleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'typeofdata' => 'V~M',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $params ? \Vtiger_Field_Model::init($qualifiedModuleName, $params, $name)->set('sourceFieldModel', $this->fieldModel) : null;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => 'LBL_TIME_COUNTING',
- Exclude checks
Spaces must 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
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::INTEGER,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'column' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 33,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'name' => $name,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'defaultvalue' => 0,
- Exclude checks
Spaces must 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
foreach (\Settings_Roles_Record_Model::getAll() as $key => $roleModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'uitype' => 16,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tooltip' => 'LBL_TIME_COUNTING_INFO',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
0 => \App\Language::translate('LBL_NONE', '_Base'),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'purifyType' => \App\Purifier::INTEGER,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'roles':
- Exclude checks
Space before opening parenthesis of function call prohibited Open
if ($insertValueList = array_map(fn ($roleid) => [$roleid, $this->valueid, $picklistId], $this->roles)) {
- Exclude checks