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 c012cd3..58397fa 100755 --- a/Admin/Install/Media.install.json +++ b/Admin/Install/Media.install.json @@ -1,18 +1,4 @@ [ - { - "type": "type", - "name": "vehicle_profile_image", - "l11n": [ - { - "title": "Profile image", - "lang": "en" - }, - { - "title": "Profilbild", - "lang": "de" - } - ] - }, { "type": "collection", "create_directory": true, diff --git a/Controller/ApiDriverAttributeController.php b/Controller/ApiDriverAttributeController.php index a4beaa0..35f2f8c 100644 --- a/Controller/ApiDriverAttributeController.php +++ b/Controller/ApiDriverAttributeController.php @@ -66,7 +66,7 @@ final class ApiDriverAttributeController extends Controller ->where('id', (int) $request->getData('type')) ->execute(); - if (!$type->repeatable) { + if (!$type->isRepeatable) { $attr = DriverAttributeMapper::count() ->with('type') ->where('type/id', $type->id) diff --git a/Controller/ApiDriverController.php b/Controller/ApiDriverController.php index eb4a901..2fa8f10 100644 --- a/Controller/ApiDriverController.php +++ b/Controller/ApiDriverController.php @@ -268,7 +268,7 @@ final class ApiDriverController extends Controller pathSettings: PathSettings::FILE_PATH, hasAccountRelation: false, readContent: $request->getDataBool('parse_content') ?? false, - type: $request->getDataInt('type'), + tag: $request->getDataInt('tag'), rel: $driver->id, mapper: DriverMapper::class, field: 'files' diff --git a/Controller/ApiVehicleAttributeController.php b/Controller/ApiVehicleAttributeController.php index 60d0cbf..e960224 100644 --- a/Controller/ApiVehicleAttributeController.php +++ b/Controller/ApiVehicleAttributeController.php @@ -66,7 +66,7 @@ final class ApiVehicleAttributeController extends Controller ->where('id', (int) $request->getData('type')) ->execute(); - if (!$type->repeatable) { + if (!$type->isRepeatable) { $attr = VehicleAttributeMapper::count() ->with('type') ->where('type/id', $type->id) diff --git a/Controller/ApiVehicleController.php b/Controller/ApiVehicleController.php index 845d06c..8ee4951 100755 --- a/Controller/ApiVehicleController.php +++ b/Controller/ApiVehicleController.php @@ -643,7 +643,7 @@ final class ApiVehicleController extends Controller pathSettings: PathSettings::FILE_PATH, hasAccountRelation: false, readContent: $request->getDataBool('parse_content') ?? false, - type: $request->getDataInt('type'), + tag: $request->getDataInt('tag'), rel: $vehicle->id, mapper: VehicleMapper::class, field: 'files' diff --git a/Controller/BackendController.php b/Controller/BackendController.php index aa22ef1..82182ce 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -32,8 +32,8 @@ use Modules\FleetManagement\Models\InspectionTypeMapper; use Modules\FleetManagement\Models\VehicleMapper; use Modules\FleetManagement\Models\VehicleTypeMapper; 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; @@ -595,7 +595,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') ->with('fuelType') @@ -627,15 +627,14 @@ final class BackendController extends Controller ->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::HAS_MANY['files']['self'], '=', VehicleMapper::TABLE . '.' . VehicleMapper::PRIMARYFIELD) ->leftJoin(MediaMapper::TABLE) ->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::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(VehicleMapper::HAS_MANY['files']['self'], '=', $vehicle->id) - ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'vehicle_profile_image'); + ->where(TagMapper::TABLE . '.' . TagMapper::getColumnByMember('name'), '=', 'profile_image'); $view->data['vehicleImage'] = MediaMapper::get() - ->with('types') ->where('id', $results) ->limit(1) ->execute(); @@ -688,7 +687,7 @@ final class BackendController extends Controller ->with('attributes/type/l11n') ->with('attributes/value/l11n') ->with('files') - ->with('files/types') + ->with('files/tags') ->where('id', (int) $request->getData('id')) ->where('attributes/type/l11n/language', $response->header->l11n->language) ->where('attributes/value/l11n/language', [$response->header->l11n->language, null]) @@ -712,15 +711,14 @@ final class BackendController extends Controller ->on(DriverMapper::HAS_MANY['files']['table'] . '.' . DriverMapper::HAS_MANY['files']['self'], '=', DriverMapper::TABLE . '.' . DriverMapper::PRIMARYFIELD) ->leftJoin(MediaMapper::TABLE) ->on(DriverMapper::HAS_MANY['files']['table'] . '.' . DriverMapper::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(DriverMapper::HAS_MANY['files']['self'], '=', $driver->id) - ->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'driver_profile_image'); + ->where(TagMapper::TABLE . '.' . TagMapper::getColumnByMember('name'), '=', 'profile_image'); $view->data['driverImage'] = MediaMapper::get() - ->with('types') ->where('id', $results) ->limit(1) ->execute(); diff --git a/Models/Attribute/DriverAttributeTypeMapper.php b/Models/Attribute/DriverAttributeTypeMapper.php index 139dd77..fe1b31d 100644 --- a/Models/Attribute/DriverAttributeTypeMapper.php +++ b/Models/Attribute/DriverAttributeTypeMapper.php @@ -42,7 +42,7 @@ final class DriverAttributeTypeMapper extends DataMapperFactory 'fleetmgmt_driver_attr_type_datatype' => ['name' => 'fleetmgmt_driver_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'fleetmgmt_driver_attr_type_fields' => ['name' => 'fleetmgmt_driver_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'fleetmgmt_driver_attr_type_custom' => ['name' => 'fleetmgmt_driver_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], - 'fleetmgmt_driver_attr_type_repeatable' => ['name' => 'fleetmgmt_driver_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], + 'fleetmgmt_driver_attr_type_repeatable' => ['name' => 'fleetmgmt_driver_attr_type_repeatable', 'type' => 'bool', 'internal' => 'isRepeatable'], 'fleetmgmt_driver_attr_type_internal' => ['name' => 'fleetmgmt_driver_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'], 'fleetmgmt_driver_attr_type_pattern' => ['name' => 'fleetmgmt_driver_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'fleetmgmt_driver_attr_type_required' => ['name' => 'fleetmgmt_driver_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], diff --git a/Models/Attribute/VehicleAttributeTypeMapper.php b/Models/Attribute/VehicleAttributeTypeMapper.php index f902d92..0ffb6b4 100644 --- a/Models/Attribute/VehicleAttributeTypeMapper.php +++ b/Models/Attribute/VehicleAttributeTypeMapper.php @@ -42,7 +42,7 @@ final class VehicleAttributeTypeMapper extends DataMapperFactory 'fleetmgmt_vehicle_attr_type_datatype' => ['name' => 'fleetmgmt_vehicle_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'fleetmgmt_vehicle_attr_type_fields' => ['name' => 'fleetmgmt_vehicle_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'fleetmgmt_vehicle_attr_type_custom' => ['name' => 'fleetmgmt_vehicle_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], - 'fleetmgmt_vehicle_attr_type_repeatable' => ['name' => 'fleetmgmt_vehicle_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], + 'fleetmgmt_vehicle_attr_type_repeatable' => ['name' => 'fleetmgmt_vehicle_attr_type_repeatable', 'type' => 'bool', 'internal' => 'isRepeatable'], 'fleetmgmt_vehicle_attr_type_internal' => ['name' => 'fleetmgmt_vehicle_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'], 'fleetmgmt_vehicle_attr_type_pattern' => ['name' => 'fleetmgmt_vehicle_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'fleetmgmt_vehicle_attr_type_required' => ['name' => 'fleetmgmt_vehicle_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],