New Updates page in the Helpdesk module that fetches UPDATE/UPDATE-HF tickets from Business Central (PBI_LV_Tickets) and allows assigning a domain and Gitea link via a dialog. Ticket status (from BC) and assignment status (local) are shown as separate columns with filters for both plus type and free-text search. Assigned updates also appear on the domain detail page. Includes session-cached BC fetch with refresh button, admin permissions, migration, and 16 unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
934 B
PHP
45 lines
934 B
PHP
<?php
|
|
|
|
use MintyPHP\Module\Helpdesk\HelpdeskAuthorizationPolicy;
|
|
use MintyPHP\Module\Helpdesk\Service\BcODataGateway;
|
|
use MintyPHP\Router;
|
|
use MintyPHP\Support\Guard;
|
|
|
|
Guard::requireLogin();
|
|
Guard::requireAbilityOrForbidden(HelpdeskAuthorizationPolicy::ABILITY_UPDATES_MANAGE);
|
|
gridRequireGetRequest();
|
|
|
|
$request = requestInput();
|
|
$debitorNo = trim((string) $request->query('debitor_no', ''));
|
|
|
|
if ($debitorNo === '') {
|
|
Router::json([]);
|
|
|
|
return;
|
|
}
|
|
|
|
try {
|
|
$domains = app(BcODataGateway::class)->getDomainsForCustomer($debitorNo);
|
|
} catch (\Throwable) {
|
|
Router::json([]);
|
|
|
|
return;
|
|
}
|
|
|
|
$items = [];
|
|
foreach ($domains as $domain) {
|
|
$no = trim((string) ($domain['No'] ?? ''));
|
|
$url = trim((string) ($domain['URL'] ?? ''));
|
|
if ($no === '') {
|
|
continue;
|
|
}
|
|
|
|
$items[] = [
|
|
'value' => $no,
|
|
'label' => $url !== '' ? $url : $no,
|
|
'url' => $url,
|
|
];
|
|
}
|
|
|
|
Router::json($items);
|