forked from fa/breadcrumb-the-shire
Add a new Software-Produkte feature to the helpdesk module that syncs contract types (Create_SaaS_License=true) from BC OData into a local database table with a nightly scheduler job, providing a Grid.js list page and detail/edit page for managing custom product names. - DB migration 003: helpdesk_software_products table (code UNIQUE key) - BcODataGateway: FS_Contract_Types entity with SaaS filter + fallback - SoftwareProductRepository: upsert, listPaged, softDelete, updateName - SoftwareProductSyncService: fetch → upsert → soft-delete lifecycle - SoftwareProductSyncJobHandler: daily at 02:00 via scheduler platform - SoftwareProductService: web UI business logic with validation - Permission: helpdesk.software-products.manage (nav-gated) - List page: Grid.js with Code, BC Description, Name, Status columns - Detail page: Code/BC Description read-only, Name editable, PRG pattern - i18n: de + en translation keys Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
use MintyPHP\Module\Helpdesk\HelpdeskAuthorizationPolicy;
|
|
use MintyPHP\Module\Helpdesk\Service\SoftwareProductService;
|
|
use MintyPHP\Support\Guard;
|
|
|
|
Guard::requireLogin();
|
|
Guard::requireAbilityOrForbidden(HelpdeskAuthorizationPolicy::ABILITY_SOFTWARE_PRODUCTS_MANAGE);
|
|
gridRequireGetRequest();
|
|
|
|
$filters = gridParseFiltersFromSchemaFile(__DIR__ . '/software-products/filter-schema.php');
|
|
|
|
$service = app(SoftwareProductService::class);
|
|
$result = $service->listPaged($filters);
|
|
|
|
$rows = $result['rows'] ?? [];
|
|
$total = $result['total'] ?? 0;
|
|
|
|
$editBaseUrl = lurl('helpdesk/software-products/edit/');
|
|
|
|
$preparedRows = [];
|
|
foreach ($rows as $row) {
|
|
$code = (string) ($row['code'] ?? '');
|
|
$active = (int) ($row['active'] ?? 1);
|
|
|
|
$preparedRows[] = [
|
|
'code' => $code,
|
|
'bc_description' => (string) ($row['bc_description'] ?? ''),
|
|
'name' => (string) ($row['name'] ?? ''),
|
|
'active' => $active,
|
|
'active_label' => $active ? t('Active') : t('Inactive'),
|
|
'active_variant' => $active ? 'success' : 'neutral',
|
|
'synced_at' => (string) ($row['synced_at'] ?? ''),
|
|
'edit_url' => $code !== '' ? $editBaseUrl . rawurlencode($code) : '',
|
|
];
|
|
}
|
|
|
|
gridJsonDataResult($preparedRows, $total);
|