From e1934a84ea3ab5f05188e9939afc9991ad9d568a Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 12 May 2024 00:03:34 +0000 Subject: [PATCH] bug fixes --- .github/workflows/greetings.yml | 2 +- Admin/Install/Media.install.json | 14 -------------- Controller/ApiAssetAttributeController.php | 2 +- Controller/ApiController.php | 2 +- Controller/BackendController.php | 15 +++++++-------- Models/Attribute/AssetAttributeTypeMapper.php | 2 +- 6 files changed, 11 insertions(+), 26 deletions(-) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index adb8716..75cb759 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -9,5 +9,5 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thank you for createing this issue. We will check it as soon as possible.' + issue-message: 'Thank you for creating this issue. We will check it as soon as possible.' pr-message: 'Thank you for your pull request. We will check it as soon as possible.' diff --git a/Admin/Install/Media.install.json b/Admin/Install/Media.install.json index 3b1bf61..f67dbc1 100644 --- a/Admin/Install/Media.install.json +++ b/Admin/Install/Media.install.json @@ -1,18 +1,4 @@ [ - { - "type": "type", - "name": "equipment_profile_image", - "l11n": [ - { - "title": "Profile image", - "lang": "en" - }, - { - "title": "Profilbild", - "lang": "de" - } - ] - }, { "type": "collection", "create_directory": true, diff --git a/Controller/ApiAssetAttributeController.php b/Controller/ApiAssetAttributeController.php index 6a99222..9e367f9 100644 --- a/Controller/ApiAssetAttributeController.php +++ b/Controller/ApiAssetAttributeController.php @@ -66,7 +66,7 @@ final class ApiAssetAttributeController extends Controller ->where('id', (int) $request->getData('type')) ->execute(); - if (!$type->repeatable) { + if (!$type->isRepeatable) { $attr = AssetAttributeMapper::count() ->with('type') ->where('type/id', $type->id) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index c276f02..faf5dcb 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -194,7 +194,7 @@ final class ApiController extends Controller pathSettings: PathSettings::FILE_PATH, hasAccountRelation: false, readContent: $request->getDataBool('parse_content') ?? false, - type: $request->getDataInt('type'), + tag: $request->getDataInt('tag'), rel: $asset->id, mapper: AssetMapper::class, field: 'files' diff --git a/Controller/BackendController.php b/Controller/BackendController.php index c66a160..891c42d 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -19,8 +19,8 @@ use Modules\AssetManagement\Models\AssetTypeMapper; use Modules\AssetManagement\Models\Attribute\AssetAttributeTypeL11nMapper; use Modules\AssetManagement\Models\Attribute\AssetAttributeTypeMapper; use Modules\Media\Models\MediaMapper; -use Modules\Media\Models\MediaTypeMapper; use Modules\Organization\Models\UnitMapper; +use Modules\Tag\Models\TagMapper; use phpOMS\Contract\RenderableInterface; use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\Message\RequestAbstract; @@ -94,7 +94,7 @@ final class BackendController extends Controller ->with('attributes/type/l11n') ->with('attributes/value/l11n') ->with('files') - ->with('files/types') + ->with('files/tags') ->with('type') ->with('type/l11n') ->where('id', (int) $request->getData('id')) @@ -112,15 +112,14 @@ final class BackendController extends Controller ->on(AssetMapper::HAS_MANY['files']['table'] . '.' . AssetMapper::HAS_MANY['files']['self'], '=', AssetMapper::TABLE . '.' . AssetMapper::PRIMARYFIELD) ->leftJoin(MediaMapper::TABLE) ->on(AssetMapper::HAS_MANY['files']['table'] . '.' . AssetMapper::HAS_MANY['files']['external'], '=', MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD) - ->leftJoin(MediaMapper::HAS_MANY['types']['table']) - ->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self']) - ->leftJoin(MediaTypeMapper::TABLE) - ->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD) + ->leftJoin(MediaMapper::HAS_MANY['tags']['table']) + ->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['tags']['table'] . '.' . MediaMapper::HAS_MANY['tags']['self']) + ->leftJoin(TagMapper::TABLE) + ->on(MediaMapper::HAS_MANY['tags']['table'] . '.' . MediaMapper::HAS_MANY['tags']['external'], '=', TagMapper::TABLE . '.' . TagMapper::PRIMARYFIELD) ->where(AssetMapper::HAS_MANY['files']['self'], '=', $view->data['asset']->id) - ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'asset_profile_image'); + ->where(TagMapper::TABLE . '.' . TagMapper::getColumnByMember('name'), '=', 'profile_image'); $view->data['assetImage'] = MediaMapper::get() - ->with('types') ->where('id', $results) ->limit(1) ->execute(); diff --git a/Models/Attribute/AssetAttributeTypeMapper.php b/Models/Attribute/AssetAttributeTypeMapper.php index c1c8357..c2771b7 100644 --- a/Models/Attribute/AssetAttributeTypeMapper.php +++ b/Models/Attribute/AssetAttributeTypeMapper.php @@ -42,7 +42,7 @@ final class AssetAttributeTypeMapper extends DataMapperFactory 'assetmgmt_attr_type_datatype' => ['name' => 'assetmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'assetmgmt_attr_type_fields' => ['name' => 'assetmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'assetmgmt_attr_type_custom' => ['name' => 'assetmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], - 'assetmgmt_attr_type_repeatable' => ['name' => 'assetmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], + 'assetmgmt_attr_type_repeatable' => ['name' => 'assetmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'isRepeatable'], 'assetmgmt_attr_type_internal' => ['name' => 'assetmgmt_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'], 'assetmgmt_attr_type_pattern' => ['name' => 'assetmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'assetmgmt_attr_type_required' => ['name' => 'assetmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],