Function addToQueueWhenParentHasBeenModified
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function addToQueueWhenParentHasBeenModified(\Vtiger_Record_Model $recordModel)
{
if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
if (!empty($previousValue)) {
$this->addToQueueSubordinateModule($previousValue);
- 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 updateFieldValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function updateFieldValue(int $recordId)
{
if (!$this->checkIsConfigured()) {
return;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Missing class import via use statement (line '302', column '8'). Open
(new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();
- 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 '393', column '10'). Open
(new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '286', column '9'). Open
(new \App\BatchMethod([
- 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 '369', column '10'). Open
(new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Missing class import via use statement (line '320', column '19'). Open
$config = (new \App\Db\Query())
- Read upRead up
- Exclude checks
MissingImport
Since: 2.7.0
Importing all external classes in a file through use statements makes them clearly visible.
Example
function make() {
return new \stdClass();
}
Source http://phpmd.org/rules/cleancode.html#MissingImport
Avoid using static access to class '\App\Cache' in method 'getChildrenValues'. Open
} elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Record' in method 'updateFieldValue'. Open
if (!\App\Record::isExists($recordId, $this->targetModuleName)) {
- 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\Log' in method 'updateFieldValue'. Open
\App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");
- 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 'addToQueueSubordinateModule'. Open
'params' => [\App\Module::getModuleName($config['source_module']), $recordId],
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid assigning values to variables in if clauses and the like (line '265', column '57'). Open
private function addToQueueWhenParentHasBeenModified(\Vtiger_Record_Model $recordModel)
{
if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
if (!empty($previousValue)) {
$this->addToQueueSubordinateModule($previousValue);
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Avoid using static access to class '\App\Cache' in method 'getConfig'. Open
if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getChildrenValues'. Open
$items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getChildrenValues'. Open
\App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);
- 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 'getConfig'. Open
->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Json' in method '__construct'. Open
$this->rules = \App\Json::decode($config['rules']);
- 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 'updateFieldValue'. Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->targetModuleName);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Cache' in method 'getConfig'. Open
$config = \App\Cache::get('RecordFlowUpdater.getConfig', $cacheKey);
- Read upRead up
- Exclude checks
StaticAccess
Since: 1.4.0
Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.
Example
class Foo
{
public function bar()
{
Bar::baz();
}
}
Source https://phpmd.org/rules/cleancode.html#staticaccess
Avoid using static access to class '\App\Fields\Picklist' in method 'getStatusFromPicklist'. Open
foreach (\App\Fields\Picklist::getValues($this->sourceField) as $item) {
- 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 getConfig uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$config = (new \App\Db\Query())
->from('s_#__auto_record_flow_updater')
->where(['status' => 1])
->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Cache' in method 'getConfig'. Open
\App\Cache::save('RecordFlowUpdater.getConfig', $column, $cacheKey);
- 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\Log' in method 'executeRules'. Open
\App\Log::warning(
"There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .
implode(',', array_map(function ($item) {
return $item['status'];
}, $itmes))
- 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 '__construct'. Open
$sourceModuleModel = \Vtiger_Module_Model::getInstance($this->sourceModuleName);
- 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 '__construct'. Open
$targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_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
The method getChildrenValues uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. Open
} else {
$columnId = "{$this->targetTable}.{$this->targetTableId}";
$items = $this->getStatusFromPicklist(
(new \App\Db\Query())
->select(['id' => $columnId, 'status' => "{$this->targetTable}.{$this->targetField}"])
- Read upRead up
- Exclude checks
ElseExpression
Since: 1.4.0
An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.
Example
class Foo
{
public function bar($flag)
{
if ($flag) {
// one branch
} else {
// another branch
}
}
}
Source https://phpmd.org/rules/cleancode.html#elseexpression
Avoid using static access to class '\App\Module' in method '__construct'. Open
$this->targetModuleName = \App\Module::getModuleName($config['target_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 "RecordFlowUpdater.getConfig" 3 times. Open
if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {
- 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 "RecordFlowUpdater.getChildrenValues" 3 times. Open
} elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
- 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 "status" 5 times. Open
->where(['status' => 1])
- 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 "target_module" 3 times. Open
$targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_module']);
- 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.
Call to method error
from undeclared class \App\Log
Open
\App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
(new \App\Db\Query())
- Exclude checks
Assigning false
to property but \App\Automatic\RecordFlowUpdater->sourceTable
is string
Open
$this->sourceTable = $sourceModuleModel->basetable;
- Exclude checks
Assigning false
to property but \App\Automatic\RecordFlowUpdater->targetTableId
is string
Open
$this->targetTableId = $targetModuleModel->basetableid;
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticSave()
takes string
defined at /code/app/Cache.php:156
Open
\App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);
- Exclude checks
Assigning false
to property but \App\Automatic\RecordFlowUpdater->sourceTableId
is string
Open
$this->sourceTableId = $sourceModuleModel->basetableid;
- Exclude checks
Call to undeclared method \App\Db\Query::from
Open
$config = (new \App\Db\Query())
- Exclude checks
Expected @param annotation for sourceModuleName
to be before the @param annotation for recordId
Open
* @param int $recordId
- Exclude checks
Call to method warning
from undeclared class \App\Log
Open
\App\Log::warning(
- Exclude checks
Assigning false
to property but \App\Automatic\RecordFlowUpdater->targetTable
is string
Open
$this->targetTable = $targetModuleModel->basetable;
- Exclude checks
Saw an @param annotation for value,
but it was not found in the param list of function getConfig(string $column = 'source_module') : array|false
Open
* @param mixed $value
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticHas()
takes string
defined at /code/app/Cache.php:141
Open
} elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
- Exclude checks
Argument 2 (key)
is int
but \App\Cache::staticGet()
takes string
defined at /code/app/Cache.php:128
Open
$items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);
- Exclude checks
Call to undeclared method \App\Db\Query::select
Open
(new \App\Db\Query())
- Exclude checks
Avoid excessively long variable names like $currentColumnParentId. Keep variable name length under 20. Open
protected $currentColumnParentId;
- 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
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public static function update(string $sourceModuleName, int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $sourceField;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must 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 (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $sourceModuleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $targetTable;
- Exclude checks
Spaces must 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
protected $targetColumnParentId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The default value is returned if the rules do not specify this case.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Definition of rules for automatic status change.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $isConfigured = 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
* Construct.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetTableId = $targetModuleModel->basetableid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Check is configured.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update field value.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Method called in Handler during the event "entityChangeState".
- Exclude checks
Spaces must 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 to the queue when the source field has been modified.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function addToQueueWhenSourceFieldHasBeenModified(\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
$this->addToQueue($recordModel->get($this->targetTableId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Add to the queue when the parent has been modified.
- Exclude checks
Spaces must 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $targetTableId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var 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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Is configured.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$sourceModuleModel = \Vtiger_Module_Model::getInstance($this->sourceModuleName);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the table in the database for the superior/target element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $sourceTableId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must 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 void
- Exclude checks
Spaces must 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->addToQueueWhenSourceFieldHasBeenModified($recordModel);
- 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
$this->addToQueueSubordinateModule($previousValue);
- Exclude checks
Spaces must 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
* Add to queue subordinate 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the table in the database for the current element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $sourceTable;
- Exclude checks
Spaces must 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->sourceField = $config['source_field'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->isConfigured = 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
if (!$this->checkIsConfigured()) {
- Exclude checks
Spaces must 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 entityChangeState(\Vtiger_Record_Model $recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the "primary key" column for the superior/target element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the "value" column/field for the superior/target element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var 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
*/
- Exclude checks
Spaces must 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->sourceModuleName = $sourceModuleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$returnedValue = $this->executeRules($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel = \Vtiger_Record_Model::getInstanceById($recordId, $this->targetModuleName);
- Exclude checks
Spaces must 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 void
- 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
*
- Exclude checks
Spaces must 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
* Name of the module for current elemnt.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the "primary key" column for the current element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var 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
$targetModuleModel = \Vtiger_Module_Model::getInstance($config['target_module']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function checkIsConfigured(): 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
return $this->isConfigured;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Log::error("The record does not exist recordId: {$recordId} module: {$this->targetModuleName}.");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->updateFieldValue($recordModel->get($this->targetColumnParentId));
- Exclude checks
Spaces must 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 entityAfterSave(\Vtiger_Record_Model $recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->checkIsConfigured() && !empty($this->targetTableId)) {
- Exclude checks
Spaces must 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 void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function addToQueueWhenParentHasBeenModified(\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
protected $targetModuleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $targetField;
- Exclude checks
Spaces must 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the "parent ID" column for the current element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $sourceModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetTable = $targetModuleModel->basetable;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->defaultValue = $config['default_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
$recordModel->set($this->targetField, $returnedValue);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$recordModel->isNew()) {
- Exclude checks
Spaces must 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
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $currentModuleName;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $defaultValue = 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
if (!\App\Record::isExists($recordId, $this->targetModuleName)) {
- 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
} elseif (!empty($this->targetTableId)) {
- Exclude checks
Spaces must 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 void
- Exclude checks
Spaces must 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
* @return void
- Exclude checks
Spaces must 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 __construct(string $sourceModuleName)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $config) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->checkIsConfigured()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($recordModel->get($this->targetField) !== $returnedValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Method called in Handler during the event "entityAfterSave".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addToQueueSubordinateModule($recordModel->get($this->targetColumnParentId));
- Exclude checks
Spaces must 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
* @var 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
* The name of the "primary key" column for the current element.
- Exclude checks
Spaces must 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->isConfigured = 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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function updateFieldValue(int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Method called in Handler during the event "entityAfterDelete".
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->targetTableId) && $recordModel->getPreviousValue($this->sourceField)) {
- Exclude checks
Spaces must 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
* Name of the module for superior/target elemnt.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* The name of the "status" column for the current element.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Update the value of the field.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetField = $config['target_field'];
- 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
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Source/sub-module module name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
protected $currentColumnParentId;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $sourceModuleName
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private $rules = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->rules = \App\Json::decode($config['rules']);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addToQueueWhenParentHasBeenModified($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
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetColumnParentId = $config['relation_field'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addToQueue($recordModel->get($this->targetTableId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$recordModel->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->targetColumnParentId) && !$recordModel->isEmpty($this->targetColumnParentId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addToQueue($recordModel->get($this->targetTableId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
"There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function entityAfterDelete(\Vtiger_Record_Model $recordModel)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif (\App\Cache::staticHas('RecordFlowUpdater.getChildrenValues', $recordId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->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
return $items;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($previousValue)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getStatusFromPicklist(array $items): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getConfig(string $column = 'source_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
* Get values from the source.
- Exclude checks
Spaces must 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 $items;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->targetModuleName = \App\Module::getModuleName($config['target_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
* @param \Vtiger_Record_Model $recordModel
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->checkIsConfigured() && !empty($this->targetTableId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'method' => static::class . '::update',
- Exclude checks
Spaces must 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 $value
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = \App\Cache::get('RecordFlowUpdater.getConfig', $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool|string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (empty($this->targetColumnParentId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', "{$columnId} = vtiger_crmentity.crmid")
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(["{$this->targetTable}.{$this->targetColumnParentId}" => $recordId])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $this->getStatusFromPicklist(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere(["{$this->sourceTable}.{$this->targetTableId}" => $recordId])
- 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
$picklist[$item['picklistValue']] = $item;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new static($sourceModuleName))->updateFieldValue($recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = $this->getConfig();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sourceTable = $sourceModuleModel->basetable;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->sourceTableId = $sourceModuleModel->basetableid;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return bool
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->addToQueue($recordModel->get($this->targetTableId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!empty($this->targetColumnParentId) && false !== ($previousValue = $recordModel->getPreviousValue($this->targetColumnParentId))) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$recordModel->isEmpty($this->targetColumnParentId)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function addToQueueSubordinateModule(int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['status' => 1])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $config;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === $returnedValue) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\BatchMethod([
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
]))->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param string $column
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items = \App\Cache::staticGet('RecordFlowUpdater.getChildrenValues', $recordId);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->innerJoin('vtiger_crmentity', "{$columnId} = vtiger_crmentity.crmid")
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'params' => [\App\Module::getModuleName($config['source_module']), $recordId],
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array|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
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return $returnedValue;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($this->targetTable)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getValuesFromSource(int $recordId): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$item['automation'] = $picklist[$item['status']]['automation'];
- Exclude checks
Spaces must 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\Log::warning(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
implode(',', array_map(function ($item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param array $items
- Exclude checks
Spaces must 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 to queue.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function addToQueue(int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['id' => $columnId, 'status' => "{$this->targetTable}.{$this->targetField}"])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnId = "{$this->sourceTable}.{$this->sourceTableId}";
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->from($this->sourceTable)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get status from picklist.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (\App\Cache::has('RecordFlowUpdater.getConfig', $cacheKey)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function getChildrenValues(int $recordId): array
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::staticSave('RecordFlowUpdater.getChildrenValues', $recordId, $items);
- Exclude checks
Spaces must 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
->one();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$itmes = array_merge($this->getValuesFromSource($recordId), $this->getChildrenValues($recordId));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}, $itmes))
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get the values of children.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$items = [];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$columnId = "{$this->targetTable}.{$this->targetTableId}";
- Exclude checks
Spaces must 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, 2]])
- Exclude checks
Spaces must 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('s_#__auto_record_flow_updater')
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Execute rules and return the processed 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
return $item['status'];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- 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
* @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
foreach ($items as &$item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = $this->getConfig('target_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
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->andWhere([$column => \App\Module::getModuleId($this->sourceModuleName)])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$picklist = [];
- 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
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$config = (new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function executeRules(int $recordId)
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false !== $config) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param int $recordId
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
(new \App\BatchMethod(['method' => static::class . '::update', 'params' => [$this->sourceModuleName, $recordId]]))->save();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$cacheKey = "{$this->sourceModuleName}.{$column}";
- 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
$returnedValue = (new RulesPicklist($this->rules, $this->defaultValue))->getValue($itmes);
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
"There is no rule defined for this case recordId: {$recordId} module: {$this->sourceModuleName}. Statuses:" .
- Exclude checks
Spaces must 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
$items = $this->getStatusFromPicklist(
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->where(['vtiger_crmentity.deleted' => [0, 2]])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
(new \App\Db\Query())
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach (\App\Fields\Picklist::getValues($this->sourceField) as $item) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get config.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
\App\Cache::save('RecordFlowUpdater.getConfig', $column, $cacheKey);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
->select(['id' => $columnId, 'status' => "{$this->sourceTable}." . $this->sourceField])
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Multi-line function call not indented correctly; expected 12 spaces but found 16 Open
(new \App\Db\Query())
- Exclude checks
Multi-line function call not indented correctly; expected 8 spaces but found 12 Open
);
- Exclude checks