YetiForceCompany/YetiForceCRM

View on GitHub
modules/ServiceContracts/relations/GetDependentsList.php

Summary

Maintainability
A
0 mins
Test Coverage
F
0%
<?php
/**
 * Main file that includes basic operations on relations.
 *
 * @package   Relation
 *
 * @copyright YetiForce S.A.
 * @license   YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)
 * @author    Radosław Skrzypczak <r.skrzypczak@yetiforce.com>
 */

/**
 * ServiceContracts_GetDependentsList_Relation class.
 */
class ServiceContracts_GetDependentsList_Relation extends Vtiger_GetDependentsList_Relation
{
    /** {@inheritdoc} */
    public function create(int $sourceRecordId, int $destinationRecordId): bool
    {
        if ('HelpDesk' === $this->relationModel->getRelationModuleName()) {
            $entityInstance = $this->relationModel->getParentModuleModel()->getEntityInstance();
            $entityInstance->updateHelpDeskRelatedTo($sourceRecordId, $destinationRecordId);
            $entityInstance->updateServiceContractState($sourceRecordId);
        }
        return true;
    }
}