The class ModTracker has 17 fields. Consider redesigning ModTracker to keep the number of fields under 15. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
TooManyFields
Since: 0.1
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Example
class Person {
protected $one;
private $two;
private $three;
[... many more fields ...]
}
Source https://phpmd.org/rules/codesize.html#toomanyfields
Method trackRelation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function trackRelation($sourceModule, $sourceId, $targetModule, $targetId, $type)
{
$db = App\Db::getInstance();
$currentUser = Users_Record_Model::getCurrentUserModel();
$currentTime = date('Y-m-d H:i:s');
Method transferRelation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function transferRelation(string $sourceModule, int $sourceId, string $targetModule, int $targetId, int $process)
Method trackRelation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function trackRelation($sourceModule, $sourceId, $targetModule, $targetId, $type)
Missing class import via use statement (line '208', column '15'). Open
return (new \App\Db\Query())->from('vtiger_links')
- 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 '251', column '22'). Open
$isMyRecord = (new App\Db\Query())->from('vtiger_crmentity')
- 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 '190', column '16'). Open
$row = (new \App\Db\Query())->from('vtiger_modtracker_tabs')->where(['tabid' => $tabId])->one();
- 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 '174', column '20'). Open
$isExists = (new \App\Db\Query())->from('vtiger_modtracker_tabs')
- 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 '322', column '23'). Open
$dataReader = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class 'App\Db' in method 'trackRelation'. Open
$db = App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'disableTrackingForModule'. Open
App\Cache::save('isTrackingEnabledForModule', $tabid, false, App\Cache::LONG);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'isTrackingEnabledForModule'. Open
if (App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'isTrackingEnabledForModule'. Open
App\Cache::save('isTrackingEnabledForModule', $tabId, $isExists, App\Cache::LONG);
- 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 disableTrackingForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$db->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 0], ['tabid' => $tabid])->execute();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'App\Cache' in method 'enableTrackingForModule'. Open
App\Cache::save('isTrackingEnabledForModule', $tabid, true, App\Cache::LONG);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'isTrackingEnabledForModule'. Open
return App\Cache::get('isTrackingEnabledForModule', $tabId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Config' in method 'linkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 'linkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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\EventHandler' in method 'moduleHandler'. Open
\App\EventHandler::setInActive('ModTracker_ModTrackerHandler_Handler');
- 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_HistoryRelation_Widget' in method 'linkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'enableTrackingForModule'. Open
\App\Cache::delete('getTrackingModules', 'all');
- 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 'isViewPermitted'. 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 'ModTracker_Record_Model' in method 'trackRelation'. Open
ModTracker_Record_Model::unsetReviewed($sourceId, $currentUser->getRealId(), $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\Module' in method 'enableTrackingForModule'. Open
$moduleInstance = vtlib\Module::getInstance($tabid);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Db' in method 'disableTrackingForModule'. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Module' in method 'disableTrackingForModule'. Open
$moduleInstance = vtlib\Module::getInstance($tabid);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Module' in method 'isTrackingEnabledForModule'. Open
$tabId = \App\Module::getModuleId($moduleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'isModulePresent'. Open
if (!App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'isModulePresent'. Open
App\Cache::save('isTrackingEnabledForModule', $tabId, (bool) $row['visible'], App\Cache::LONG);
- 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 'trackRelation'. 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
Avoid using static access to class '\App\EventHandler' in method 'moduleHandler'. Open
\App\EventHandler::setActive('ModTracker_ModTrackerHandler_Handler');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'disableTrackingForModule'. Open
\App\Cache::delete('getTrackingModules', 'all');
- 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 'ModTracker_Record_Model' in method 'linkRelation'. Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getTrackingModules'. Open
$modules = App\Cache::get(__FUNCTION__, $cacheName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getTrackingModules'. Open
App\Cache::save('isTrackingEnabledForModule', $row['tabid'], true, App\Cache::LONG);
- 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 'unLinkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 'transferRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 enableTrackingForModule uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
\App\Db::getInstance()->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 1], ['tabid' => $tabid])->execute();
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Privilege' in method 'transferRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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_HistoryRelation_Widget' in method 'unLinkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getTrackingModules'. Open
App\Cache::save(__FUNCTION__, $cacheName, $modules);
- 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 'unLinkRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 'ModTracker_Record_Model' in method 'unLinkRelation'. Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- 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 getTrackingModules uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$dataReader = (new \App\Db\Query())
->select(['vtiger_tab.tabid', 'vtiger_tab.name'])
->from('vtiger_tab')
->innerJoin('vtiger_modtracker_tabs', 'vtiger_modtracker_tabs.tabid = vtiger_tab.tabid')
- 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_HistoryRelation_Widget' in method 'transferRelation'. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 'ModTracker_Record_Model' in method 'transferRelation'. Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Cache' in method 'getTrackingModules'. Open
if (App\Cache::has(__FUNCTION__, $cacheName)) {
- 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 "isTrackingEnabledForModule" 8 times. Open
App\Cache::save('isTrackingEnabledForModule', $tabid, false, App\Cache::LONG);
- 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" 3 times. Open
'crmid' => $sourceId,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "visible" 5 times. Open
$db->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 0])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "View History" 3 times. Open
$moduleInstance->deleteLink('DETAIL_VIEW_ADDITIONAL', 'View History');
- 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 "DETAIL_VIEW_ADDITIONAL" 3 times. Open
$moduleInstance->deleteLink('DETAIL_VIEW_ADDITIONAL', 'View History');
- 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 "TimeLineList" 3 times. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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_modtracker_tabs" 7 times. Open
$db->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 0])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Remove the unused function parameter "$moduleName". Open
public function moduleHandler($moduleName, $eventType)
- Read upRead up
- Exclude checks
Unused parameters are misleading. Whatever the value passed to such parameters is, the behavior will be the same.
Noncompliant Code Example
function doSomething($a, $b) { // "$a" is unused return compute($b); }
Compliant Solution
function doSomething($b) { return compute($b); }
Exceptions
Functions in classes that override a class or implement interfaces are ignored.
class C extends B { function doSomething($a, $b) { // no issue reported on $b compute($a); } }
See
- MISRA C++:2008, 0-1-11 - There shall be no unused parameters (named or unnamed) in nonvirtual functions.
- MISRA C:2012, 2.7 - There should be no unused parameters in functions
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
- CERT, MSC12-CPP. - Detect and remove code that has no effect
Define a constant instead of duplicating this literal "was_read" 3 times. Open
->update('vtiger_field', ['presence' => 1], ['tabid' => $tabid, 'fieldname' => 'was_read'])
- 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 "SHOW_TIMELINE_IN_LISTVIEW" 3 times. Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- 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 "ModTracker" 6 times. Open
$moduleInstance->disableTools('ModTracker');
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "tabid" 10 times. Open
$db->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 0])->execute();
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Avoid unused parameters such as '$moduleName'. Open
public function moduleHandler($moduleName, $eventType)
- 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::createCommand
Open
$db->createCommand()
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 0], ['tabid' => $tabid])->execute();
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
App\Cache::save('isTrackingEnabledForModule', $tabid, false, App\Cache::LONG);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 0])->execute();
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
App\Cache::save('isTrackingEnabledForModule', $tabid, true, App\Cache::LONG);
- Exclude checks
Argument 2 (key)
is bool|int
but \App\Cache::get()
takes string
defined at /code/app/Cache.php:61
Open
return App\Cache::get('isTrackingEnabledForModule', $tabId);
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::has()
takes string
defined at /code/app/Cache.php:74
Open
if (!App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 1])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_modtracker_basic', [
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new \App\Db\Query())
- Exclude checks
Argument 2 (key)
is bool|int
but \App\Cache::has()
takes string
defined at /code/app/Cache.php:74
Open
if (App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExists = (new \App\Db\Query())->from('vtiger_modtracker_tabs')
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
App\Cache::save('isTrackingEnabledForModule', $tabId, (bool) $row['visible'], App\Cache::LONG);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
return (new \App\Db\Query())->from('vtiger_links')
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isMyRecord = (new App\Db\Query())->from('vtiger_crmentity')
- Exclude checks
Argument 2 (key)
is bool|int
but \App\Cache::save()
takes string
defined at /code/app/Cache.php:89
Open
App\Cache::save('isTrackingEnabledForModule', $tabId, $isExists, App\Cache::LONG);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$db->createCommand()->insert('vtiger_modtracker_relations', [
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 1], ['tabid' => $tabid])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$row = (new \App\Db\Query())->from('vtiger_modtracker_tabs')->where(['tabid' => $tabId])->one();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_field', ['presence' => 2], ['tabid' => $tabid, 'fieldname' => 'was_read'])->execute();
- Exclude checks
Either remove or fill this block of code. Open
if ('module.postinstall' === $eventType) {
} elseif ('module.disabled' === $eventType) {
- 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.
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function linkRelation($sourceModule, $sourceId, $targetModule, $targetId)
{
self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, self::$LINK);
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 115.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function unLinkRelation($sourceModule, $sourceId, $targetModule, $targetId)
{
self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, self::$UNLINK);
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 115.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class ModTracker
- Exclude checks
Avoid variables with short names like $id. Configured minimum length is 3. Open
$id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
The property $SHOW_HIDDEN_DATA is not named in camelCase. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $TRANSFER_EDIT is not named in camelCase. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $TRANSFER_UNLINK is not named in camelCase. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $TRANSFER_LINK is not named in camelCase. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
The property $TRANSFER_DELETE is not named in camelCase. Open
class ModTracker
{
/**
* Constant variables which indicates the status of the changed record.
*/
- Read upRead up
- Exclude checks
CamelCasePropertyName
Since: 0.2
It is considered best practice to use the camelCase notation to name attributes.
Example
class ClassName {
protected $property_name;
}
Source
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = \App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $db. Configured minimum length is 3. Open
$db = App\Db::getInstance();
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
* Icon actions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
11 => 'fas fa-trash-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $TRANSFER_DELETE = 11;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
4 => 'fas fa-link',
- Exclude checks
Spaces must 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 $LINK = 4;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $TRANSFER_EDIT = 10;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Colors actions.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
8 => '#0032a2',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
7 => 'fas fa-th-list',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $colorsActions = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
0 => '#9c27b0',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $TRANSFER_LINK = 13;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $iconActions = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
1 => 'fas fa-trash-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
6 => '#e2e3e5',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Constant variables which indicates the status of the changed record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $CONVERTTOACCOUNT = 6;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $TRANSFER_UNLINK = 12;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
7 => '#65a9ff',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
5 => 'fas fa-unlink',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
14 => 'fas fa-eye',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$ARCHIVED => 'LBL_AT_ARCHIVED',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked when special actions are performed on the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('module.enabled' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function enableTrackingForModule($tabid)
- Exclude checks
Line exceeds 120 characters; contains 150 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_field', ['presence' => 2], ['tabid' => $tabid, 'fieldname' => 'was_read'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $isExists;
- Exclude checks
Spaces must 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 $TRASH = 1;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabid
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $UNLINK = 5;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ARCHIVED = 8;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
2 => 'fas fa-plus',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
13 => 'fas fa-link',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$UNLINK => 'LBL_AT_UNLINK',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\EventHandler::setInActive('ModTracker_ModTrackerHandler_Handler');
- Exclude checks
Spaces must 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
6 => 'fas fa-exchange-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
8 => 'fas fa-archive',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
9 => 'fas fa-eraser',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
12 => 'fas fa-unlink',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
10 => '#000',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\EventHandler::setActive('ModTracker_ModTrackerHandler_Handler');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('getTrackingModules', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isTrackingEnabledForModule($moduleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $CREATED = 2;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $DISPLAYED = 7;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $DELETED = 9;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
3 => 'fas fa-undo-alt',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
2 => '#607d8b',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
12 => '#000',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$TRANSFER_DELETE => 'LBL_AT_TRANSFER_DELETE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$SHOW_HIDDEN_DATA => 'LBL_SHOW_HIDDEN_DATA',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('module.disabled' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::isModulePresent($tabid)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->disableTools('ModTracker');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance = vtlib\Module::getInstance($tabid);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->enableTools('ModTracker');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::delete('getTrackingModules', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabId = \App\Module::getModuleId($moduleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $ACTIVE = 3;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 1], ['tabid' => $tabid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isExists = (new \App\Db\Query())->from('vtiger_modtracker_tabs')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isViewPermitted(vtlib\LinkData $linkData)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
0 => 'yfi yfi-full-editing-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
3 => '#009405',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
4 => '#009cb9',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $eventType
- Exclude checks
Spaces must 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 disableTrackingForModule($tabid)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 0], ['tabid' => $tabid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabid
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!static::isModulePresent($tabid)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('isTrackingEnabledForModule', $tabid, true, App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row = (new \App\Db\Query())->from('vtiger_modtracker_tabs')->where(['tabid' => $tabId])->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked to check if ModTracker links are enabled for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isModtrackerLinkPresent($tabid)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
10 => 'yfi yfi-full-editing-view',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
1 => '#ab0505',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
5 => '#de9100',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
9 => '#000',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
14 => '#000',
- 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
static::$UPDATED => 'LBL_AT_UPDATE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$TRASH => 'LBL_AT_TRASH',
- Exclude checks
Spaces must 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 moduleHandler($moduleName, $eventType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('isTrackingEnabledForModule', $tabid, false, App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->addLink('DETAIL_VIEW_ADDITIONAL', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', ['path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted']);
- Exclude checks
Spaces must 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
* Invoked to check if the module is present in the table or not.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function isModulePresent($tabId)
- 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
public static $UPDATED = 0;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static $SHOW_HIDDEN_DATA = 14;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$TRANSFER_EDIT => 'LBL_AT_TRANSFER_EDIT',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance = vtlib\Module::getInstance($tabid);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleInstance->deleteLink('DETAIL_VIEW_ADDITIONAL', 'View History');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('vtiger_field', ['presence' => 1], ['tabid' => $tabid, 'fieldname' => 'was_read'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 249 characters Open
$moduleInstance->addLink('DETAIL_VIEW_ADDITIONAL', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', ['path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['linktype' => 'DETAIL_VIEW_ADDITIONAL', 'linklabel' => 'View History', 'tabid' => $tabid])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = $linkData->getModule();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$CREATED => 'LBL_AT_CREATE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$CONVERTTOACCOUNT => 'LBL_AT_CONVERTTOACCOUNT',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::isModtrackerLinkPresent($tabid)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('isTrackingEnabledForModule', $tabId, (bool) $row['visible'], App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
13 => '#000',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$LINK => 'LBL_AT_LINK',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_modtracker_tabs.visible' => 1, 'vtiger_modtracker_tabs.tabid' => $tabId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'whodid' => $currentUser->getRealId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $sourceId
- Exclude checks
Line exceeds 120 characters; contains 237 characters Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
11 => '#000',
- Exclude checks
Spaces must 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 ('module.postinstall' === $eventType) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked to disable tracking 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
* Invoked to enable tracking for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* This function checks access to the view.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordId = $linkData->getInputParameter('record');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Line exceeds 120 characters; contains 237 characters Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getTrackingModules(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_modtracker_tabs.visible' => 1, 'vtiger_tab.presence' => 0, 'vtiger_tab.isentitytype' => 1])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('isTrackingEnabledForModule', $row['tabid'], true, App\Cache::LONG);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = \App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Invoked to check if tracking is enabled or disabled for the module.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $moduleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'last_reviewed_users' => '#' . $currentUser->getRealId() . '#'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function is executed when adding related record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $targetId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Exclude checks
Spaces must 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_tab')
- 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
Line exceeds 120 characters; contains 237 characters Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must 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 $sourceModule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $targetModule
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
public static function transferRelation(string $sourceModule, int $sourceId, string $targetModule, int $targetId, int $process)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Exclude checks
Spaces must 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 $modules;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$ACTIVE => 'LBL_AT_ACTIVE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$DELETED => 'LBL_AT_DELETE',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 0])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return App\Cache::get('isTrackingEnabledForModule', $tabId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$currentTime = date('Y-m-d H:i:s');
- Exclude checks
Spaces must 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 (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $targetModule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheName = 'all';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_field', ['presence' => 2], ['tabid' => $tabid, 'fieldname' => 'was_read'])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (App\Cache::has('isTrackingEnabledForModule', $tabId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $sourceModule,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ModTracker_Record_Model::unsetReviewed($sourceId, $currentUser->getRealId(), $id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_modtracker_relations', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changedon' => $currentTime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($isMyRecord) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $targetId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['vtiger_tab.tabid', 'vtiger_tab.name'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules[$row['tabid']] = $row['name'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getAllActionsTypes()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$DISPLAYED => 'LBL_AT_DISPLAY',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $tabid
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
\App\Db::getInstance()->createCommand()->insert('vtiger_modtracker_tabs', ['tabid' => $tabid, 'visible' => 1])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_modtracker_tabs', ['visible' => 1], ['tabid' => $tabid])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (static::isModtrackerLinkPresent($tabid)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param \vtlib\LinkData $linkData
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db = App\Db::getInstance();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$TRANSFER_UNLINK => 'LBL_AT_TRANSFER_UNLINK',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
static::$TRANSFER_LINK => 'LBL_AT_TRANSFER_LINK',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save('isTrackingEnabledForModule', $tabId, $isExists, App\Cache::LONG);
- Exclude checks
Spaces must 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())->from('vtiger_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
* @param int $targetId
- 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
public static function trackRelation($sourceModule, $sourceId, $targetModule, $targetId, $type)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'changedon' => $currentTime,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$id = $db->getLastInsertID('vtiger_modtracker_basic_id_seq');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['<>', 'smownerid', $currentUser->getRealId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $sourceModule
- Exclude checks
Spaces must 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 (\in_array($targetModule, Vtiger_HistoryRelation_Widget::getActions()) && \in_array($sourceModule, App\Config::module('ModTracker', 'SHOW_TIMELINE_IN_LISTVIEW')) && \App\Privilege::isPermitted($sourceModule, 'TimeLineList')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $process
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function gives an array of module names for which tracking is enabled.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Cache::save(__FUNCTION__, $cacheName, $modules);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => $sourceId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, self::$LINK);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function is executed when removing related record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Transfer relation.
- 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
'status' => $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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $sourceId
- Exclude checks
Spaces must 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 (App\Cache::has(__FUNCTION__, $cacheName)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$db->createCommand()->insert('vtiger_modtracker_basic', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(['crmid' => $sourceId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function linkRelation($sourceModule, $sourceId, $targetModule, $targetId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
ModTracker_Record_Model::setLastRelation($sourceId, $sourceModule);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $sourceId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function unLinkRelation($sourceModule, $sourceId, $targetModule, $targetId)
- Exclude checks
Spaces must 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_modtracker_tabs', 'vtiger_modtracker_tabs.tabid = vtiger_tab.tabid')
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
->where(['vtiger_modtracker_tabs.visible' => 1, 'vtiger_tab.presence' => 0, 'vtiger_tab.isentitytype' => 1])
- 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
])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, $process);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'targetmodule' => $targetModule,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isMyRecord = (new App\Db\Query())->from('vtiger_crmentity')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->update('vtiger_crmentity', ['was_read' => 0], ['crmid' => $sourceId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function transferRelation(string $sourceModule, int $sourceId, string $targetModule, int $targetId, int $process)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $id,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $targetModule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $sourceModule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
self::trackRelation($sourceModule, $sourceId, $targetModule, $targetId, self::$UNLINK);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$modules = App\Cache::get(__FUNCTION__, $cacheName);
- 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
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'targetid' => $targetId,
- Exclude checks
Spaces must 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
$modules = [];
- Exclude checks