Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -32,6 +32,7 @@ namespace Espo\Classes\RecordHooks\CurrencyRecordRate;
|
||||
use Espo\Core\Exceptions\Conflict;
|
||||
use Espo\Core\Record\DeleteParams;
|
||||
use Espo\Core\Record\Hook\DeleteHook;
|
||||
use Espo\Core\Utils\Currency\DatabasePopulator;
|
||||
use Espo\Core\WebSocket\Submission;
|
||||
use Espo\Entities\CurrencyRecordRate;
|
||||
use Espo\ORM\Entity;
|
||||
@@ -46,6 +47,7 @@ class AfterDelete implements DeleteHook
|
||||
public function __construct(
|
||||
private SyncManager $syncManager,
|
||||
private Submission $submission,
|
||||
private DatabasePopulator $databasePopulator,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity, DeleteParams $params): void
|
||||
@@ -58,6 +60,7 @@ class AfterDelete implements DeleteHook
|
||||
throw new Conflict($e->getMessage(), previous: $e);
|
||||
}
|
||||
|
||||
$this->databasePopulator->process();
|
||||
$this->submission->submit('appParamsUpdate');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Classes\RecordHooks\CurrencyRecordRate;
|
||||
|
||||
use Espo\Core\Exceptions\Conflict;
|
||||
use Espo\Core\Record\Hook\SaveHook;
|
||||
use Espo\Core\Utils\Currency\DatabasePopulator;
|
||||
use Espo\Core\WebSocket\Submission;
|
||||
use Espo\Entities\CurrencyRecordRate;
|
||||
use Espo\ORM\Entity;
|
||||
@@ -45,6 +46,7 @@ class AfterSave implements SaveHook
|
||||
public function __construct(
|
||||
private SyncManager $syncManager,
|
||||
private Submission $submission,
|
||||
private DatabasePopulator $databasePopulator,
|
||||
) {}
|
||||
|
||||
public function process(Entity $entity): void
|
||||
@@ -57,6 +59,7 @@ class AfterSave implements SaveHook
|
||||
throw new Conflict($e->getMessage(), previous: $e);
|
||||
}
|
||||
|
||||
$this->databasePopulator->process();
|
||||
$this->submission->submit('appParamsUpdate');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ class RecordService
|
||||
];
|
||||
|
||||
if ($this->user->isPortal()) {
|
||||
$where[] = ['isInternal' => true];
|
||||
$where[] = ['isInternal' => false];
|
||||
}
|
||||
|
||||
$this->applyPortalAccess($builder, $where);
|
||||
|
||||
Reference in New Issue
Block a user