Function getCalendarActivities
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
{
$activities = [];
$query = new \App\Db\Query();
if (!$user) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
The class Home_Module_Model has an overall complexity of 53 which is very high. The configured complexity threshold is 50. Open
class Home_Module_Model extends Vtiger_Module_Model
{
/**
* Function returns the default view for the Home module.
*
- Exclude checks
Method getCalendarActivities
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
{
$activities = [];
$query = new \App\Db\Query();
if (!$user) {
Method getAssignedProjectsTasks
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!$user) {
$user = $currentUser->getId();
Function getAssignedProjectsTasks
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!$user) {
$user = $currentUser->getId();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getHistory
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function getHistory($pagingModel, $type = false)
{
if (empty($type)) {
$type = 'all';
}
- 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 getHistory
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHistory($pagingModel, $type = false)
{
if (empty($type)) {
$type = 'all';
}
Method getCalendarActivities
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
The method getAssignedProjectsTasks() has an NPath complexity of 300. The configured NPath complexity threshold is 200. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!$user) {
$user = $currentUser->getId();
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getCalendarActivities() has an NPath complexity of 3520. The configured NPath complexity threshold is 200. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
{
$activities = [];
$query = new \App\Db\Query();
if (!$user) {
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getHistory() has an NPath complexity of 240. The configured NPath complexity threshold is 200. Open
public function getHistory($pagingModel, $type = false)
{
if (empty($type)) {
$type = 'all';
}
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method getAssignedProjectsTasks() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
if (!$user) {
$user = $currentUser->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 getHistory() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. Open
public function getHistory($pagingModel, $type = false)
{
if (empty($type)) {
$type = 'all';
}
- 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 getCalendarActivities() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
{
$activities = [];
$query = new \App\Db\Query();
if (!$user) {
- 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
Refactor this function to reduce its Cognitive Complexity from 35 to the 15 allowed. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 16 to the 15 allowed. Open
public function getHistory($pagingModel, $type = false)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Missing class import via use statement (line '86', column '16'). 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 '33', column '16'). 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
The method getCalendarActivities has a boolean flag argument $recordId, which is a certain sign of a Single Responsibility Principle violation. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- 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 '251', column '17'). 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 '114', column '21'). Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
- 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 getHistory has a boolean flag argument $type, which is a certain sign of a Single Responsibility Principle violation. Open
public function getHistory($pagingModel, $type = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '179', column '17'). 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
The method getAssignedProjectsTasks has a boolean flag argument $recordId, which is a certain sign of a Single Responsibility Principle violation. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
- Read upRead up
- Exclude checks
BooleanArgumentFlag
Since: 1.4.0
A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.
Example
class Foo {
public function bar($flag = true) {
}
}
Source https://phpmd.org/rules/cleancode.html#booleanargumentflag
Missing class import via use statement (line '267', column '34'). Open
$modTrackerRecorModel = new ModTracker_Record_Model();
- 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_Record_Model' in method 'getCalendarActivities'. Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('sc_realted_to'));
- 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\Record' in method 'getCalendarActivities'. Open
if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {
- 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\Functions' in method 'getAssignedProjectsTasks'. Open
$model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
- 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\Record' in method 'getCalendarActivities'. Open
if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
- 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\Privilege' in method 'getComments'. Open
if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {
- 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_Record_Model' in method 'getComments'. Open
$commentModel = Vtiger_Record_Model::getCleanInstance('ModComments');
- 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 'getAssignedProjectsTasks'. Open
$currentUser = 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
The method getCalendarActivities uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pagingModel->set('nextPageExists', false);
}
- 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\Record' in method 'getAssignedProjectsTasks'. Open
if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
- 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 getAssignedProjectsTasks uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$pagingModel->set('nextPageExists', false);
}
- 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\PrivilegeQuery' in method 'getComments'. Open
\App\PrivilegeQuery::getConditions($query, 'ModComments');
- 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_Record_Model' in method 'getCalendarActivities'. Open
$record = Vtiger_Record_Model::getInstanceById($row['parent_id']);
- 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_Record_Model' in method 'getCalendarActivities'. Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Module_Model' in method 'getHistory'. Open
$modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
- 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\PrivilegeQuery' in method 'getCalendarActivities'. Open
\App\PrivilegeQuery::getConditions($query, '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
Avoid using static access to class 'App\Fields\DateTime' in method 'getAssignedProjectsTasks'. Open
$nowInDBFormat = App\Fields\DateTime::formatToDb($nowInUserFormat);
- 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\PrivilegeQuery' in method 'getAssignedProjectsTasks'. Open
\App\PrivilegeQuery::getConditions($query, 'ProjectTask');
- 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\Record' in method 'getAssignedProjectsTasks'. Open
$model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
- 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\Record' in method 'getAssignedProjectsTasks'. Open
if ($row['projectid'] && \App\Record::isExists($row['projectid'])) {
- 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_Record_Model' in method 'getCalendarActivities'. Open
$model = Vtiger_Record_Model::getCleanInstance('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
Avoid using static access to class '\App\Record' in method 'getCalendarActivities'. Open
if (\App\Record::isExists($record->get('parent_id'))) {
- 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 'getCalendarActivities'. Open
$user = \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
Avoid using static access to class 'Vtiger_Record_Model' in method 'getAssignedProjectsTasks'. Open
$record = Vtiger_Record_Model::getInstanceById($row['projectid'], 'Project');
- 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 'getCalendarActivities'. Open
if (\App\User::isExists($userId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Record_Model' in method 'getAssignedProjectsTasks'. Open
$model = Vtiger_Record_Model::getCleanInstance('ProjectTask');
- 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\Privilege' in method 'getHistory'. Open
if (\App\Privilege::isPermitted($moduleName, 'DetailView', $recordId)) {
- 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 'getCalendarActivities'. Open
$userModel = \App\User::getUserModel($userId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Record' in method 'getCalendarActivities'. Open
if (\App\Record::isExists($record->get('sc_realted_to'))) {
- 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_Record_Model' in method 'getCalendarActivities'. Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('parent_id'));
- 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\DateTime' in method 'getAssignedProjectsTasks'. Open
$nowInUserFormat = App\Fields\DateTime::formatToDisplay(date('Y-m-d H:i:s'));
- 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 "nextPageExists" 4 times. Open
$pagingModel->set('nextPageExists', true);
- 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 "crmid" 5 times. Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
- 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 "parent_id" 5 times. Open
if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {
- 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" 6 times. Open
$query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
- 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 "ModComments" 4 times. Open
\App\PrivilegeQuery::getConditions($query, 'ModComments');
- 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 "projectid" 3 times. Open
if ($row['projectid'] && \App\Record::isExists($row['projectid'])) {
- 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 "contractor" 4 times. Open
$model->set('contractor', $record);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "taskpriority" 3 times. Open
$query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
- 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.status" 4 times. Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- 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 "DetailView" 3 times. Open
if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {
- 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" 4 times. Open
->innerJoin('vtiger_crmentity', 'vtiger_modcomments.modcommentsid = vtiger_crmentity.crmid')
- 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 "linktoaccountscontacts" 6 times. Open
if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
- 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.crmid" 3 times. Open
$query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
- 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.deleted" 4 times. Open
->where(['vtiger_crmentity.deleted' => 0, 'crmentity2.deleted' => 0]);
- 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 "targetenddate" 3 times. Open
$query->andWhere(['>=', 'targetenddate', $currentDate]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused local variables such as '$model'. Open
foreach ($history as $time => $model) {
- Read upRead up
- Exclude checks
UnusedLocalVariable
Since: 0.2
Detects when a local variable is declared and/or assigned, but not used.
Example
class Foo {
public function doSomething()
{
$i = 5; // Unused
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable
Avoid unused parameters such as '$recordId'. Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
- 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 '$recordId'. Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- 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 undeclared method \App\Db\Query::orderBy
Open
$query->orderBy(['vtiger_modcomments.modcommentsid' => SORT_DESC])
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to undeclared method \App\Db\Query::orderBy
Open
$query->orderBy(['vtiger_modtracker_basic.id' => SORT_DESC])
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- Exclude checks
Default value for string
$type
can't be false
Open
public function getHistory($pagingModel, $type = false)
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query->select(['vtiger_modtracker_basic.*'])
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
- Exclude checks
Call to method count
from undeclared class \yii\db\DataReader
Open
if ($dataReader->count() > $pagingModel->getPageLimit()) {
- 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
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to method close
from undeclared class \yii\db\DataReader
Open
$dataReader->close();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['vtiger_activity.activitytype' => $paramsMore['activitytype']]);
- Exclude checks
Call to method getCurrentUserId
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$user = \App\User::getCurrentUserId();
- Exclude checks
Call to method count
from undeclared class \yii\db\DataReader
Open
$pagingModel->calculatePageRange($dataReader->count());
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);
- Exclude checks
Default value for string
$recordId
can't be false
Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['<>', 'module', 'ModComments']);
- Exclude checks
Default value for string
$recordId
can't be false
Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- Exclude checks
Returning type false
but getHistory()
is declared to return array
Open
return false;
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
- Exclude checks
Call to method getUserModel
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
$userModel = \App\User::getUserModel($userId);
- Exclude checks
Saw unextractable annotation for comment '* @param <vtiger_paging_model> $pagingModel'</vtiger_paging_model>
Open
* @param <Vtiger_Paging_Model> $pagingModel
- Exclude checks
Suspicious array access to null
Open
$userAndGroups[] = $userId;
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to method getInstance
from undeclared class \App\Fields\Owner
Open
$accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();
- Exclude checks
Call to method isExists
from undeclared class \App\User
(Did you mean class \Tests\App\User) Open
if (\App\User::isExists($userId)) {
- Exclude checks
Saw unextractable annotation for comment '* @return <array>'</array>
Open
* @return <Array>
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- Exclude checks
Call to undeclared method \App\Db\Query::andWhere
Open
$query->andWhere(['vtiger_activity.priority' => $paramsMore['taskpriority']]);
- Exclude checks
Call to undeclared method \App\Db\Query::orderBy
Open
$query->orderBy($pagingModel->get('orderby'))
- Exclude checks
Saw unextractable annotation for comment '* @param <vtiger_paging_model> $pagingModel - $pagingModel'</vtiger_paging_model>
Open
* @param <Vtiger_Paging_Model> $pagingModel - $pagingModel
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Home_Module_Model extends Vtiger_Module_Model
- Exclude checks
The class Home_Module_Model is not named in CamelCase. Open
class Home_Module_Model extends Vtiger_Module_Model
{
/**
* Function returns the default view for the Home module.
*
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = $commentModel->get('createdtime');
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
$query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'parentId' => 'crmentity2.crmid', 'parentModule' => 'crmentity2.setype', ])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Privilege::isPermitted($row['setype'], 'DetailView', $row['related_to'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Paging_Model $pagingModel - $pagingModel
- Exclude checks
Spaces must 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 \Vtiger_Paging_Model $pagingModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\PrivilegeQuery::getConditions($query, 'ModComments');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return \Vtiger_Record_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
->offset($pagingModel->getStartIndex());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $recordId - record 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
* @param mixed $paramsMore
- Exclude checks
Spaces must 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_crmentity.crmid = vtiger_activity.activityid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\PrivilegeQuery::getConditions($query, 'Calendar');
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
$query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);
- Exclude checks
Spaces must 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
->innerJoin('vtiger_crmentity', 'vtiger_modcomments.modcommentsid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comments[$time] = $commentModel;
- Exclude checks
Spaces must 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 $user - all/userid
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('upcoming' === $mode || 'overdue' === $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns latest comments across CRM.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$commentModel = Vtiger_Record_Model::getCleanInstance('ModComments');
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
public function getCalendarActivities($mode, Vtiger_Paging_Model $pagingModel, $user, $recordId = false, $paramsMore = [])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['vtiger_activity.activitytype' => $paramsMore['activitytype']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->limit($pagingModel->getPageLimit())
- Exclude checks
Spaces must 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
$query = new \App\Db\Query();
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy(['vtiger_modcomments.modcommentsid' => SORT_DESC])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \App\Db\Query $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
* @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
* Function returns the default view for the Home module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comments = [];
- Exclude checks
Spaces must 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 Calendar Events 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
->where(['vtiger_crmentity.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'DashBoard';
- Exclude checks
Spaces must 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 getComments($pagingModel)
- 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
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $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
$query->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_activity.*', 'taskpriority' => 'vtiger_activity.priority'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['and', ['vtiger_crmentity.smcreatorid' => $paramsMore['user']], ['NOT IN', 'vtiger_crmentity.smownerid', $paramsMore['user']]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns part of the query to fetch only activity.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activities = [];
- Exclude checks
Spaces must 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 ('createdByMeButNotMine' === $mode || 'createdByMeButNotMineOverdue' === $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($paramsMore['activitytype'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getDefaultViewName()
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
$query->select(['*', 'createdtime' => 'vtiger_crmentity.createdtime', 'assigned_user_id' => 'vtiger_crmentity.smownerid',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity crmentity2', 'vtiger_modcomments.related_to = crmentity2.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0, 'crmentity2.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $comments;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = \App\User::getCurrentUserId();
- 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
->from('vtiger_modcomments')
- Exclude checks
Spaces must 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
$commentModel->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getActivityQuery(App\Db\Query $query, $type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('updates' == $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['<>', 'module', 'ModComments']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $mode - upcoming/overdue mode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['or', ['vtiger_activity.status' => null], ['vtiger_activity.status' => $paramsMore['status']]]);
- Exclude checks
Line exceeds 120 characters; contains 244 characters Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('crmid');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy($pagingModel->get('orderby'))
- 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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activities[] = $model;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must 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 comments and recent activities across module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param <Vtiger_Paging_Model> $pagingModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($type)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comments = $this->getComments($pagingModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model = Vtiger_Record_Model::getCleanInstance('Calendar');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Record::isExists($record->get('parent_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
->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_projecttask.*'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['>=', 'targetenddate', $currentDate]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' != $user && '' != $user && (\array_key_exists($user, $accessibleUsers) || \array_key_exists($user, $accessibleGroups))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy('targetenddate')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->limit($pagingModel->getPageLimit() + 1)
- 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
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('comments' == $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $comments;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (isset($paramsMore['taskpriority'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' !== $user && !empty($user)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record = Vtiger_Record_Model::getInstanceById($row['parent_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->set('contractor', $recordContractor);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->set('nextPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function returns the Calendar Events for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param <Vtiger_Paging_Model> $pagingModel - $pagingModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['vtiger_crmentity.smownerid' => $user]);
- Exclude checks
Spaces must 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
}
- 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
* @param string $mode - upcoming/overdue mode
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return <Array>
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} 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
$userModel = \App\User::getUserModel($userId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));
- Exclude checks
Spaces must 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 (!$user) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleUsers = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleUsers();
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
if ('all' != $user && '' != $user && (\array_key_exists($user, $accessibleUsers) || \array_key_exists($user, $accessibleGroups))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\User::isExists($userId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 121 characters Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('linktoaccountscontacts'));
- Exclude checks
Spaces must 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
$query->andWhere(['<', 'targetenddate', $currentDate]);
- Exclude checks
Spaces must 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
$userAndGroups = $userModel->getGroups();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($dataReader->count() > $pagingModel->getPageLimit()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->set('nextPageExists', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 295 characters Open
$model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$comments = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//As getComments api is used to get comment infomation,no need of getting
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($row['parent_id']) && \App\Record::isExists($row['parent_id'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->calculatePageRange($dataReader->count());
- Exclude checks
Spaces must 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
$nowInDBFormat = App\Fields\DateTime::formatToDb($nowInUserFormat);
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.smownerid', 'vtiger_crmentity.setype', 'vtiger_projecttask.*'])
- Exclude checks
Spaces must 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 ($dataReader->count() > $pagingModel->getPageLimit()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
array_pop($projecttasks);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//updateActivityQuery api is used to update a query to fetch a only activity
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userId = (int) $user;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);
- Exclude checks
Line exceeds 120 characters; contains 128 characters Open
$query->andWhere(['or', ['vtiger_crmentity.smownerid' => $userAndGroups], ['vtiger_crmentity.crmid' => $subQuery]]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->limit($pagingModel->getPageLimit() + 1)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->set('contractor', $recordContractor);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Record::isExists($record->get('sc_realted_to'))) {
- 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
->offset($pagingModel->getStartIndex());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Accounts' === $record->getModuleName()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $activities;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('overdue' === $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\PrivilegeQuery::getConditions($query, 'ProjectTask');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$record = Vtiger_Record_Model::getInstanceById($row['projectid'], 'Project');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->offset($pagingModel->getStartIndex());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model = Vtiger_Record_Model::getCleanInstance('ProjectTask');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->setId($row['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->set('contractor', $recordContractor);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('parent_id'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
array_pop($activities);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAssignedProjectsTasks($mode, $pagingModel, $user, $recordId = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user = $currentUser->getId();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('upcoming' === $mode) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->set('nextPageExists', false);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $projecttasks;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subQuery = (new \App\Db\Query())->select(['crmid'])->from('u_#__crmentity_showners')->innerJoin('vtiger_activity', 'u_#__crmentity_showners.crmid=vtiger_activity.activityid')->where(['userid' => $userAndGroups])->distinct('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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $user - all/userid
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$nowInUserFormat = App\Fields\DateTime::formatToDisplay(date('Y-m-d H:i:s'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_projecttask')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projecttasks[] = $model;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$userAndGroups[] = $userId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->set('contractor', $record);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
- Exclude checks
Spaces must 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 ('ServiceContracts' === $record->getModuleName()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_projecttask.projecttaskid')
- 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
* @param string $recordId - record id
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
[$currentDate] = explode(' ', $nowInDBFormat);
- Exclude checks
Spaces must 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 ($row['projectid'] && \App\Record::isExists($row['projectid'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type - comments, updates or all
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHistory($pagingModel, $type = false)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$type = 'all';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//comment information again,so avoiding from modtracker
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere(['vtiger_activity.priority' => $paramsMore['taskpriority']]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Project' === $record->getModuleName()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordContractor = Vtiger_Record_Model::getInstanceById($record->get('sc_realted_to'));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentUser = Users_Record_Model::getCurrentUserModel();
- 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
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_crmentity.smcreatorid' => $currentUser->getId()]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->setData($row);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->set('account', '<a href="index.php?module=' . \App\Record::getType($record->get('linktoaccountscontacts')) . '&view=Detail&record=' . $record->get('linktoaccountscontacts') . '">' . vtlib\Functions::getCRMRecordLabel($record->get('linktoaccountscontacts')) . '</a>');
- Exclude checks
Spaces must 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 ('HelpDesk' === $record->getModuleName()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accessibleGroups = \App\Fields\Owner::getInstance(false, $currentUser)->getAccessibleGroups();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$projecttasks = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$model->setId($row['crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Record::isExists($record->get('linktoaccountscontacts'))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->calculatePageRange($dataReader->count());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$pagingModel->set('nextPageExists', true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('all' == $type || 'comments' == $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modCommentsModel = Vtiger_Module_Model::getInstance('ModComments');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($modCommentsModel->isPermitted('DetailView')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('updates' == $type || 'all' == $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$activites = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->getActivityQuery($query, $type);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $row['module'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Privilege::isPermitted($moduleName, 'DetailView', $recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = new \App\Db\Query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->offset($pagingModel->getStartIndex());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$history = array_merge($activites, $comments);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_modtracker_basic.crmid = vtiger_crmentity.crmid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy(['vtiger_modtracker_basic.id' => SORT_DESC])
- Exclude checks
Spaces must 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
->from('vtiger_modtracker_basic')
- 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
$query->select(['vtiger_modtracker_basic.*'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modTrackerRecorModel = new ModTracker_Record_Model();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
array_multisort($dateTime, SORT_DESC, SORT_STRING, $history);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modTrackerRecorModel->setData($row)->setParent($recordId, $moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $row['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
$dateTime = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dateTime[] = $time;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $history;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($history as $time => $model) {
- 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
$activites[$time] = $modTrackerRecorModel;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($history)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0]);
- 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
->limit($pagingModel->getPageLimit())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = $modTrackerRecorModel->get('changedon');
- Exclude checks
Class name "Home_Module_Model" is not in camel caps format Open
class Home_Module_Model extends Vtiger_Module_Model
- Exclude checks