The class Calendar_Module_Model has an overall complexity of 62 which is very high. The configured complexity threshold is 50. Open
class Calendar_Module_Model extends Vtiger_Module_Model
{
/** {@inheritdoc} */
public $allowTypeChange = false;
- Exclude checks
File Module.php
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/* +***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
Function getCalendarState
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function getCalendarState($data = [])
{
if ($data) {
$activityStatus = $data['activitystatus'];
if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
- 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 getComponentActivityStateLabel
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function getComponentActivityStateLabel($key = '')
{
$pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
if (!\is_array($pickListValues)) {
return [];
- 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 getComponentActivityStateLabel
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getComponentActivityStateLabel($key = '')
{
$pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
if (!\is_array($pickListValues)) {
return [];
Method getCalendarState
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getCalendarState($data = [])
{
if ($data) {
$activityStatus = $data['activitystatus'];
if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
Method getSideBarLinks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSideBarLinks($linkParams)
{
$links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARLINK',
Method importICS
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importICS(string $filePath)
{
$userId = \App\User::getCurrentUserRealId();
$lastImport = new ICalLastImport();
$lastImport->clearRecords($userId);
Function getFieldsByType
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getFieldsByType($type, bool $active = false): array
{
$restrictedField = ['picklist' => ['activitystatus', 'visibility', 'duration_minutes']];
if (!\is_array($type)) {
$type = [$type];
- 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 setEventFieldsForExport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setEventFieldsForExport()
{
$keysToReplace = ['taskpriority'];
$keysValuesToReplace = ['taskpriority' => 'priority'];
foreach ($this->getFields() as $fieldName => $fieldModel) {
- 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 setTodoFieldsForExport
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function setTodoFieldsForExport()
{
$keysToReplace = ['taskpriority', 'activitystatus'];
$keysValuesToReplace = ['taskpriority' => 'priority', 'activitystatus' => 'status'];
foreach ($this->getFields() as $fieldName => $fieldModel) {
- 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 importICS
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function importICS(string $filePath)
{
$userId = \App\User::getCurrentUserRealId();
$lastImport = new ICalLastImport();
$lastImport->clearRecords($userId);
- 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 getCalendarState() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. Open
public static function getCalendarState($data = [])
{
if ($data) {
$activityStatus = $data['activitystatus'];
if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
- 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 getComponentActivityStateLabel() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public static function getComponentActivityStateLabel($key = '')
{
$pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
if (!\is_array($pickListValues)) {
return [];
- 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
Avoid using undefined variables such as '$todoFields' which will lead to PHP notices. Open
$todoFields[$fieldName] = 'yes';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$eventFields' which will lead to PHP notices. Open
$eventFields[$fieldName] = 'yes';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$todoFields' which will lead to PHP notices. Open
$this->set('todoFields', $todoFields);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$eventFields' which will lead to PHP notices. Open
$this->set('eventFields', $eventFields);
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$todoFields' which will lead to PHP notices. Open
$todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$eventFields' which will lead to PHP notices. Open
$eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class Calendar_Module_Model has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Calendar_Module_Model extends Vtiger_Module_Model
{
/** {@inheritdoc} */
public $allowTypeChange = false;
- 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 '375', column '23'). Open
$lastImport = new ICalLastImport();
- 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 '106', column '15'). Open
return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
The method getFieldsByType has a boolean flag argument $active, which is a certain sign of a Single Responsibility Principle violation. Open
public function getFieldsByType($type, bool $active = false): array
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '183', column '18'). Open
$query = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '358', column '21'). Open
$lastImport = new ICalLastImport();
- 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 '274', column '17'). Open
$date = new DateTimeField($date);
- 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 using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARLINK',
'linklabel' => 'LBL_CALENDAR_VIEW',
'linkurl' => $this->getCalendarViewUrl(),
'linkicon' => 'fas fa-calendar-alt',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'getSideBarLinks'. Open
if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {
- 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\User' in method 'getExportQuery'. Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method importICS uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$module = $todoModule;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method setEventFieldsForExport uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Record_Model' in method 'getCalendarReminder'. Open
$recordModels[] = Vtiger_Record_Model::getInstanceById($recordId, 'Calendar');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getFieldsByType uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$fieldList[$fieldName] = $field;
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'DateTimeField' in method 'getCalendarState'. Open
$dBFomatedDate = DateTimeField::convertToDBFormat($userFormatedString);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method importICS uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
++$skipCount[$module];
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARLINK',
'linklabel' => 'LBL_RECORDS_LIST',
'linkurl' => $this->getListViewUrl(),
'linkicon' => 'fas fa-list',
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method getCalendarState uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$state = $activityStatusLabels['not_started'];
if ($dates['end'] > $dates['current'] && $dates['start'] < $dates['current']) {
$state = $activityStatusLabels['in_realization'];
} elseif ($dates['end'] > $dates['current']) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Config' in method 'getCalendarReminder'. Open
->limit(\App\Config::module('Calendar', 'maxNumberCalendarNotifications', 20));
- 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\Utils\Kanban' in method 'getSideBarLinks'. Open
if ($this->isPermitted('Kanban') && \App\Utils\Kanban::getBoards($this->getName(), true)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARLINK',
'linklabel' => 'LBL_VIEW_KANBAN',
'linkurl' => 'index.php?module=' . $this->getName() . '&view=Kanban',
'linkicon' => 'yfi yfi-kanban',
- 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 'Users_Record_Model' in method 'getSettingLinks'. Open
$currentUserModel = Users_Record_Model::getCurrentUserModel();
- 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\Integrations\Dav\Calendar' in method 'importICS'. Open
$calendar = \App\Integrations\Dav\Calendar::loadFromContent(file_get_contents($filePath));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
The method setTodoFieldsForExport uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Fields\Picklist' in method 'getCalendarTypes'. Open
return App\Fields\Picklist::getValuesName('activitytype');
- 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 'Users_Record_Model' in method 'getCalendarReminder'. Open
$currentUserModel = Users_Record_Model::getCurrentUserModel();
- 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\User' in method 'importICS'. Open
$userId = \App\User::getCurrentUserRealId();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Link_Model' in method 'getSideBarLinks'. Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
'linktype' => 'SIDEBARLINK',
'linklabel' => 'LBL_CALENDAR_LIST',
'linkurl' => 'javascript:Calendar_Calendar_Js.goToRecordsList("' . $this->getListViewUrl() . '");',
'linkicon' => 'far fa-calendar-minus',
- 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 'getComponentActivityStateLabel'. Open
$pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
- 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
Define a constant instead of duplicating this literal "Calendar" 6 times. Open
return 'Calendar';
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "not_started" 3 times. Open
$state = $activityStatusLabels['not_started'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkurl" 6 times. Open
'linkurl' => $this->getCalendarViewUrl(),
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_activity_reminder_popup.datetime" 4 times. Open
->select(['recordid', 'vtiger_activity_reminder_popup.datetime'])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "current" 7 times. Open
->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linkicon" 6 times. Open
'linkicon' => 'fas fa-calendar-alt',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linktype" 6 times. Open
'linktype' => 'SIDEBARLINK',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "linklabel" 6 times. Open
'linklabel' => 'LBL_CALENDAR_VIEW',
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "activitystatus" 8 times. Open
$keysToReplace = ['taskpriority', 'activitystatus'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_crmentity.smownerid" 3 times. Open
return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "index.php?module=" 3 times. Open
return 'index.php?module=' . $this->get('name') . '&view=' . $this->getDefaultViewName();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "taskpriority" 4 times. Open
$keysToReplace = ['taskpriority'];
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "SIDEBARLINK" 9 times. Open
$links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused parameters such as '$where'. Open
public function getExportQuery($focus = '', $where = '')
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$focus'. Open
public function getExportQuery($focus = '', $where = '')
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);
- Exclude checks
Argument 1 (value)
is null|string
but \DateTimeField::__construct()
takes \type
defined at /code/include/fields/DateTimeField.php:31
Open
$date = new DateTimeField($date);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
- Exclude checks
Reference to instance property name
from undeclared class \Sabre\VObject\Component
Open
if ('VEVENT' === (string) $calendar->getComponent()->name) {
- Exclude checks
Variable $todoFields
was undeclared, but array fields are being added to it. Open
$todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Exclude checks
Variable $eventFields
was undeclared, but array fields are being added to it. Open
$eventFields[$fieldName] = 'yes';
- Exclude checks
Variable $todoFields
was undeclared, but array fields are being added to it. Open
$todoFields[$fieldName] = 'yes';
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())
- Exclude checks
Saw unextractable annotation for comment '* @return <array>'</array>
Open
* @return <Array>
- Exclude checks
Variable $eventFields
was undeclared, but array fields are being added to it. Open
$eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Exclude checks
Call to method getCurrentUserRealId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userId = \App\User::getCurrentUserRealId();
- Exclude checks
Either remove or fill this block of code. Open
if ('picklist' == $fieldType && \in_array($fieldName, $restrictedField[$fieldType])) {
} else {
- Read upRead up
- Exclude checks
Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed.
Noncompliant Code Example
for ($i = 0; $i < 42; $i++){} // Empty on purpose or missing piece of code ?
Exceptions
When a block contains a comment, this block is not considered to be empty.
Avoid excessively long variable names like $componentsActivityState. Keep variable name length under 20. Open
$componentsActivityState = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Calendar_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class Calendar_Module_Model is not named in CamelCase. Open
class Calendar_Module_Model extends Vtiger_Module_Model
{
/** {@inheritdoc} */
public $allowTypeChange = false;
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $id. Configured minimum length is 3. Open
public function getDetailViewUrl($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
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must 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
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $focus
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$todoFields[$fieldName] = 'yes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get the url to view Details for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultViewName()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getSideBarLinks($linkParams)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_VIEW_KANBAN',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setEventFieldsForExport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'Calendar';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to check whether the module is summary view supported.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'index.php?module=' . $this->getName() . '&view=ImportResult';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('eventFields', $eventFields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($fieldName, $keysToReplace)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARLINK',
- Exclude checks
Spaces must 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 query;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => $this->getListViewUrl(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'yfi yfi-kanban',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getImportResultUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $where
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smownerid' => App\User::getCurrentUserId()]);
- Exclude checks
Spaces must 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string - url
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns the default view for the Calendar module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns the url for Calendar view.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_CALENDAR_VIEW',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => $this->getCalendarViewUrl(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARLINK',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'index.php?module=' . $this->getName() . '&view=Kanban',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $links;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must 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
'linkicon' => 'far fa-calendar-minus',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_activity')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventFields[$fieldName] = 'yes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keysValuesToReplace = ['taskpriority' => 'priority', 'activitystatus' => 'status'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->getPermissions()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keysToReplace = ['taskpriority'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDetailViewUrl($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
'linkicon' => 'fas fa-list',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {
- Exclude checks
Spaces must 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 getExportQuery($focus = '', $where = '')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$keysValuesToReplace = ['taskpriority' => 'priority'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getFields() as $fieldName => $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
* Function to set todo fields for export.
- Exclude checks
Spaces must 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 'index.php?module=' . $this->get('name') . '&view=' . $this->getDefaultViewName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links = Vtiger_Link_Model::getAllByType($this->getId(), ['SIDEBARLINK', 'SIDEBARWIDGET'], $linkParams);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_RECORDS_LIST',
- Exclude checks
Spaces must 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
'linkurl' => 'javascript:Calendar_Calendar_Js.goToRecordsList("' . $this->getListViewUrl() . '");',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_activity.activityid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->set('todoFields', $todoFields);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isSummaryViewSupported()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns the url that shows Calendar Import result.
- Exclude checks
Spaces must 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
$keysToReplace = ['taskpriority', 'activitystatus'];
- Exclude checks
Spaces must 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 'index.php?module=Calendar&view=' . $this->getDetailViewName() . '&record=' . $id;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public $allowTypeChange = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string url
- Exclude checks
Spaces must 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 (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->getFields() as $fieldName => $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
'linkicon' => 'fas fa-calendar-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function setTodoFieldsForExport()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCalendarViewUrl()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_CALENDAR_LIST',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->isPermitted('Kanban') && \App\Utils\Kanban::getBoards($this->getName(), true)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get export query.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fieldModel->getPermissions()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($fieldName, $keysToReplace)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$todoFields[$keysValuesToReplace[$fieldName]] = 'yes';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get Alphabet Search Field.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Calendar_Record_Model[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($activityReminder)) {
- Exclude checks
Spaces must 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 $recordModels;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldList = [];
- Exclude checks
Spaces must 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 $fieldList;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$startDateTime = $data['date_start'] . ' ' . $data['time_start'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activityStatusLabels = self::getComponentActivityStateLabel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$state = $activityStatusLabels['in_realization'];
- Exclude checks
Spaces must 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_array($pickListValues)) {
- 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 false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARLINK',
- Exclude checks
Line exceeds 120 characters; contains 137 characters Open
if (isset($linkParams['ACTION']) && 'Calendar' === $linkParams['ACTION'] && App\Config::module('Calendar', 'SHOW_LIST_BUTTON')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'SIDEBARLINK',
- Exclude checks
Line exceeds 120 characters; contains 192 characters Open
return (new App\Db\Query())->select(['vtiger_activity.*', 'vtiger_crmentity.description', 'assigned_user_id' => 'vtiger_crmentity.smownerid', 'vtiger_activity_reminder.reminder_time'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_activity_reminder', 'vtiger_activity_reminder.activity_id = vtiger_activity.activityid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to set event fields for export.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'adminIcon-modules-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
}
- 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
foreach ($pickListValues as $value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->limit(\App\Config::module('Calendar', 'maxNumberCalendarNotifications', 20));
- Exclude checks
Spaces must 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
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $settingLinks;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get orderby sql from orderby 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 (!empty($data['activitystatus']) && isset($activityStatusLabels[$data['activitystatus']])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The function gets the labels for a given status field.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $componentsActivityState;
- Exclude checks
Spaces must 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 ($calendar->getRecordInstance() as $recordModel) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activityReminder = $currentUserModel->getCurrentUserActivityReminderInSeconds();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = [$type];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$settingLinks = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($activityStatus, self::getComponentActivityStateLabel('history'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dates = ['start' => $startDateTime, 'end' => $dueDateTime, 'current' => null];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($dates as $key => $date) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$state = $activityStatusLabels['not_started'];
- 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
* @param string $filePath
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastImport->clearRecords($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$calendar = \App\Integrations\Dav\Calendar::loadFromContent(file_get_contents($filePath));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$skipCount[$module];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAlphabetSearchField()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_activity_reminder_popup')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_activity', 'vtiger_activity_reminder_popup.recordid = vtiger_activity.activityid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getSettingLinks(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserModel = Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$settingLinks[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_EDIT_FIELDS',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getOrderBySql($orderBy)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userFormatedString = $date->getDisplayDate();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$componentsActivityState['not_started'] = $value;
- 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
$componentsActivityState = ['PLL_COMPLETED', 'PLL_POSTPONED', 'PLL_CANCELLED'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @throws \Exception
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('VEVENT' === (string) $calendar->getComponent()->name) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$totalCount[$module];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'subject';
- Exclude checks
Spaces must 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 ('status' == $orderBy) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($data) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$date = new DateTimeField($date);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dates[$key] = strtotime($dBFomatedDate . ' ' . $timeFormatedString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$componentsActivityState['postponed'] = $value;
- 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
} elseif ('history' == $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
$todoModule = 'Calendar';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWSETTING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'adminIcon-fields-picklists',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getComponentActivityStateLabel($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
$componentsActivityState['in_realization'] = $value;
- 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
$componentsActivityState = ['PLL_PLANNED', 'PLL_IN_REALIZATION', 'PLL_OVERDUE'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Import calendar rekords from ICS.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = \App\User::getCurrentUserRealId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->set('assigned_user_id', $userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = $todoModule;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = date('Y-m-d H:i:s', strtotime("+$activityReminder seconds"));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['or', ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_ACTIVE], ['<=', 'vtiger_activity_reminder_popup.datetime', $time]], ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_WAIT], ['<=', 'vtiger_activity_reminder_popup.datetime', date('Y-m-d H:i:s')]]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->orderBy(['vtiger_activity_reminder_popup.datetime' => SORT_DESC])
- 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
if (\in_array($fieldType, $type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldName = $field->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linktype' => 'LISTVIEWSETTING',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'index.php?parent=Settings&module=LayoutEditor&sourceModule=' . $this->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
$pickListValues = App\Fields\Picklist::getValuesName('activitystatus');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$eventModule = 'Events';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastImport->setFields(['userid' => $userId, 'entitytype' => $this->getName(), 'crmid' => $recordModel->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => 'LBL_EDIT_PICKLIST_VALUES',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $orderBy
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCalendarState($data = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dBFomatedDate = DateTimeField::convertToDBFormat($userFormatedString);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$state = $activityStatusLabels[$data['activitystatus']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_PLANNED':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$componentsActivityState['overdue'] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_CANCELLED':
- 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
return ['events' => $totalCount[$eventModule] - $skipCount[$eventModule], 'skipped_events' => $skipCount[$eventModule], 'task' => $totalCount[$todoModule] - $skipCount[$todoModule], 'skipped_task' => $skipCount[$todoModule]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns Calendar Reminder record models.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModels = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($currentUserModel->isAdminUser()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$settingLinks[] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkurl' => 'index.php?parent=Settings&module=Picklist&view=Index&source_module=' . $this->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
return $orderBy;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dates['end'] > $dates['current'] && $dates['start'] < $dates['current']) {
- Exclude checks
Spaces must 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
Line exceeds 120 characters; contains 130 characters Open
$lastImport->setFields(['userid' => $userId, 'entitytype' => $this->getName(), 'crmid' => $recordModel->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastImport->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_activity_reminder_popup.recordid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return App\Fields\Picklist::getValuesName('activitytype');
- 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 'PLL_IN_REALIZATION':
- 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
} elseif ($key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'standard';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['recordid', 'vtiger_activity_reminder_popup.datetime'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getFieldsByType($type, bool $active = false): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields = $this->getFields();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return parent::getOrderBySql($orderBy);
- Exclude checks
Spaces must 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 ($dates['end'] > $dates['current']) {
- Exclude checks
Spaces must 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
$componentsActivityState = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function importICS(string $filePath)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Line exceeds 120 characters; contains 195 characters Open
->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])
- Exclude checks
Spaces must 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 string $key
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($value) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$componentsActivityState['completed'] = $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$componentsActivityState['cancelled'] = $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
$lastImport = new ICalLastImport();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getCalendarReminder()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUserModel = Users_Record_Model::getCurrentUserModel();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.smownerid' => $currentUserModel->getId(), 'vtiger_crmentity.deleted' => 0, 'vtiger_activity.status' => self::getComponentActivityStateLabel('current')])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($recordId = $dataReader->readColumn(0)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModels[] = Vtiger_Record_Model::getInstanceById($recordId, 'Calendar');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldList[$fieldName] = $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
public static function getCalendarTypes()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activityStatus = $data['activitystatus'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$timeFormatedString = $date->getDisplayTime();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $state;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $componentsActivityState[$key];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$calendar->recordSaveAttendee($recordModel);
- Exclude checks
Line exceeds 120 characters; contains 233 characters Open
return ['events' => $totalCount[$eventModule] - $skipCount[$eventModule], 'skipped_events' => $skipCount[$eventModule], 'task' => $totalCount[$todoModule] - $skipCount[$todoModule], 'skipped_task' => $skipCount[$todoModule]];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->distinct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$restrictedField = ['picklist' => ['activitystatus', 'visibility', 'duration_minutes']];
- 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
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dueDateTime = $data['due_date'] . ' ' . $data['time_end'];
- Exclude checks
Spaces must 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
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 360 characters Open
->andWhere(['or', ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_ACTIVE], ['<=', 'vtiger_activity_reminder_popup.datetime', $time]], ['and', ['vtiger_activity_reminder_popup.status' => Calendar_Record_Model::REMNDER_POPUP_WAIT], ['<=', 'vtiger_activity_reminder_popup.datetime', date('Y-m-d H:i:s')]]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($fields as $field) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fieldType = $field->getFieldDataType();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('picklist' == $fieldType && \in_array($fieldName, $restrictedField[$fieldType])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$state = $activityStatusLabels['not_started'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($dates['end'] < $dates['current']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$state = $activityStatusLabels['overdue'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_COMPLETED':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'PLL_POSTPONED':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$totalCount = $skipCount = [$eventModule => 0, $todoModule => 0];
- 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
case 'PLL_OVERDUE':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getLayoutTypeForQuickCreate(): string
- 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
if ('current' == $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$lastImport = new ICalLastImport();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = $eventModule;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->getId()) {
- Exclude checks
Class name "Calendar_Module_Model" is not in camel caps format Open
class Calendar_Module_Model extends Vtiger_Module_Model
- Exclude checks