From 14c7490f519ea08d2f1a8ab31dce66179c92ce45 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 -------------- Admin/Install/SearchCommands.php | 1 + Controller/ApiAttributeController.php | 2 +- Controller/ApiController.php | 2 +- Controller/BackendController.php | 12 ++++++------ Controller/SearchController.php | 12 ++++++------ Theme/Backend/Lang/de.lang.php | 2 +- Theme/Backend/Lang/en.lang.php | 2 +- Theme/Backend/client-list.tpl.php | 4 ++-- Theme/Backend/client-view.tpl.php | 2 +- tests/Controller/Api/ApiControllerClientTrait.php | 2 +- 12 files changed, 22 insertions(+), 35 deletions(-) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index adb8716..75cb759 100755 --- 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 d1e52de..280d7ab 100755 --- a/Admin/Install/Media.install.json +++ b/Admin/Install/Media.install.json @@ -12,19 +12,5 @@ "name": "Clients", "virtualPath": "/Modules/ClientManagement", "user": 1 - }, - { - "type": "type", - "name": "client_profile_image", - "l11n": [ - { - "title": "Profile image", - "lang": "en" - }, - { - "title": "Profilbild", - "lang": "de" - } - ] } ] \ No newline at end of file diff --git a/Admin/Install/SearchCommands.php b/Admin/Install/SearchCommands.php index fe7ab80..e157c46 100644 --- a/Admin/Install/SearchCommands.php +++ b/Admin/Install/SearchCommands.php @@ -23,6 +23,7 @@ return [ 'dest' => '\Modules\ClientManagement\Controller\SearchController:searchGeneral', 'verb' => RouteVerb::ANY, 'active' => true, + 'order' => 4, 'permission' => [ 'module' => SearchController::NAME, 'type' => PermissionType::READ, diff --git a/Controller/ApiAttributeController.php b/Controller/ApiAttributeController.php index ba459e3..416b745 100644 --- a/Controller/ApiAttributeController.php +++ b/Controller/ApiAttributeController.php @@ -66,7 +66,7 @@ final class ApiAttributeController extends Controller ->where('id', (int) $request->getData('type')) ->execute(); - if (!$type->repeatable) { + if (!$type->isRepeatable) { $attr = ClientAttributeMapper::count() ->with('type') ->where('type/id', $type->id) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 670a463..7a94331 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -631,7 +631,7 @@ final class ApiController extends Controller basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ClientManagement/Clients/' . ($request->getData('client') ?? '0'), virtualPath: '/Modules/ClientManagement/Clients/' . ($request->getData('client') ?? '0'), pathSettings: PathSettings::FILE_PATH, - type: $request->getDataInt('type'), + tag: $request->getDataInt('tag'), rel: (int) $request->getData('client'), mapper: ClientMapper::class, field: 'files' diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 9745e80..8c5064f 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -23,8 +23,8 @@ use Modules\ClientManagement\Models\Attribute\ClientAttributeValueMapper; use Modules\ClientManagement\Models\ClientMapper; use Modules\ClientManagement\Models\PermissionCategory; use Modules\Media\Models\MediaMapper; -use Modules\Media\Models\MediaTypeMapper; use Modules\Organization\Models\Attribute\UnitAttributeMapper; +use Modules\Tag\Models\TagMapper; use phpOMS\Account\PermissionType; use phpOMS\Asset\AssetType; use phpOMS\Contract\RenderableInterface; @@ -318,12 +318,12 @@ final class BackendController extends Controller ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::HAS_MANY['files']['self'], '=', ClientMapper::TABLE . '.' . ClientMapper::PRIMARYFIELD) ->leftJoin(MediaMapper::TABLE) ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::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(ClientMapper::HAS_MANY['files']['self'], '=', $view->data['client']->id) - ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'client_profile_image'); + ->where(TagMapper::TABLE . '.' . TagMapper::getColumnByMember('name'), '=', 'profile_image'); $view->data['clientImage'] = MediaMapper::get() ->where('id', $results) diff --git a/Controller/SearchController.php b/Controller/SearchController.php index 056661d..85c1705 100644 --- a/Controller/SearchController.php +++ b/Controller/SearchController.php @@ -17,7 +17,7 @@ namespace Modules\ClientManagement\Controller; use Modules\Admin\Models\ContactType; use Modules\ClientManagement\Models\ClientMapper; use Modules\Media\Models\MediaMapper; -use Modules\Media\Models\MediaTypeMapper; +use Modules\Tag\Models\TagMapper; use phpOMS\DataStorage\Database\Query\Builder; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; @@ -79,12 +79,12 @@ final class SearchController extends Controller ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::HAS_MANY['files']['self'], '=', ClientMapper::TABLE . '.' . ClientMapper::PRIMARYFIELD) ->leftJoin(MediaMapper::TABLE) ->on(ClientMapper::HAS_MANY['files']['table'] . '.' . ClientMapper::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(ClientMapper::HAS_MANY['files']['self'], '=', $account->id) - ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'client_profile_image'); + ->where(TagMapper::TABLE . '.' . TagMapper::getColumnByMember('name'), '=', 'profile_image'); $image = MediaMapper::get() ->where('id', $iResults) diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index f3a8e5f..0759bac 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -92,7 +92,7 @@ return ['ClientManagement' => [ 'Website' => 'Webseite', 'Wire' => 'Kabel', 'YTDSales' => 'Ytd Sales', - 'Zip' => 'Postleitzahl', + 'Postal' => 'Postleitzahl', 'ItemProductGroup' => 'Artikel Produktgruppe', 'Promocode' => 'Promocode', 'Region' => 'Region', diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 4729173..6a3b279 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -91,7 +91,7 @@ return ['ClientManagement' => [ 'Website' => 'Website', 'Wire' => 'Wire', 'YTDSales' => 'YTD Sales', - 'Zip' => 'Zip', + 'Postal' => 'Postal', 'ItemProductGroup' => 'Item Product Group', 'Promocode' => 'Promocode', 'Region' => 'Region', diff --git a/Theme/Backend/client-list.tpl.php b/Theme/Backend/client-list.tpl.php index 3f644d9..8abd5c0 100755 --- a/Theme/Backend/client-list.tpl.php +++ b/Theme/Backend/client-list.tpl.php @@ -67,7 +67,7 @@ echo $this->data['nav']->render(); ?> - getHtml('Zip'); ?> + getHtml('Postal'); ?>