Method getHeaderButtons
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getHeaderButtons(): array
{
$links = [];
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
if (\App\Privilege::isPermitted($moduleName, 'CreateView')) {
Function getCustomFields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getCustomFields(): array
{
$fields = [];
$fromRelations = (array) ($this->Data['fromRelation'] ?? []);
if ($fromRelations && ($relations = array_intersect_key($this->getRelations($this->moduleModel->getId()), array_flip($fromRelations)))) {
- 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
Avoid using undefined variables such as '$params' which will lead to PHP notices. Open
$params['picklistValues'][$key] = $relation['translate'];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$params' which will lead to PHP notices. Open
$params['uitype'] = 16;
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$params' which will lead to PHP notices. Open
$fields[] = \Vtiger_Field_Model::init($this->moduleModel->getName(), $params, 'fromRelation');
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
Avoid using undefined variables such as '$params' which will lead to PHP notices. Open
$params['picklistValues'] = [];
- Read upRead up
- Exclude checks
UndefinedVariable
Since: 2.8.0
Detects when a variable is used that has not been defined before.
Example
class Foo
{
private function bar()
{
// $message is undefined
echo $message;
}
}
Source https://phpmd.org/rules/cleancode.html#undefinedvariable
The class Vtiger_Documents_Widget has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. Open
class Vtiger_Documents_Widget extends Vtiger_RelatedModule_Widget
{
/** {@inheritdoc} */
public function isPermitted(): bool
{
- Read upRead up
- Exclude checks
CouplingBetweenObjects
Since: 1.1.0
A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability
Example
class Foo {
/**
* @var \foo\bar\X
*/
private $x = null;
/**
* @var \foo\bar\Y
*/
private $y = null;
/**
* @var \foo\bar\Z
*/
private $z = null;
public function setFoo(\Foo $foo) {}
public function setBar(\Bar $bar) {}
public function setBaz(\Baz $baz) {}
/**
* @return \SplObjectStorage
* @throws \OutOfRangeException
* @throws \InvalidArgumentException
* @throws \ErrorException
*/
public function process(\Iterator $it) {}
// ...
}
Source https://phpmd.org/rules/design.html#couplingbetweenobjects
Missing class import via use statement (line '93', column '59'). Open
->andWhere(['and', ['vtiger_relatedlists.tabid' => new \yii\db\Expression('brl.tabid')], ['brl.related_tabid' => $moduleId], ['brl.name' => 'getDependentsList']])
- 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 '88', column '22'). Open
$dataReader = (new \App\Db\Query())->select(['vtiger_relatedlists.*', 'moduleName' => 'vtiger_tab.name', 'relatedField' => 'brl.field_name'])
- 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\Relation' in method 'isPermitted'. Open
return parent::isPermitted() && \App\Relation::getByModule($this->moduleModel->getName(), false, 'Documents');
- 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 'getHeaderButtons'. Open
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
- 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 'getHeaderButtons'. Open
if (\App\Privilege::isPermitted($moduleName, 'CreateView')) {
- 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 'getRelations'. Open
$this->moduleModel = Vtiger_Module_Model::getInstance($moduleId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\Vtiger_Field_Model' in method 'getCustomFields'. Open
$fields[] = \Vtiger_Field_Model::init($this->moduleModel->getName(), $params, 'fromRelation');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Link_Model' in method 'getHeaderButtons'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
'linkhint' => App\Language::translate('LBL_SEND_MAIL', $moduleName),
'linkdata' => [
'url' => OSSMail_Module_Model::getComposeUrl($this->Module, $this->Record, 'Detail', 'new') . '&template=' . $this->Data['email_template'],
'module' => $this->Module,
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Language' in method 'getHeaderButtons'. Open
'linklabel' => App\Language::translate('LBL_MASS_ADD', $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\Mail' in method 'getHeaderButtons'. Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Language' in method 'getHeaderButtons'. Open
'linkhint' => App\Language::translate('LBL_SEND_MAIL', $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\Module' in method 'getRelations'. Open
$this->Data['relatedmodule'] = \App\Module::getModuleId('Documents');
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Link_Model' in method 'getHeaderButtons'. Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
'linklabel' => App\Language::translate('LBL_MASS_ADD', $moduleName),
'linkdata' => [
'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceModule=' . $this->Module . '&sourceRecord=' . $this->Record,
'cb' => 'Documents_MassAddDocuments_Js.register',
- 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\Json' in method 'getRelations'. Open
$relations[\App\Json::encode($key)] = $row;
- 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 'getHeaderButtons'. Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '112', column '26'). Open
public function getCustomFields(): array
{
$fields = [];
$fromRelations = (array) ($this->Data['fromRelation'] ?? []);
if ($fromRelations && ($relations = array_intersect_key($this->getRelations($this->moduleModel->getId()), array_flip($fromRelations)))) {
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class 'OSSMail_Module_Model' in method 'getHeaderButtons'. Open
'url' => OSSMail_Module_Model::getComposeUrl($this->Module, $this->Record, 'Detail', 'new') . '&template=' . $this->Data['email_template'],
- 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 'getCustomFields'. Open
if (\App\Privilege::isPermitted($relation['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
Define a constant instead of duplicating this literal "relatedField" 4 times. Open
$dataReader = (new \App\Db\Query())->select(['vtiger_relatedlists.*', 'moduleName' => 'vtiger_tab.name', 'relatedField' => 'brl.field_name'])
- 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 "relatedmodule" 6 times. Open
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
- 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 "email_template" 3 times. Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- 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.
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
if (empty($this->Data['relatedmodule'])) {
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$dataReader = (new \App\Db\Query())->select(['vtiger_relatedlists.*', 'moduleName' => 'vtiger_tab.name', 'relatedField' => 'brl.field_name'])
- Exclude checks
Call to method __construct
from undeclared class \yii\db\Expression
Open
->andWhere(['and', ['vtiger_relatedlists.tabid' => new \yii\db\Expression('brl.tabid')], ['brl.related_tabid' => $moduleId], ['brl.name' => 'getDependentsList']])
- Exclude checks
Call to method getFieldByName
on non-class type false
Open
$row['translate'] = $this->moduleModel->getFieldByName($row['relatedField'])->getFullLabelTranslation();
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
- Exclude checks
Suspicious type false
of a variable or expression used to build a string. (Expected type to be able to cast to a string) Open
'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceModule=' . $this->Module . '&sourceRecord=' . $this->Record,
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
$this->Data['relatedmodule'] = \App\Module::getModuleId('Documents');
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- Exclude checks
Assigning \Vtiger_Module_Model
to property but \Vtiger_Documents_Widget->moduleModel
is false
Open
$this->moduleModel = Vtiger_Module_Model::getInstance($moduleId);
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
->where(['and', ['vtiger_tab.presence' => 0], ['vtiger_relatedlists.related_tabid' => $this->Data['relatedmodule']]])
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
$fromRelations = (array) ($this->Data['fromRelation'] ?? []);
- Exclude checks
Call to method getName
on non-class type false
Open
$fields[] = \Vtiger_Field_Model::init($this->moduleModel->getName(), $params, 'fromRelation');
- Exclude checks
Call to method getId
on non-class type false
Open
if ($fromRelations && ($relations = array_intersect_key($this->getRelations($this->moduleModel->getId()), array_flip($fromRelations)))) {
- Exclude checks
Variable $params
was undeclared, but array fields are being added to it. Open
$params['uitype'] = 16;
- Exclude checks
Call to method getName
on non-class type false
Open
return parent::isPermitted() && \App\Relation::getByModule($this->moduleModel->getName(), false, 'Documents');
- Exclude checks
Reference to undeclared property \Vtiger_Documents_Widget->Data
Open
'url' => OSSMail_Module_Model::getComposeUrl($this->Module, $this->Record, 'Detail', 'new') . '&template=' . $this->Data['email_template'],
- Exclude checks
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class Vtiger_Documents_Widget extends Vtiger_RelatedModule_Widget
- Exclude checks
The class Vtiger_Documents_Widget is not named in CamelCase. Open
class Vtiger_Documents_Widget extends Vtiger_RelatedModule_Widget
{
/** {@inheritdoc} */
public function isPermitted(): bool
{
- 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
public function getWidget()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isPermitted(): 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
if (\App\Privilege::isPermitted($moduleName, 'CreateView')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getConfigTplName()
- Exclude checks
Spaces must 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 parent::isPermitted() && \App\Relation::getByModule($this->moduleModel->getName(), false, 'Documents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->Config['tpl'] = 'Basic.tpl';
- Exclude checks
Spaces must 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 Vtiger_Link_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
'linkclass' => 'btn-light btn-sm js-show-modal',
- Exclude checks
Spaces must 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->Config['buttonHeader'] = $this->getHeaderButtons();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linklabel' => App\Language::translate('LBL_MASS_ADD', $moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $links;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to get buttons which visible in header widget.
- Exclude checks
Line exceeds 120 characters; contains 152 characters Open
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceModule=' . $this->Module . '&sourceRecord=' . $this->Record,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'view' => 'Detail',
- Exclude checks
Spaces must 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
->andWhere(['and', ['vtiger_relatedlists.tabid' => new \yii\db\Expression('brl.tabid')], ['brl.related_tabid' => $moduleId], ['brl.name' => 'getDependentsList']])
- Exclude checks
Line exceeds 120 characters; contains 145 characters Open
if ($fromRelations && ($relations = array_intersect_key($this->getRelations($this->moduleModel->getId()), array_flip($fromRelations)))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
if (!empty($this->Data['email_template']) && \App\Mail::checkInternalMailClient() && \App\Record::isExists($this->Data['email_template'], 'EmailTemplates')
- Exclude checks
Line exceeds 120 characters; contains 149 characters Open
$dataReader = (new \App\Db\Query())->select(['vtiger_relatedlists.*', 'moduleName' => 'vtiger_tab.name', 'relatedField' => 'brl.field_name'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => 'index.php?module=Documents&view=MassAddDocuments&sourceModule=' . $this->Module . '&sourceRecord=' . $this->Record,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cb' => 'Documents_MassAddDocuments_Js.register',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'record' => $this->Record,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_relatedlists')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin(['brl' => 'vtiger_relatedlists'], 'vtiger_tab.tabid = brl.tabid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->Data['relatedmodule'] = \App\Module::getModuleId('Documents');
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
->where(['and', ['vtiger_tab.presence' => 0], ['vtiger_relatedlists.related_tabid' => $this->Data['relatedmodule']]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_tab', 'vtiger_tab.tabid = vtiger_relatedlists.tabid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$key = ['relatedField' => $row['relatedField'], 'relationId' => $row['relation_id']];
- 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
$relations[\App\Json::encode($key)] = $row;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$fields[] = \Vtiger_Field_Model::init($this->moduleModel->getName(), $params, 'fromRelation');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getHeaderButtons(): 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
$relations = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$row['translate'] = $this->moduleModel->getFieldByName($row['relatedField'])->getFullLabelTranslation();
- Exclude checks
Spaces must 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
$fields = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($fromRelations && ($relations = array_intersect_key($this->getRelations($this->moduleModel->getId()), array_flip($fromRelations)))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/** {@inheritdoc} */
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'yfi-document-templates',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkhint' => App\Language::translate('LBL_SEND_MAIL', $moduleName),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkdata' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => OSSMail_Module_Model::getComposeUrl($this->Module, $this->Record, 'Detail', 'new') . '&template=' . $this->Data['email_template'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets relations.
- Exclude checks
Spaces must 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(['and', ['vtiger_tab.presence' => 0], ['vtiger_relatedlists.related_tabid' => $this->Data['relatedmodule']]])
- Exclude checks
Line exceeds 120 characters; contains 174 characters Open
->andWhere(['and', ['vtiger_relatedlists.tabid' => new \yii\db\Expression('brl.tabid')], ['brl.related_tabid' => $moduleId], ['brl.name' => 'getDependentsList']])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Gets custom fields.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['uitype'] = 16;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return 'DocumentsConfig';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $moduleId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getRelations(int $moduleId): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $fields;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleName = is_numeric($this->Data['relatedmodule']) ? App\Module::getModuleName($this->Data['relatedmodule']) : $this->Data['relatedmodule'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $this->Module,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkclass' => 'btn-light btn-sm sendMailBtn'
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $relations;
- 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
$fromRelations = (array) ($this->Data['fromRelation'] ?? []);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($relations as $key => $relation) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return parent::getWidget();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkdata' => [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'popup' => 1
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Privilege::isPermitted($relation['moduleName'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'linkicon' => 'fas fa-envelope',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$links[] = Vtiger_Link_Model::getInstanceFromValues([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->moduleModel)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->moduleModel = Vtiger_Module_Model::getInstance($moduleId);
- Exclude checks
Spaces must 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
$dataReader = (new \App\Db\Query())->select(['vtiger_relatedlists.*', 'moduleName' => 'vtiger_tab.name', 'relatedField' => 'brl.field_name'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['picklistValues'][$key] = $relation['translate'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->Data['relatedmodule'])) {
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
'url' => OSSMail_Module_Model::getComposeUrl($this->Module, $this->Record, 'Detail', 'new') . '&template=' . $this->Data['email_template'],
- Exclude checks
Spaces must 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 getCustomFields(): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$params['picklistValues'] = [];
- Exclude checks
Class name "Vtiger_Documents_Widget" is not in camel caps format Open
class Vtiger_Documents_Widget extends Vtiger_RelatedModule_Widget
- Exclude checks