diff --git a/application/Espo/Tools/Kanban/Kanban.php b/application/Espo/Tools/Kanban/Kanban.php index 474ab53db7..0a23142fb9 100644 --- a/application/Espo/Tools/Kanban/Kanban.php +++ b/application/Espo/Tools/Kanban/Kanban.php @@ -29,7 +29,9 @@ namespace Espo\Tools\Kanban; +use Espo\Core\Exceptions\BadRequest; use Espo\Core\Exceptions\Error; +use Espo\Core\Exceptions\Forbidden; use Espo\Core\FieldProcessing\ListLoadProcessor; use Espo\Core\FieldProcessing\Loader\Params as FieldLoaderParams; use Espo\Core\Record\Collection; @@ -111,6 +113,8 @@ class Kanban * Get kanban record data. * * @throws Error + * @throws Forbidden + * @throws BadRequest */ public function getResult(): Result { @@ -182,7 +186,7 @@ class Kanban $newOrder = $itemQuery->getOrder(); array_unshift($newOrder, [ - 'COALESCE:(kanbanOrder.order, ' . strval($this->maxOrderNumber + 1) . ')', + 'COALESCE:(kanbanOrder.order, ' . ($this->maxOrderNumber + 1) . ')', 'ASC', ]); @@ -260,7 +264,7 @@ class Kanban $statusField = $this->metadata->get(['scopes', $this->entityType, 'statusField']); if (!$statusField) { - throw new Error("No status field for entity type '{$this->entityType}'."); + throw new Error("No status field for entity type '$this->entityType'."); } return $statusField; @@ -279,7 +283,7 @@ class Kanban $statusList = $this->metadata->get(['entityDefs', $this->entityType, 'fields', $statusField, 'options']); if (empty($statusList)) { - throw new Error("No options for status field for entity type '{$this->entityType}'."); + throw new Error("No options for status field for entity type '$this->entityType'."); } return $statusList; diff --git a/application/Espo/Tools/Kanban/KanbanService.php b/application/Espo/Tools/Kanban/KanbanService.php index e41635c427..299e262621 100644 --- a/application/Espo/Tools/Kanban/KanbanService.php +++ b/application/Espo/Tools/Kanban/KanbanService.php @@ -31,43 +31,31 @@ namespace Espo\Tools\Kanban; use Espo\Core\Acl\Table; use Espo\Core\AclManager; +use Espo\Core\Exceptions\BadRequest; use Espo\Core\Exceptions\Error; +use Espo\Core\Exceptions\Forbidden; use Espo\Core\Exceptions\ForbiddenSilent; use Espo\Core\InjectableFactory; use Espo\Core\Select\SearchParams; use Espo\Core\Utils\Config; use Espo\Core\Utils\Metadata; - use Espo\Entities\User; class KanbanService { - private User $user; - private AclManager $aclManager; - private InjectableFactory $injectableFactory; - private Config $config; - private Metadata $metadata; - private Orderer $orderer; - public function __construct( - User $user, - AclManager $aclManager, - InjectableFactory $injectableFactory, - Config $config, - Metadata $metadata, - Orderer $orderer - ) { - $this->user = $user; - $this->aclManager = $aclManager; - $this->injectableFactory = $injectableFactory; - $this->config = $config; - $this->metadata = $metadata; - $this->orderer = $orderer; - } + private User $user, + private AclManager $aclManager, + private InjectableFactory $injectableFactory, + private Config $config, + private Metadata $metadata, + private Orderer $orderer + ) {} /** * @throws Error - * @throws ForbiddenSilent + * @throws Forbidden + * @throws BadRequest */ public function getData(string $entityType, SearchParams $searchParams): Result { @@ -93,7 +81,7 @@ class KanbanService /** * @param string[] $ids - * @throws ForbiddenSilent + * @throws Forbidden */ public function order(string $entityType, string $group, array $ids): void { @@ -128,7 +116,7 @@ class KanbanService } if ($this->metadata->get(['recordDefs', $entityType, 'kanbanDisabled'])) { - throw new ForbiddenSilent("Kanban is disabled for '{$entityType}'."); + throw new ForbiddenSilent("Kanban is disabled for '$entityType'."); } if (!$this->aclManager->check($this->user, $entityType, Table::ACTION_READ)) {