File Record.php
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* OSSMailView record model class.
*
The class OSSMailView_Record_Model has 14 public methods. Consider refactoring OSSMailView_Record_Model to keep number of public methods under 10. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
The class OSSMailView_Record_Model has an overall complexity of 71 which is very high. The configured complexity threshold is 50. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
- Exclude checks
Function findEmail
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function findEmail(int $record, string $module): string
{
if (!\App\Record::isExists($record)) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function findRecordsById
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function findRecordsById($ids)
{
$return = false;
if (!empty($ids)) {
$recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method showEmailsList
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
if ('All' === $filter || 'Contacts' === $filter) {
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
Function showEmailsList
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
if ('All' === $filter || 'Contacts' === $filter) {
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- 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
OSSMailView_Record_Model
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
Method findEmail
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findEmail(int $record, string $module): string
{
if (!\App\Record::isExists($record)) {
return false;
}
Method findRecordsById
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function findRecordsById($ids)
{
$return = false;
if (!empty($ids)) {
$recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
Function findEmailInRelated
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function findEmailInRelated(Vtiger_Record_Model $recordModel): string
{
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');
$query = $relationListView->getRelationQuery();
$tabIndex = $relationListView->getRelatedModuleModel()->getEntityInstance()->tab_name_index;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method showEmailsList
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
The method showEmailsList() has an NPath complexity of 6552. The configured NPath complexity threshold is 200. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
if ('All' === $filter || 'Contacts' === $filter) {
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- Read upRead up
- Exclude checks
NPathComplexity
Since: 0.1
The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.
Example
class Foo {
function bar() {
// lots of complicated code
}
}
Source https://phpmd.org/rules/codesize.html#npathcomplexity
The method showEmailsList() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
if ('All' === $filter || 'Contacts' === $filter) {
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
The method findEmail() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10. Open
public function findEmail(int $record, string $module): string
{
if (!\App\Record::isExists($record)) {
return false;
}
- Read upRead up
- Exclude checks
CyclomaticComplexity
Since: 0.1
Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.
Example
// Cyclomatic Complexity = 11
class Foo {
1 public function example() {
2 if ($a == $b) {
3 if ($a1 == $b1) {
fiddle();
4 } elseif ($a2 == $b2) {
fiddle();
} else {
fiddle();
}
5 } elseif ($c == $d) {
6 while ($c == $d) {
fiddle();
}
7 } elseif ($e == $f) {
8 for ($n = 0; $n < $h; $n++) {
fiddle();
}
} else {
switch ($z) {
9 case 1:
fiddle();
break;
10 case 2:
fiddle();
break;
11 case 3:
fiddle();
break;
default:
fiddle();
break;
}
}
}
}
Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity
Refactor this function to reduce its Cognitive Complexity from 24 to the 15 allowed. Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Class "OSSMailView_Record_Model" has 21 methods, which is greater than 20 authorized. Split it into smaller classes. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
- Read upRead up
- Exclude checks
A class that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and therefore to maintain. Above a specific threshold, it is strongly advised to refactor the class into smaller ones which focus on well defined topics.
Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed. Open
public function findRecordsById($ids)
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
Refactor this function to reduce its Cognitive Complexity from 20 to the 15 allowed. Open
public function findEmail(int $record, string $module): string
- Read upRead up
- Exclude checks
Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.
See
The class OSSMailView_Record_Model has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
- 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 '443', column '15'). Open
return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
- 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 '74', column '17'). Open
$query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
- 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 '73', column '20'). Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- 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 '332', column '15'). Open
return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();
- 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 '62', column '22'). Open
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
- 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 '345', column '17'). Open
$query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
- 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 '427', column '18'). Open
$exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '158', column '23'). Open
$isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '262', column '17'). Open
$query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);
- 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 '390', column '9'). Open
(new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);
- 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\Privilege' in method 'showEmailsList'. Open
if (\App\Privilege::isPermitted('OSSMailView', 'DetailView', $row['ossmailviewid'])) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\PrivilegeQuery' in method 'showEmailsList'. Open
\App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $srecord);
- 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\Rbl' in method 'showEmailsList'. Open
$rblInstance = \App\Mail\Rbl::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\Purifier' in method 'showEmailsList'. Open
$firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';
- 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\TextUtils' in method 'showEmailsList'. Open
'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),
- 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 '104', column '10'). Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
if ('All' === $filter || 'Contacts' === $filter) {
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- 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
The method findEmail uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
if (\count($emailFields) > 0) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
foreach ($emailFields as $emailField) {
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class 'Vtiger_Record_Model' in method 'findEmail'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($record, $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 'removeRelated'. Open
return \App\Language::translate('Removed relationship', 'OSSMail');
- 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\ModuleHierarchy' in method 'showEmailsList'. Open
if (!$relatedId || false === App\ModuleHierarchy::getModuleLevel($smodule)) {
- 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 'addRelated'. 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\Purifier' in method 'showEmailsList'. Open
$subject = \App\Purifier::encodeHtml($row['subject']);
- 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 'OSSMail_Record_Model' in method 'checkMailExist'. Open
$mail = OSSMail_Record_Model::getMail($mbox, $uid, false);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\Purifier' in method 'get'. Open
return App\Purifier::decodeHtml($value);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'showEmailsList'. Open
$content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'showEmailsList'. Open
$subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'App\TextUtils' in method 'showEmailsList'. Open
$firstLetter = strtoupper(App\TextUtils::textTruncate(trim(strip_tags($from)), 1, false));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Purifier' in method 'showEmailsList'. Open
'subjectRaw' => \App\Purifier::encodeHtml($row['subject']),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Record_Model' in method 'findRecordsById'. Open
$recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
- 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_Relation_Model' in method 'getRelatedRecords'. Open
'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Utils' in method 'showEmailsList'. Open
'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),
- 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 'findRecordsById'. Open
$label = \App\Record::getLabel($id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Record' in method 'getRelatedRecords'. Open
'label' => \App\Record::getLabel($row['crmid']),
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'vtlib\Functions' in method 'showEmailsList'. Open
$content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class 'Vtiger_Record_Model' in method 'findEmail'. Open
$recordModel = Vtiger_Record_Model::getInstanceById($record, $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 'Vtiger_RelationListView_Model' in method 'findEmailInRelated'. Open
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');
- 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 'OSSMailScanner_Record_Model' in method 'findEmailInRelated'. Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');
- 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 showEmailsList uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$subject = \App\Purifier::encodeHtml($row['subject']);
}
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
The method findRecordsById uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$idsArray[0] = $ids;
}
- 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 '\vtlib\Functions' in method 'findRecordsById'. Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($id);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Record' in method 'findEmail'. Open
if (\App\Record::isExists($accountId)) {
- 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 'findEmail'. Open
$returnEmail = $this->findEmail($accountId, \App\Record::getType($accountId));
- 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 'setReloadRelationRecord'. 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 'Vtiger_Module_Model' in method 'getRelatedRecords'. Open
$moduleDocuments = Vtiger_Module_Model::getInstance('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\Language' in method 'addRelated'. Open
return \App\Language::translate('Add relationship', 'OSSMail');
- 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 'findRecordsById'. Open
if (\App\Privilege::isPermitted($module, 'DetailView', $id)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Record' in method 'findEmail'. Open
if (!\App\Record::isExists($record)) {
- 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 'getRelatedRecords'. Open
'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
- 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 addRelated uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
(new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);
}
- 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 'OSSMailScanner_Record_Model' in method 'findEmail'. Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch($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
Define a constant instead of duplicating this literal "deleted" 6 times. Open
->where(['vtiger_contactdetails.parentid' => $srecord, 'deleted' => 0])->column();
- 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 "HelpDesk" 3 times. Open
$this->modules_email_actions_widgets['HelpDesk'] = true;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "orginal_mail" 3 times. Open
if ($row['orginal_mail'] && '-' !== $row['orginal_mail']) {
- 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_ossmailview" 5 times. Open
$query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
- 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 "subject" 4 times. Open
$subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
- 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 "Contacts" 5 times. Open
$this->modules_email_actions_widgets['Contacts'] = true;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "vtiger_crmentity" 6 times. Open
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "SSalesProcesses" 3 times. Open
$this->modules_email_actions_widgets['SSalesProcesses'] = true;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "fieldname" 3 times. Open
$query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
- 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" 13 times. Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "Project" 3 times. Open
$this->modules_email_actions_widgets['Project'] = true;
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "setype" 3 times. Open
$module = $recordMetaData['setype'];
- 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 "ossmailviewid" 13 times. Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "tablename" 7 times. Open
$query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
- 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 "columnname" 3 times. Open
$email = $recordModel->get($emailField['columnname']);
- 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_ossmailview_relation" 4 times. Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Variable $idsArray
was undeclared, but array fields are being added to it. Open
$idsArray[0] = $ids;
- Exclude checks
Call to method select
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query->select(['vtiger_crmentity.crmid']);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
- Exclude checks
Expected @param annotation for rcId
to be before the @param annotation for mbox
Open
* @param object $mbox
- Exclude checks
Reference to static property ONE_MAIL_FOR_MULTIPLE_RECIPIENTS
from undeclared class \Config\Modules\OSSMailScanner
Open
if (!\Config\Modules\OSSMailScanner::$ONE_MAIL_FOR_MULTIPLE_RECIPIENTS) {
- Exclude checks
Argument 1 (haystack)
is int[]
but \strpos()
takes string
Open
if (strpos($ids, ',')) {
- Exclude checks
Reference to instance property join
from undeclared class \App\QueryGenerator
Open
if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 1))) {
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();
- Exclude checks
Call to method andWhere
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query->andWhere($where);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Argument 1 (mbox)
is object
but \OSSMail_Record_Model::getMail()
takes resource
defined at /code/modules/OSSMail/models/Record.php:297
Open
$mail = OSSMail_Record_Model::getMail($mbox, $uid, false);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Exclude checks
Call to method getEmailSearch
from undeclared class \OSSMailScanner_Record_Model
Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
- Exclude checks
Call to undeclared method \Vtiger_Record_Model::getConfig
Open
$config = $recordModelMailScanner->getConfig('email_list');
- Exclude checks
Reference to instance property from
from undeclared class \App\QueryGenerator
Open
if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 1))) {
- Exclude checks
Call to method createCommand
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
- Exclude checks
Call to method getEmailSearch
from undeclared class \OSSMailScanner_Record_Model
Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
- Exclude checks
Call to method addSelect
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
- Exclude checks
Suspicious array access to null
Open
$relatedId[] = $srecord;
- Exclude checks
Call to method read
from undeclared class \yii\db\DataReader
Open
while ($row = $dataReader->read()) {
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->insert('s_#__mail_relation_updater', [
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
$query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
- Exclude checks
Argument 2 (str)
is int[]
but \explode()
takes string
Open
$idsArray = explode(',', $ids);
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->execute();
- Exclude checks
Call to method leftJoin
from undeclared class \App\QueryGenerator
(Did you mean class \Tests\App\QueryGenerator) Open
$query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");
- Exclude checks
Returning type false
but findEmail()
is declared to return string
Open
return false;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
- Exclude checks
Call to undeclared method \App\Db::createCommand
Open
\App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->execute();
- Exclude checks
Avoid excessively long variable names like $modules_email_actions_widgets. Keep variable name length under 20. Open
protected $modules_email_actions_widgets = [];
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Avoid excessively long variable names like $recordModelMailScanner. Keep variable name length under 20. Open
$recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
- Read upRead up
- Exclude checks
LongVariable
Since: 0.2
Detects when a field, formal or local variable is declared with a long name.
Example
class Something {
protected $reallyLongIntName = -3; // VIOLATION - Field
public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
$otherReallyLongName = -5; // VIOLATION - Local
for ($interestingIntIndex = 0; // VIOLATION - For
$interestingIntIndex < 10;
$interestingIntIndex++ ) {
}
}
}
Source https://phpmd.org/rules/naming.html#longvariable
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
- Exclude checks
The parameter $mail_type is not named in camelCase. Open
public function changeTypeSelectedRecords($selectedIds, $mail_type)
{
$mailType = self::getMailType();
$this->addLog('Action_ChangeType', \count($selectedIds));
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Read upRead up
- Exclude checks
CamelCaseParameterName
Since: 0.2
It is considered best practice to use the camelCase notation to name parameters.
Example
class ClassName {
public function doSomething($user_name) {
}
}
Source
The property $modules_email_actions_widgets is not named in camelCase. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
- 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 class OSSMailView_Record_Model is not named in CamelCase. Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
{
const TYPE_COLORS = [
0 => 'bgGreen',
1 => 'bgDanger',
- Read upRead up
- Exclude checks
CamelCaseClassName
Since: 0.2
It is considered best practice to use the CamelCase notation to name classes.
Example
class class_name {
}
Source
Avoid variables with short names like $to. Configured minimum length is 3. Open
$to = $this->findRecordsById($row['to_id']);
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
protected $modules_email_actions_widgets = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function __construct()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modules_email_actions_widgets['Accounts'] = true;
- 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
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'from' => $from,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'teaser' => App\TextUtils::textTruncate(\App\Utils::htmlToText($content), 190),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$value = parent::get($key);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $srecord
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('All' !== $type) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->orderBy(['date' => SORT_DESC]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$to = $this->findRecordsById($row['to_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = \App\Purifier::purifyHtml(vtlib\Functions::getHtmlOrPlainText($row['content']));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstLetterBg = 'bg-warning';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'ccRaw' => $row['cc_email'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'bodyRaw' => $row['content'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function isWidgetEnabled($module)
- 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
$relatedId[] = $srecord;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\PrivilegeQuery::getConditions($query, 'OSSMailView', false, $srecord);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'date' => $row['date'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'url' => "index.php?module=OSSMailView&view=Preview&record={$row['ossmailviewid']}&srecord=$srecord&smodule=$smodule",
- Exclude checks
Spaces must 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->modules_email_actions_widgets['Contacts'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modules_email_actions_widgets['Project'] = 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
* Function return emails list.
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('' !== $config['widget_limit']) {
- Exclude checks
Line exceeds 120 characters; contains 164 characters Open
$firstLetter = '<span class="fas fa-exclamation-triangle text-danger" title="' . \App\Purifier::encodeHtml($verifySender['info']) . '"></span>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'fromRaw' => $row['from_email'],
- Exclude checks
Spaces must 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($ids)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($idsArray as $id) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must 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->modules_email_actions_widgets['HelpDesk'] = true;
- 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
$subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblInstance->parse();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->select(['vtiger_ossmailview.*'])->from('vtiger_ossmailview')
- 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
->where(['ossmailviewid' => $subQuery]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (strpos($ids, ',')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subject' => $subject,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int[] $ids
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function findRecordsById($ids)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = $recordModelMailScanner->getConfig('email_list');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::__construct();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('uid' === $key) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $config
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $type
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $filter
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Contacts' !== $filter) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$relatedId || false === App\ModuleHierarchy::getModuleLevel($smodule)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'firstLetter' => $firstLetter,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$idsArray[0] = $ids;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Leads' === $module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modules_email_actions_widgets['SSalesProcesses'] = true;
- 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
* @param string $smodule
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relatedId = (new \App\Db\Query())->select(['vtiger_contactdetails.contactid'])->from('vtiger_contactdetails')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstLetterBg = self::TYPE_COLORS[$row['type']] ?? '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'toRaw' => $row['to_email'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'body' => $content,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $value;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$from = $this->findRecordsById($row['from_id']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblInstance = \App\Mail\Rbl::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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$widgets = $this->modules_email_actions_widgets;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere((['type' => $type]));
- Exclude checks
Line exceeds 120 characters; contains 209 characters Open
$subject = '<a href="index.php?module=OSSMailView&view=Preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . \App\Purifier::encodeHtml($row['subject']) . '</a>';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordMetaData = \vtlib\Functions::getCRMRecordMetadata($id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modules_email_actions_widgets['Leads'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function get($key)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$to = ($to && '' !== $to) ? $to : $row['to_email'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($row['orginal_mail'] && '-' !== $row['orginal_mail']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'firstLetterBg' => $firstLetterBg,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
0 => 'bgGreen',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return App\Purifier::decodeHtml($value);
- 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
->where(['vtiger_contactdetails.parentid' => $srecord, 'deleted' => 0])->column();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->limit($config['widget_limit']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $row['ossmailviewid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'attachments' => $row['attachments_exist'],
- 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
} else {
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_contactdetails.contactid = vtiger_crmentity.crmid')
- 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
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', 'vtiger_ossmailview.ossmailviewid = vtiger_crmentity.crmid')
- 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
'type' => $row['type'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->modules_email_actions_widgets['SSingleOrders'] = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
$subQuery = (new \App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview_relation')->where(['crmid' => $relatedId, 'deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$from = ($from && '' !== $from) ? $from : $row['from_email'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$subject = \App\Purifier::encodeHtml($row['subject']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$firstLetter = strtoupper(App\TextUtils::textTruncate(trim(strip_tags($from)), 1, false));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (($verifySender = $rblInstance->verifySender()) && !$verifySender['status']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'subjectRaw' => \App\Purifier::encodeHtml($row['subject']),
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
$return .= '<a href="index.php?module=' . $module . '&view=Detail&record=' . $id . '" target="' . $config['target'] . '"> ' . $label . '</a>,';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\in_array($module, ['HelpDesk', 'Project', 'SSalesProcesses'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 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
return implode(',', $emails);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new \App\Db\Query())->from('vtiger_ossmailview_files')->where(['ossmailviewid' => $recordId]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_crmentity', ['deleted' => 1], ['crmid' => $row['documentsid']])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return [2 => 'Internal', 0 => 'Sent', 1 => 'Received'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
const TYPE_COLORS = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
1 => 'bgDanger',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('All' === $filter || 'Contacts' === $filter) {
- Exclude checks
Spaces must 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('OSSMailView', 'DetailView', $row['ossmailviewid'])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$rblInstance->set('rawBody', $row['orginal_mail']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'to' => $to,
- Exclude checks
Line exceeds 120 characters; contains 134 characters Open
'url' => "index.php?module=OSSMailView&view=Preview&record={$row['ossmailviewid']}&srecord=$srecord&smodule=$smodule",
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find records.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModelMailScanner = Vtiger_Record_Model::getCleanInstance('OSSMailScanner');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$idsArray = explode(',', $ids);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$module = $recordMetaData['setype'];
- Exclude checks
Spaces must 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
$email = $recordModel->get($emailField['columnname']);
- 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
$query->select(['vtiger_crmentity.crmid']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where = ['or'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where[] = ['<>', $fieldParams['tablename'] . '.' . $fieldParams['columnname'], ''];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function getMailType()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 197 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
2 => 'bgBlue',
- Exclude checks
Spaces must 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 ($widgets[$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
if (!$recordMetaData || 1 === $recordMetaData['deleted']) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$isExists = (new \App\Db\Query())->from('vtiger_leaddetails')->where(['leadid' => $id, 'converted' => 0])->exists();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- 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
case 'SSalesProcesses':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function deleteRel($recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
while ($row = $dataReader->read()) {
- Exclude checks
Line exceeds 120 characters; contains 187 characters Open
App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch('Contacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emailFields as $fieldParams) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->update('vtiger_crmentity', ['deleted' => 1], ['crmid' => $row['attachmentsid']])->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
$returnEmail = $this->findEmail($accountId, \App\Record::getType($accountId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($email)) {
- Exclude checks
Spaces must 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($row[$fieldParams['fieldname']])) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addLog('Action_ChangeType', 'all');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function delete()
- Exclude checks
Spaces must 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
$recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
switch ($module) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emailFields = OSSMailScanner_Record_Model::getEmailSearch($module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$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
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accountId = $recordModel->get('related_to');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\in_array($fieldParams['tablename'], $query->from) && !\in_array($fieldParams['tablename'], array_column($query->join, 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
public function bindSelectedRecords($selectedIds)
- Exclude checks
Spaces must 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->addLog('Action_Bind', \count($selectedIds));
- Exclude checks
Spaces must 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_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emailFields as $fieldParams) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->andWhere($where);
- 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
parent::delete();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $module
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accountId = $recordModel->get('linktoaccountscontacts');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relationListView = Vtiger_RelationListView_Model::getInstance($recordModel, 'Contacts');
- Exclude checks
Spaces must 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_ossmailview', ['verify' => 1], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Privilege::isPermitted($module, 'DetailView', $id)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find email for record.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function findEmail(int $record, string $module): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emails = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailTypeData[$mailType], 'type' => $mailType], [])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Line exceeds 120 characters; contains 153 characters Open
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview_relation', ['deleted' => 1], ['ossmailviewid' => $this->getId()])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
continue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$return .= '<a href="index.php?module=' . $module . '&view=Detail&record=' . $id . '" target="' . $config['target'] . '"> ' . $label . '</a>,';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$returnEmail) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accountId = $recordModel->get('parent_id');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$returnEmail = $email;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function findEmailInRelated(Vtiger_Record_Model $recordModel): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailType = self::getMailType();
- Exclude checks
Spaces must 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 trim($return, ',');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$accountId = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($emailFields as $emailField) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Find email in related records.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = $relationListView->getRelationQuery();
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
$query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
- Exclude checks
Spaces must 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 addLog($action, $info)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'HelpDesk':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} else {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query->addSelect([$fieldParams['fieldname'] => $fieldParams['tablename'] . '.' . $fieldParams['columnname']]);
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$query->leftJoin($fieldParams['tablename'], "vtiger_crmentity.crmid = {$fieldParams['tablename']}.{$tabIndex[$fieldParams['tablename']]}");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$mailTypeData = self::getMailType();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function changeTypeSelectedRecords($selectedIds, $mail_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
$this->addLog('Action_ChangeType', \count($selectedIds));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$returnEmail = '';
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
case 'Project':
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
default:
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = Vtiger_Record_Model::getInstanceById($record, $module);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$tabIndex = $relationListView->getRelatedModuleModel()->getEntityInstance()->tab_name_index;
- Exclude checks
Spaces must 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
$returnEmail = $this->findEmailInRelated($recordModel);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
break;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Record::isExists($accountId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function changeTypeAllRecords($mailType)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$label = \App\Record::getLabel($id);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Function to delete the current Record Model.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must 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\Record::isExists($record)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\count($emailFields) > 0) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $returnEmail;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$emails[] = $row[$fieldParams['fieldname']];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $uid
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$mail) {
- Exclude checks
Spaces must 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 $relations;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'rel_created_user' => $currentUser->getId(),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => 0, 'vtiger_ossmailview_files.ossmailviewid' => $this->getId()])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get related records.
- Exclude checks
Spaces must 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 = $row['setype'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$relations[$module][] = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function addRelated($params)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'module' => $params['mod'],
- 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
->innerJoin('vtiger_crmentity', 'vtiger_crmentity.crmid = vtiger_notes.notesid')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ('Products' === $newModule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function removeRelated($params)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new App\Db\Query())->select(['ossmailviewid'])->from('vtiger_ossmailview')->where($where)->scalar();
- 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
$newModule = $params['newModule'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ('Services' === $newModule) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => (int) $params['crmid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new OSSMailView_Relation_Model())->addRelation((int) $params['mailId'], $newCrmId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Language::translate('Add relationship', 'OSSMail');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return \App\Language::translate('Removed relationship', 'OSSMail');
- 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 (!$exists) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getAttachments()
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param object $mbox
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'productid' => $newCrmId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check if record is editable.
- Exclude checks
Spaces must 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 $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $rcId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!\Config\Modules\OSSMailScanner::$ONE_MAIL_FOR_MULTIPLE_RECIPIENTS) {
- Exclude checks
Line exceeds 120 characters; contains 301 characters Open
$query = (new App\Db\Query())->select(['vtiger_crmentity.crmid', 'vtiger_crmentity.setype'])->from('vtiger_ossmailview_relation')->innerJoin('vtiger_crmentity', 'vtiger_ossmailview_relation.crmid = vtiger_crmentity.crmid')->where(['ossmailviewid' => $record, 'vtiger_crmentity.deleted' => 0]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader->close();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->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
public function isEditable(): bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param mixed $folder
- Exclude checks
Spaces must 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
* Check if mail exist.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|int
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'id' => $row['crmid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'setype' => $params['mod'],
- Exclude checks
Spaces must 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 array $params
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => $record,
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from('vtiger_notes')
- Exclude checks
Spaces must 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 array $params
- 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
$dbCommand->insert('vtiger_seproductsrel', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'rel_created_time' => 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
->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
while ($row = $dataReader->read()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relmodule' => $newModule,
- Exclude checks
Spaces must 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
public function setReloadRelationRecord($moduleName, $record = 0)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Returns basic information about atachments for this mail.
- Exclude checks
Spaces must 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
'module' => $module,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Remove related.
- 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
$exists = (new App\Db\Query())->from('s_#__mail_relation_updater')->where(['crmid' => $record])->exists();
- 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
public function checkMailExist($uid, $folder, $rcId, $mbox)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where['mbox'] = $folder;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand->insert('vtiger_crmentityrel', [
- 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
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where = ['cid' => $mail->getUniqueId()];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'label' => \App\Record::getLabel($row['crmid']),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add related.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$newCrmId = (int) $params['newCrmId'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'crmid' => (int) $params['crmid'],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'relcrmid' => $newCrmId,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Set reload relation 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
\App\Db::getInstance()->createCommand()->insert('s_#__mail_relation_updater', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return (new App\Db\Query())->select(['name' => 'vtiger_notes.title', 'file' => 'vtiger_notes.filename', 'id' => 'vtiger_notes.notesid'])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$where['rc_user'] = $rcId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $record
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dataReader = $query->createCommand()->query();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$moduleDocuments = Vtiger_Module_Model::getInstance('Documents');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- 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
} else {
- Exclude checks
Line exceeds 120 characters; contains 179 characters Open
\App\Db::getInstance()->createCommand()->delete('vtiger_ossmailview_relation', ['ossmailviewid' => (int) $params['mailId'], 'crmid' => (int) $params['crmid']])->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
$mail = OSSMail_Record_Model::getMail($mbox, $uid, false);
- 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 function getRelatedRecords($record): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
- Exclude checks
Line exceeds 120 characters; contains 151 characters Open
'is_related_to_documents' => false !== Vtiger_Relation_Model::getInstance(Vtiger_Module_Model::getInstance($module), $moduleDocuments),
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$dbCommand = \App\Db::getInstance()->createCommand();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->leftJoin('vtiger_ossmailview_files', 'vtiger_ossmailview_files.documentsid = vtiger_notes.notesid')
- Exclude checks
Class name "OSSMailView_Record_Model" is not in camel caps format Open
class OSSMailView_Record_Model extends Vtiger_Record_Model
- Exclude checks
The variable $mail_type is not named in camelCase. Open
public function changeTypeSelectedRecords($selectedIds, $mail_type)
{
$mailType = self::getMailType();
$this->addLog('Action_ChangeType', \count($selectedIds));
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
public function addLog($action, $info)
{
$user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $user_id is not named in camelCase. Open
public function addLog($action, $info)
{
$user_id = Users_Record_Model::getCurrentUserModel()->get('user_name');
App\Db::getInstance()->createCommand()->insert('vtiger_ossmails_logs', ['action' => $action, 'info' => $info, 'user' => $user_id, 'start_time' => date('Y-m-d H:i:s')])->execute();
}
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $mail_type is not named in camelCase. Open
public function changeTypeSelectedRecords($selectedIds, $mail_type)
{
$mailType = self::getMailType();
$this->addLog('Action_ChangeType', \count($selectedIds));
\App\Db::getInstance()->createCommand()->update('vtiger_ossmailview', ['ossmailview_sendtype' => $mailType[$mail_type], 'type' => $mail_type], ['ossmailviewid' => $selectedIds])->execute();
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}